| Conditions | 2 |
| Paths | 2 |
| Total Lines | 61 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 31 | public function getConfigTreeBuilder() |
||
| 32 | { |
||
| 33 | |||
| 34 | $treeBuilder = new TreeBuilder('ongr_elasticsearch'); |
||
| 35 | |||
| 36 | if (method_exists($treeBuilder, 'getRootNode')) { |
||
| 37 | $rootNode = $treeBuilder->getRootNode(); |
||
| 38 | } else { |
||
| 39 | // BC layer for symfony/config 4.1 and older |
||
| 40 | $rootNode = $treeBuilder->root('ongr_elasticsearch'); |
||
|
|
|||
| 41 | } |
||
| 42 | |||
| 43 | $rootNode |
||
| 44 | ->children() |
||
| 45 | |||
| 46 | ->booleanNode('cache') |
||
| 47 | ->info( |
||
| 48 | 'Enables the cache handler to store important data to the cache. '. |
||
| 49 | 'Default value is kernel.debug parameter.' |
||
| 50 | ) |
||
| 51 | ->end() |
||
| 52 | |||
| 53 | ->booleanNode('profiler') |
||
| 54 | ->info( |
||
| 55 | 'Enables Symfony profiler for the elasticsearch queries debug.'. |
||
| 56 | 'Default value is kernel.debug parameter. ' |
||
| 57 | ) |
||
| 58 | ->end() |
||
| 59 | |||
| 60 | ->booleanNode('logger') |
||
| 61 | ->defaultTrue() |
||
| 62 | ->info( |
||
| 63 | 'Enables executed queries logging. Log file names are the same as index.' |
||
| 64 | ) |
||
| 65 | ->end() |
||
| 66 | |||
| 67 | ->arrayNode('source_directories') |
||
| 68 | ->prototype('scalar')->end() |
||
| 69 | ->defaultValue(['/src']) |
||
| 70 | ->info( |
||
| 71 | 'If your project has different than `/src` source directory, or several of them,' . |
||
| 72 | 'you can specify them here to look automatically for ES documents.' |
||
| 73 | ) |
||
| 74 | ->end() |
||
| 75 | |||
| 76 | ->arrayNode('indexes') |
||
| 77 | ->defaultValue([]) |
||
| 78 | ->useAttributeAsKey('namespace') |
||
| 79 | ->info( |
||
| 80 | 'In case you want to override index settings defined in the annotation.' . |
||
| 81 | ' e.g. use env variables instead.' |
||
| 82 | ) |
||
| 83 | ->prototype('variable')->end() |
||
| 84 | ->end() |
||
| 85 | |||
| 86 | ->append($this->getAnalysisNode()) |
||
| 87 | |||
| 88 | ->end(); |
||
| 89 | |||
| 90 | return $treeBuilder; |
||
| 91 | } |
||
| 92 | |||
| 134 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.