original_string: public function withComponent($components, $callback = null)
      {
          return $this->filter(function ($object) use ($components, $callback) {
  
              $hasComponent = false;
  
              foreach ((array) $components as $componentName) {
  
                  if (!$callback && $object->hasComponent($componentName)) {
                      $hasComponent = true;
                  }
  
                  if ($callback && ($component = $object->getComponent($componentName))) {
                      $hasComponent = call_user_func($callback, $component) ?: $hasComponent;
                  }
              }
  
              return $hasComponent;
          });
      }
code: public function withComponent($components, $callback = null)
      {
          return $this->filter(function ($object) use ($components, $callback) {
  
              $hasComponent = false;
  
              foreach ((array) $components as $componentName) {
  
                  if (!$callback && $object->hasComponent($componentName)) {
                      $hasComponent = true;
                  }
  
                  if ($callback && ($component = $object->getComponent($componentName))) {
                      $hasComponent = call_user_func($callback, $component) ?: $hasComponent;
                  }
              }
  
              return $hasComponent;
          });
      }
code_tokens: public function withComponent ( $ components , $ callback = null ) { return $ this -> filter ( function ( $ object ) use ( $ components , $ callback ) { $ hasComponent = false ; foreach ( ( array ) $ components as $ componentName ) { if ( ! $ callback && $ object -> hasComponent ( $ componentName ) ) { $ hasComponent = true ; } if ( $ callback && ( $ component = $ object -> getComponent ( $ componentName ) ) ) { $ hasComponent = call_user_func ( $ callback , $ component ) ? : $ hasComponent ; } } return $ hasComponent ; } ) ; }
docstring: Returns objects that use the supplied component.
  @param  string|array $components
  @param null|callback $callback
  @return static
docstring_tokens: Returns objects that use the supplied component .