| Conditions | 10 | 
| Paths | 21 | 
| Total Lines | 66 | 
| Code Lines | 34 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php | ||
| 37 | public function onKernelController(FilterControllerEvent $event) | ||
| 38 |     { | ||
| 39 | $controller = $event->getController(); | ||
| 40 | |||
| 41 | // $controller passed can be either a class or a Closure. This is not | ||
| 42 | // usual in Symfony but it may happen. If it is a class, it comes in | ||
| 43 | // array format | ||
| 44 |         if (!is_array($controller)) { | ||
| 45 | return; | ||
| 46 | } | ||
| 47 | |||
| 48 | // Get the request with namespace and others information we need and | ||
| 49 | // construct the bundle namespace | ||
| 50 | $request = $this->getRequest($event); | ||
| 51 | |||
| 52 |         $namespace = array('_namespace', '_bundle'); | ||
| 53 |         foreach ($namespace as $key => $value) { | ||
| 54 | $namespace[$key] = $request->attributes->get($value); | ||
| 55 | } | ||
| 56 | |||
| 57 | array_unshift($namespace, '@'); | ||
| 58 |         $namespace = implode('', $namespace); | ||
| 59 | $namespace = array($namespace, 'Resources', 'config', 'sonata.yml'); | ||
| 60 |         $namespace = implode('/', $namespace); | ||
| 61 | |||
| 62 | // Get the configuration file from the configuration into the | ||
| 63 | // corresponding bundle | ||
| 64 |         try { | ||
| 65 | $path = $this->fileLocator->locate($namespace); | ||
| 66 |         } catch (\InvalidArgumentException $e) { | ||
| 67 | // Nothing to do because there's no SEO file | ||
| 68 | return; | ||
| 69 | } | ||
| 70 | |||
| 71 |         try { | ||
| 72 | $config = Yaml::parse($path); | ||
| 73 |         } catch (Symfony\Component\Yaml\Exception\ParseException $e) { | ||
|  | |||
| 74 | // Do nothing on error. Just log error | ||
| 75 |             $this->logger->err('YAML returns a parse error', array('exception' => $e)); | ||
| 76 | |||
| 77 | return; | ||
| 78 | } | ||
| 79 | |||
| 80 |         $controller = $request->attributes->get('_controller'); | ||
| 81 |         $action = $request->attributes->get('_action'); | ||
| 82 | |||
| 83 |         if (array_key_exists($controller, $config)) { | ||
| 84 | $config = $config[$controller]; | ||
| 85 | |||
| 86 |             if (array_key_exists($action, $config)) { | ||
| 87 | $config = $config[$action]; | ||
| 88 | $title = $this->getConfiguration($config, 'title'); | ||
| 89 | $metas = $this->getConfiguration($config, 'metas'); | ||
| 90 | |||
| 91 |                 if (!empty($title)) { | ||
| 92 | $this->sonata->setTitle($title); | ||
| 93 | } | ||
| 94 | |||
| 95 |                 foreach ($metas as $key => $values) { | ||
| 96 |                     foreach ($values as $head => $value) { | ||
| 97 | $this->sonata->addMeta($key, $head, $value); | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | } | ||
| 103 | |||
| 145 | 
Scrutinizer analyzes your
composer.json/composer.lockfile if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.