Completed
Push — master ( e2f224...4a2544 )
by Karel
28:57 queued 19:03
created

Configuration::getTypesNode()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 55
Code Lines 43

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 34
CRAP Score 3.0015

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 55
ccs 34
cts 36
cp 0.9444
rs 9.7692
cc 3
eloc 43
nc 1
nop 0
crap 3.0015

How to fix   Long Method   

Long Method

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:

1
<?php
2
3
namespace FOS\ElasticaBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
class Configuration implements ConfigurationInterface
10
{
11
    /**
12
     * Stores supported database drivers.
13
     *
14
     * @var array
15
     */
16
    private $supportedDrivers = array('orm', 'mongodb', 'propel', 'phpcr');
17
18
    /**
19
     * If the kernel is running in debug mode.
20
     *
21
     * @var bool
22
     */
23
    private $debug;
24
25 27
    public function __construct($debug)
26
    {
27 27
        $this->debug = $debug;
28 27
    }
29
30
    /**
31
     * Generates the configuration tree.
32
     *
33
     * @return TreeBuilder
34
     */
35 27
    public function getConfigTreeBuilder()
36
    {
37 27
        $treeBuilder = new TreeBuilder();
38 27
        $rootNode = $treeBuilder->root('fos_elastica', 'array');
39
40 27
        $this->addClientsSection($rootNode);
41 27
        $this->addIndexesSection($rootNode);
42
43
        $rootNode
44 27
            ->children()
45 27
                ->scalarNode('default_client')
46 27
                    ->info('Defaults to the first client defined')
47 27
                ->end()
48 27
                ->scalarNode('default_index')
49 27
                    ->info('Defaults to the first index defined')
50 27
                ->end()
51 27
                ->scalarNode('default_manager')->defaultValue('orm')->end()
52 27
                ->arrayNode('serializer')
53 27
                    ->treatNullLike(array())
54 27
                    ->children()
55 27
                        ->scalarNode('callback_class')->defaultValue('FOS\ElasticaBundle\Serializer\Callback')->end()
56 27
                        ->scalarNode('serializer')->defaultValue('serializer')->end()
57 27
                    ->end()
58 27
                ->end()
59 27
            ->end()
60
        ;
61
62 27
        return $treeBuilder;
63
    }
64
65
    /**
66
     * Adds the configuration for the "clients" key.
67
     */
68 27
    private function addClientsSection(ArrayNodeDefinition $rootNode)
69
    {
70
        $rootNode
71 27
            ->fixXmlConfig('client')
72 27
            ->children()
73 27
                ->arrayNode('clients')
74 27
                    ->useAttributeAsKey('id')
75 27
                    ->prototype('array')
76 27
                        ->performNoDeepMerging()
77
                        // Elastica names its properties with camel case, support both
78 27
                        ->beforeNormalization()
79
                        ->ifTrue(function ($v) { return isset($v['connection_strategy']); })
80
                        ->then(function ($v) {
81
                            $v['connectionStrategy'] = $v['connection_strategy'];
82
                            unset($v['connection_strategy']);
83
84
                            return $v;
85 27
                        })
86 27
                        ->end()
87
                        // If there is no connections array key defined, assume a single connection.
88 27
                        ->beforeNormalization()
89
                        ->ifTrue(function ($v) { return is_array($v) && !array_key_exists('connections', $v); })
90
                        ->then(function ($v) {
91 4
                            return array(
92 4
                                'connections' => array($v),
93
                            );
94 4
                        })
95 27
                        ->end()
96 27
                        ->children()
97
                            ->arrayNode('connections')
98 27
                                ->requiresAtLeastOneElement()
99
                                ->prototype('array')
100
                                    ->fixXmlConfig('header')
101
                                    ->children()
102 26
                                        ->scalarNode('url')
103 26
                                            ->validate()
104 27
                                                ->ifTrue(function ($url) { return $url && substr($url, -1) !== '/'; })
105 27
                                                ->then(function ($url) { return $url.'/'; })
106 27
                                            ->end()
107 27
                                        ->end()
108 27
                                        ->scalarNode('host')->end()
109 27
                                        ->scalarNode('port')->end()
110 27
                                        ->scalarNode('proxy')->end()
111 27
                                        ->scalarNode('aws_access_key_id')->end()
112 27
                                        ->scalarNode('aws_secret_access_key')->end()
113 27
                                        ->scalarNode('aws_region')->end()
114
                                        ->scalarNode('aws_session_token')->end()
115
                                        ->scalarNode('logger')
116 27
                                            ->defaultValue($this->debug ? 'fos_elastica.logger' : false)
117 27
                                            ->treatNullLike('fos_elastica.logger')
118 27
                                            ->treatTrueLike('fos_elastica.logger')
119 27
                                        ->end()
120 27
                                        ->booleanNode('compression')->defaultValue(false)->end()
121 27
                                        ->arrayNode('headers')
122 27
                                            ->useAttributeAsKey('name')
123 27
                                            ->prototype('scalar')->end()
124 27
                                        ->end()
125 27
                                        ->arrayNode('curl')
126 27
                                            ->useAttributeAsKey(CURLOPT_SSL_VERIFYPEER)
127 27
                                            ->prototype('boolean')->end()
128 27
                                        ->end()
129 27
                                        ->scalarNode('transport')->end()
130 27
                                        ->scalarNode('timeout')->end()
131 27
                                        ->scalarNode('connectTimeout')->end()
132 27
                                        ->scalarNode('retryOnConflict')
133 27
                                            ->defaultValue(0)
134 27
                                        ->end()
135 27
                                    ->end()
136 27
                                ->end()
137 27
                            ->end()
138 27
                            ->scalarNode('timeout')->end()
139 27
                            ->scalarNode('connectTimeout')->end()
140 27
                            ->scalarNode('headers')->end()
141 27
                            ->scalarNode('connectionStrategy')->defaultValue('Simple')->end()
142 27
                        ->end()
143 27
                    ->end()
144 27
                ->end()
145 27
            ->end()
146 27
        ;
147 27
    }
148 27
149 27
    /**
150 27
     * Adds the configuration for the "indexes" key.
151 27
     */
152 27
    private function addIndexesSection(ArrayNodeDefinition $rootNode)
153 27
    {
154 27
        $rootNode
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Symfony\Component\Config...\Builder\NodeDefinition as the method children() does only exist in the following sub-classes of Symfony\Component\Config...\Builder\NodeDefinition: Symfony\Component\Config...der\ArrayNodeDefinition. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
155 27
            ->fixXmlConfig('index')
156
            ->children()
157 27
                ->arrayNode('indexes')
158
                    ->useAttributeAsKey('name')
159
                    ->prototype('array')
160
                        ->children()
161
                            ->scalarNode('index_name')
162 27
                                ->info('Defaults to the name of the index, but can be modified if the index name is different in ElasticSearch')
163
                            ->end()
164
                            ->booleanNode('use_alias')->defaultValue(false)->end()
165 27
                            ->scalarNode('client')->end()
166 27
                            ->scalarNode('finder')
167 27
                                ->treatNullLike(true)
168 27
                                ->defaultFalse()
169 27
                            ->end()
170 27
                            ->arrayNode('type_prototype')
171 27
                                ->children()
172 27
                                    ->scalarNode('analyzer')->end()
173 27
                                    ->append($this->getPersistenceNode())
174 27
                                    ->append($this->getSerializerNode())
175 27
                                ->end()
176 27
                            ->end()
177 27
                            ->variableNode('settings')->defaultValue(array())->end()
178 27
                        ->end()
179 27
                        ->append($this->getTypesNode())
180 27
                    ->end()
181 27
                ->end()
182 27
            ->end()
183 27
        ;
184 27
    }
185 27
186 27
    /**
187 27
     * Returns the array node used for "types".
188 27
     */
189 27
    protected function getTypesNode()
190 27
    {
191 27
        $builder = new TreeBuilder();
192 27
        $node = $builder->root('types');
193
194 27
        $node
195
            ->useAttributeAsKey('name')
196
            ->prototype('array')
197
                ->treatNullLike(array())
198
                ->beforeNormalization()
199 27
                ->ifNull()
200
                    ->thenEmptyArray()
201 27
                ->end()
202 27
                // Support multiple dynamic_template formats to match the old bundle style
203
                // and the way ElasticSearch expects them
204
                ->beforeNormalization()
205 27
                ->ifTrue(function ($v) { return isset($v['dynamic_templates']); })
206 27
                ->then(function ($v) {
207 27
                    $dt = array();
208 27
                    foreach ($v['dynamic_templates'] as $key => $type) {
209 27
                        if (is_int($key)) {
210 27
                            $dt[] = $type;
211 27
                        } else {
212
                            $dt[][$key] = $type;
213 27
                        }
214
                    }
215
216 13
                    $v['dynamic_templates'] = $dt;
217 13
218
                    return $v;
219 13
                })
220 27
                ->end()
221 27
                ->children()
222
                    ->booleanNode('date_detection')->end()
223 27
                    ->arrayNode('dynamic_date_formats')->prototype('scalar')->end()->end()
224
                    ->scalarNode('analyzer')->end()
225 18
                    ->booleanNode('numeric_detection')->end()
226 18
                    ->scalarNode('dynamic')->end()
227 18
                    ->variableNode('indexable_callback')->end()
228 27
                    ->append($this->getPersistenceNode())
229
                    ->append($this->getSerializerNode())
230 5
                ->end()
231
                ->append($this->getIdNode())
232 5
                ->append($this->getPropertiesNode())
233 5
                ->append($this->getDynamicTemplateNode())
234
                ->append($this->getSourceNode())
235 5
                ->append($this->getBoostNode())
236
                ->append($this->getRoutingNode())
237
                ->append($this->getParentNode())
238 5
                ->append($this->getAllNode())
239
            ->end()
240 5
        ;
241 5
242
        return $node;
243 5
    }
244 27
245 27
    /**
246
     * Returns the array node used for "properties".
247
     */
248 27
    protected function getPropertiesNode()
249
    {
250
        $builder = new TreeBuilder();
251 4
        $node = $builder->root('properties');
252 4
253 4
        $node
254 4
            ->useAttributeAsKey('name')
255 4
            ->prototype('variable')
256 4
                ->treatNullLike(array());
257
258 4
        return $node;
259
    }
260 4
261
    /**
262 4
     * Returns the array node used for "dynamic_templates".
263 27
     */
264 27
    public function getDynamicTemplateNode()
265 27
    {
266 27
        $builder = new TreeBuilder();
267 27
        $node = $builder->root('dynamic_templates');
268 27
269 27
        $node
0 ignored issues
show
Bug introduced by
It seems like you code against a specific sub-type and not the parent class Symfony\Component\Config...\Builder\NodeDefinition as the method prototype() does only exist in the following sub-classes of Symfony\Component\Config...\Builder\NodeDefinition: Symfony\Component\Config...der\ArrayNodeDefinition. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
270 27
            ->prototype('array')
271 27
                ->prototype('array')
272 27
                    ->children()
273 27
                        ->scalarNode('match')->end()
274 27
                        ->scalarNode('unmatch')->end()
275 27
                        ->scalarNode('match_mapping_type')->end()
276 27
                        ->scalarNode('path_match')->end()
277 27
                        ->scalarNode('path_unmatch')->end()
278 27
                        ->scalarNode('match_pattern')->end()
279 27
                        ->arrayNode('mapping')
280 27
                            ->prototype('variable')
281 27
                                ->treatNullLike(array())
282 27
                            ->end()
283 27
                        ->end()
284
                    ->end()
285
                ->end()
286 27
            ->end()
287
        ;
288
289
        return $node;
290
    }
291
292 27
    /**
293
     * Returns the array node used for "_id".
294 27
     */
295 27 View Code Duplication
    protected function getIdNode()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
296
    {
297
        $builder = new TreeBuilder();
298 27
        $node = $builder->root('_id');
299 27
300 27
        $node
301
            ->children()
302 27
            ->scalarNode('path')->end()
303
            ->end()
304
        ;
305
306
        return $node;
307
    }
308 27
309
    /**
310 27
     * Returns the array node used for "_source".
311 27
     */
312
    protected function getSourceNode()
313
    {
314 27
        $builder = new TreeBuilder();
315 27
        $node = $builder->root('_source');
316 27
317 27
        $node
0 ignored issues
show
Bug introduced by
The method arrayNode() does not seem to exist on object<Symfony\Component...odeDefinitionInterface>.

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.

Loading history...
318 27
            ->children()
319 27
                ->arrayNode('excludes')
320 27
                    ->useAttributeAsKey('name')
321 27
                    ->prototype('scalar')->end()
322 27
                ->end()
323 27
                ->arrayNode('includes')
324 27
                    ->useAttributeAsKey('name')
325 27
                    ->prototype('scalar')->end()
326 27
                ->end()
327 27
                ->scalarNode('compress')->end()
328 27
                ->scalarNode('compress_threshold')->end()
329 27
                ->scalarNode('enabled')->defaultTrue()->end()
330 27
            ->end()
331
        ;
332
333 27
        return $node;
334
    }
335
336
    /**
337
     * Returns the array node used for "_boost".
338
     */
339 27
    protected function getBoostNode()
340
    {
341 27
        $builder = new TreeBuilder();
342 27
        $node = $builder->root('_boost');
343
344
        $node
345 27
            ->children()
346 27
                ->scalarNode('name')->end()
347 27
                ->scalarNode('null_value')->end()
348
            ->end()
349
        ;
350 27
351
        return $node;
352
    }
353
354
    /**
355
     * Returns the array node used for "_routing".
356 27
     */
357 View Code Duplication
    protected function getRoutingNode()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
358 27
    {
359 27
        $builder = new TreeBuilder();
360
        $node = $builder->root('_routing');
361
362 27
        $node
363 27
            ->children()
364 27
                ->scalarNode('required')->end()
365 27
                ->scalarNode('path')->end()
366 27
            ->end()
367 27
        ;
368 27
369 27
        return $node;
370 27
    }
371 27
372 27
    /**
373 27
     * Returns the array node used for "_parent".
374 27
     */
375
    protected function getParentNode()
376
    {
377 27
        $builder = new TreeBuilder();
378
        $node = $builder->root('_parent');
379
380
        $node
381
            ->children()
382
                ->scalarNode('type')->end()
383 27
                ->scalarNode('property')->defaultValue(null)->end()
384
                ->scalarNode('identifier')->defaultValue('id')->end()
385 27
            ->end()
386 27
        ;
387
388
        return $node;
389 27
    }
390 27
391 27
    /**
392 27
     * Returns the array node used for "_all".
393
     */
394
    protected function getAllNode()
395 27
    {
396
        $builder = new TreeBuilder();
397
        $node = $builder->root('_all');
398
399
        $node
400
            ->children()
401 27
            ->scalarNode('enabled')->defaultValue(true)->end()
402
            ->scalarNode('analyzer')->end()
403 27
            ->end()
404 27
        ;
405
406
        return $node;
407 27
    }
408 27
409 27
    /**
410 27
     * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
411
     */
412
    protected function getPersistenceNode()
413 27
    {
414
        $builder = new TreeBuilder();
415
        $node = $builder->root('persistence');
416
417
        $node
418
            ->beforeNormalization()
419 27
                ->ifTrue(function($v) { return isset($v['immediate']); })
420
                    ->then(function($v) {
421 27
                        @trigger_error('The immediate configuration key is deprecated since version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
422 27
423
                        return $v;
424
                    })
425 27
            ->end()
426 27
            ->validate()
427 27 View Code Duplication
                ->ifTrue(function ($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['listener']); })
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
428 27
                    ->thenInvalid('Propel doesn\'t support listeners')
429 27 View Code Duplication
                ->ifTrue(function ($v) { return isset($v['driver']) && 'propel' === $v['driver'] && isset($v['repository']); })
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
430
                    ->thenInvalid('Propel doesn\'t support the "repository" parameter')
431
                ->ifTrue(function($v) { return isset($v['driver']) && 'orm' !== $v['driver'] && !empty($v['elastica_to_model_transformer']['hints']); })
432 27
                    ->thenInvalid('Hints are only supported by the "orm" driver')
433
            ->end()
434
            ->children()
435
                ->scalarNode('driver')
436
                    ->defaultValue('orm')
437
                    ->validate()
438 27
                    ->ifNotInArray($this->supportedDrivers)
439
                        ->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($this->supportedDrivers))
440 27
                    ->end()
441 27
                ->end()
442
                ->scalarNode('model')->defaultValue(null)->end()
443
                ->scalarNode('repository')->end()
444 27
                ->scalarNode('identifier')->defaultValue('id')->end()
445 27
                ->arrayNode('provider')
446 27
                    ->addDefaultsIfNotSet()
447 27
                    ->children()
448
                        ->scalarNode('batch_size')->defaultValue(100)->end()
449
                        ->scalarNode('clear_object_manager')->defaultTrue()->end()
450 27
                        ->scalarNode('debug_logging')
451
                            ->defaultValue($this->debug)
452
                            ->treatNullLike(true)
453
                        ->end()
454
                        ->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()
455
                        ->scalarNode('service')->end()
456 27
                    ->end()
457
                ->end()
458 27
                ->arrayNode('listener')
459 27
                    ->addDefaultsIfNotSet()
460
                    ->children()
461
                        ->scalarNode('insert')->defaultTrue()->end()
462 27
                        ->scalarNode('update')->defaultTrue()->end()
463
                        ->scalarNode('delete')->defaultTrue()->end()
464
                        ->scalarNode('flush')->defaultTrue()->end()
465
                        ->booleanNode('immediate')->defaultFalse()->end()
466
                        ->scalarNode('logger')
467
                            ->defaultFalse()
468 27
                            ->treatNullLike('fos_elastica.logger')
469 27
                            ->treatTrueLike('fos_elastica.logger')
470 27
                        ->end()
471
                        ->scalarNode('service')->end()
472 27
                    ->end()
473
                ->end()
474 27
                ->arrayNode('finder')
475
                    ->addDefaultsIfNotSet()
476 27
                    ->children()
477 27
                        ->scalarNode('service')->end()
478 27
                    ->end()
479 27
                ->end()
480 27
                ->arrayNode('elastica_to_model_transformer')
481 27
                    ->addDefaultsIfNotSet()
482 27
                    ->children()
483 27
                        ->arrayNode('hints')
484 27
                            ->prototype('array')
485 27
                                ->children()
486 27
                                    ->scalarNode('name')->end()
487 27
                                    ->scalarNode('value')->end()
488 27
                                ->end()
489 27
                            ->end()
490 27
                        ->end()
491 27
                        ->booleanNode('hydrate')->defaultTrue()->end()
492 27
                        ->booleanNode('ignore_missing')
493 27
                            ->defaultFalse()
494 27
                            ->info('Silently ignore results returned from Elasticsearch without corresponding persistent object.')
495 27
                        ->end()
496 27
                        ->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()
497 27
                        ->scalarNode('service')->end()
498 27
                    ->end()
499 27
                ->end()
500 27
                ->arrayNode('model_to_elastica_transformer')
501 27
                    ->addDefaultsIfNotSet()
502 27
                    ->children()
503 27
                        ->scalarNode('service')->end()
504 27
                    ->end()
505 27
                ->end()
506 27
                ->arrayNode('persister')
507 27
                    ->addDefaultsIfNotSet()
508 27
                    ->children()
509 27
                        ->scalarNode('service')->end()
510 27
                    ->end()
511 27
                ->end()
512 27
            ->end();
513 27
514 27
        return $node;
515 27
    }
516 27
517 27
    /**
518 27
     * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
519 27
     */
520 27
    protected function getSerializerNode()
521 27
    {
522 27
        $builder = new TreeBuilder();
523 27
        $node = $builder->root('serializer');
524 27
525 27
        $node
0 ignored issues
show
Bug introduced by
The method scalarNode() does not seem to exist on object<Symfony\Component...odeDefinitionInterface>.

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.

Loading history...
526 27
            ->addDefaultsIfNotSet()
527 27
            ->children()
528 27
                ->arrayNode('groups')
529 27
                    ->treatNullLike(array())
530 27
                    ->prototype('scalar')->end()
531 27
                ->end()
532 27
                ->scalarNode('version')->end()
533 27
                ->booleanNode('serialize_null')
534 27
                    ->defaultFalse()
535 27
                ->end()
536 27
            ->end();
537 27
538 27
        return $node;
539 27
    }
540
}
541