Completed
Push — master ( 4a2544...5f6b73 )
by Karel
32:47 queued 26:56
created

Configuration::getAllNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
crap 1
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 28
    public function __construct($debug)
26
    {
27 28
        $this->debug = $debug;
28 28
    }
29
30
    /**
31
     * Generates the configuration tree.
32
     *
33
     * @return TreeBuilder
34
     */
35 28
    public function getConfigTreeBuilder()
36
    {
37 28
        $treeBuilder = new TreeBuilder();
38 28
        $rootNode = $treeBuilder->root('fos_elastica', 'array');
39
40 28
        $this->addClientsSection($rootNode);
41 28
        $this->addIndexesSection($rootNode);
42
43
        $rootNode
44 28
            ->children()
45 28
                ->scalarNode('default_client')
46 28
                    ->info('Defaults to the first client defined')
47 28
                ->end()
48 28
                ->scalarNode('default_index')
49 28
                    ->info('Defaults to the first index defined')
50 28
                ->end()
51 28
                ->scalarNode('default_manager')->defaultValue('orm')->end()
52 28
                ->arrayNode('serializer')
53 28
                    ->treatNullLike(array())
54 28
                    ->children()
55 28
                        ->scalarNode('callback_class')->defaultValue('FOS\ElasticaBundle\Serializer\Callback')->end()
56 28
                        ->scalarNode('serializer')->defaultValue('serializer')->end()
57 28
                    ->end()
58 28
                ->end()
59 28
            ->end()
60
        ;
61
62 28
        return $treeBuilder;
63
    }
64
65
    /**
66
     * Adds the configuration for the "clients" key.
67
     */
68 28
    private function addClientsSection(ArrayNodeDefinition $rootNode)
69
    {
70
        $rootNode
71 28
            ->fixXmlConfig('client')
72 28
            ->children()
73 28
                ->arrayNode('clients')
74 28
                    ->useAttributeAsKey('id')
75 28
                    ->prototype('array')
76 28
                        ->performNoDeepMerging()
77
                        // Elastica names its properties with camel case, support both
78 28
                        ->beforeNormalization()
79
                        ->ifTrue(function ($v) { return isset($v['connection_strategy']); })
80
                        ->then(function ($v) {
81 4
                            $v['connectionStrategy'] = $v['connection_strategy'];
82 4
                            unset($v['connection_strategy']);
83
84 4
                            return $v;
85 28
                        })
86 28
                        ->end()
87
                        // If there is no connections array key defined, assume a single connection.
88 28
                        ->beforeNormalization()
89
                        ->ifTrue(function ($v) { return is_array($v) && !array_key_exists('connections', $v); })
90
                        ->then(function ($v) {
91
                            return array(
92 27
                                'connections' => array($v),
93
                            );
94 28
                        })
95 28
                        ->end()
96 28
                        ->children()
97 28
                            ->arrayNode('connections')
98 28
                                ->requiresAtLeastOneElement()
99 28
                                ->prototype('array')
100 28
                                    ->fixXmlConfig('header')
101 28
                                    ->children()
102 28
                                        ->scalarNode('url')
103 28
                                            ->validate()
104
                                                ->ifTrue(function ($url) { return $url && substr($url, -1) !== '/'; })
105
                                                ->then(function ($url) { return $url.'/'; })
106 28
                                            ->end()
107 28
                                        ->end()
108 28
                                        ->scalarNode('host')->end()
109 28
                                        ->scalarNode('port')->end()
110 28
                                        ->scalarNode('proxy')->end()
111 28
                                        ->scalarNode('aws_access_key_id')->end()
112 28
                                        ->scalarNode('aws_secret_access_key')->end()
113 28
                                        ->scalarNode('aws_region')->end()
114 28
                                        ->scalarNode('aws_session_token')->end()
115 28
                                        ->scalarNode('logger')
116 28
                                            ->defaultValue($this->debug ? 'fos_elastica.logger' : false)
117 28
                                            ->treatNullLike('fos_elastica.logger')
118 28
                                            ->treatTrueLike('fos_elastica.logger')
119 28
                                        ->end()
120 28
                                        ->booleanNode('compression')->defaultValue(false)->end()
121 28
                                        ->arrayNode('headers')
122 28
                                            ->useAttributeAsKey('name')
123 28
                                            ->prototype('scalar')->end()
124 28
                                        ->end()
125 28
                                        ->arrayNode('curl')
126 28
                                            ->useAttributeAsKey(CURLOPT_SSL_VERIFYPEER)
127 28
                                            ->prototype('boolean')->end()
128 28
                                        ->end()
129 28
                                        ->scalarNode('transport')->end()
130 28
                                        ->scalarNode('timeout')->end()
131 28
                                        ->scalarNode('connectTimeout')->end()
132 28
                                        ->scalarNode('retryOnConflict')
133 28
                                            ->defaultValue(0)
134 28
                                        ->end()
135 28
                                    ->end()
136 28
                                ->end()
137 28
                            ->end()
138 28
                            ->scalarNode('timeout')->end()
139 28
                            ->scalarNode('connectTimeout')->end()
140 28
                            ->scalarNode('headers')->end()
141 28
                            ->scalarNode('connectionStrategy')->defaultValue('Simple')->end()
142 28
                        ->end()
143 28
                    ->end()
144 28
                ->end()
145 28
            ->end()
146
        ;
147 28
    }
148
149
    /**
150
     * Adds the configuration for the "indexes" key.
151
     */
152 28
    private function addIndexesSection(ArrayNodeDefinition $rootNode)
153
    {
154
        $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 28
            ->fixXmlConfig('index')
156 28
            ->children()
157 28
                ->arrayNode('indexes')
158 28
                    ->useAttributeAsKey('name')
159 28
                    ->prototype('array')
160 28
                        ->children()
161 28
                            ->scalarNode('index_name')
162 28
                                ->info('Defaults to the name of the index, but can be modified if the index name is different in ElasticSearch')
163 28
                            ->end()
164 28
                            ->booleanNode('use_alias')->defaultValue(false)->end()
165 28
                            ->scalarNode('client')->end()
166 28
                            ->scalarNode('finder')
167 28
                                ->treatNullLike(true)
168 28
                                ->defaultFalse()
169 28
                            ->end()
170 28
                            ->arrayNode('type_prototype')
171 28
                                ->children()
172 28
                                    ->scalarNode('analyzer')->end()
173 28
                                    ->append($this->getPersistenceNode())
174 28
                                    ->append($this->getSerializerNode())
175 28
                                ->end()
176 28
                            ->end()
177 28
                            ->variableNode('settings')->defaultValue(array())->end()
178 28
                        ->end()
179 28
                        ->append($this->getTypesNode())
180 28
                    ->end()
181 28
                ->end()
182 28
            ->end()
183
        ;
184 28
    }
185
186
    /**
187
     * Returns the array node used for "types".
188
     */
189 28
    protected function getTypesNode()
190
    {
191 28
        $builder = new TreeBuilder();
192 28
        $node = $builder->root('types');
193
194
        $node
195 28
            ->useAttributeAsKey('name')
196 28
            ->prototype('array')
197 28
                ->treatNullLike(array())
198 28
                ->beforeNormalization()
199 28
                ->ifNull()
200 28
                    ->thenEmptyArray()
201 28
                ->end()
202
                // Support multiple dynamic_template formats to match the old bundle style
203
                // and the way ElasticSearch expects them
204 28
                ->beforeNormalization()
205
                ->ifTrue(function ($v) { return isset($v['dynamic_templates']); })
206
                ->then(function ($v) {
207 4
                    $dt = array();
208 4
                    foreach ($v['dynamic_templates'] as $key => $type) {
209 4
                        if (is_int($key)) {
210
                            $dt[] = $type;
211
                        } else {
212 4
                            $dt[][$key] = $type;
213
                        }
214
                    }
215
216 4
                    $v['dynamic_templates'] = $dt;
217
218 4
                    return $v;
219 28
                })
220 28
                ->end()
221 28
                ->children()
222 28
                    ->booleanNode('date_detection')->end()
223 28
                    ->arrayNode('dynamic_date_formats')->prototype('scalar')->end()->end()
224 28
                    ->scalarNode('analyzer')->end()
225 28
                    ->booleanNode('numeric_detection')->end()
226 28
                    ->scalarNode('dynamic')->end()
227 28
                    ->variableNode('indexable_callback')->end()
228 28
                    ->append($this->getPersistenceNode())
229 28
                    ->append($this->getSerializerNode())
230 28
                ->end()
231 28
                ->append($this->getIdNode())
232 28
                ->append($this->getPropertiesNode())
233 28
                ->append($this->getDynamicTemplateNode())
234 28
                ->append($this->getSourceNode())
235 28
                ->append($this->getBoostNode())
236 28
                ->append($this->getRoutingNode())
237 28
                ->append($this->getParentNode())
238 28
                ->append($this->getAllNode())
239 28
            ->end()
240
        ;
241
242 28
        return $node;
243
    }
244
245
    /**
246
     * Returns the array node used for "properties".
247
     */
248 28
    protected function getPropertiesNode()
249
    {
250 28
        $builder = new TreeBuilder();
251 28
        $node = $builder->root('properties');
252
253
        $node
254 28
            ->useAttributeAsKey('name')
255 28
            ->prototype('variable')
256 28
                ->treatNullLike(array());
257
258 28
        return $node;
259
    }
260
261
    /**
262
     * Returns the array node used for "dynamic_templates".
263
     */
264 28
    public function getDynamicTemplateNode()
265
    {
266 28
        $builder = new TreeBuilder();
267 28
        $node = $builder->root('dynamic_templates');
268
269
        $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 28
            ->prototype('array')
271 28
                ->prototype('array')
272 28
                    ->children()
273 28
                        ->scalarNode('match')->end()
274 28
                        ->scalarNode('unmatch')->end()
275 28
                        ->scalarNode('match_mapping_type')->end()
276 28
                        ->scalarNode('path_match')->end()
277 28
                        ->scalarNode('path_unmatch')->end()
278 28
                        ->scalarNode('match_pattern')->end()
279 28
                        ->arrayNode('mapping')
280 28
                            ->prototype('variable')
281 28
                                ->treatNullLike(array())
282 28
                            ->end()
283 28
                        ->end()
284 28
                    ->end()
285 28
                ->end()
286 28
            ->end()
287
        ;
288
289 28
        return $node;
290
    }
291
292
    /**
293
     * Returns the array node used for "_id".
294
     */
295 28 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 28
        $builder = new TreeBuilder();
298 28
        $node = $builder->root('_id');
299
300
        $node
301 28
            ->children()
302 28
            ->scalarNode('path')->end()
303 28
            ->end()
304
        ;
305
306 28
        return $node;
307
    }
308
309
    /**
310
     * Returns the array node used for "_source".
311
     */
312 28
    protected function getSourceNode()
313
    {
314 28
        $builder = new TreeBuilder();
315 28
        $node = $builder->root('_source');
316
317
        $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 28
            ->children()
319 28
                ->arrayNode('excludes')
320 28
                    ->useAttributeAsKey('name')
321 28
                    ->prototype('scalar')->end()
322 28
                ->end()
323 28
                ->arrayNode('includes')
324 28
                    ->useAttributeAsKey('name')
325 28
                    ->prototype('scalar')->end()
326 28
                ->end()
327 28
                ->scalarNode('compress')->end()
328 28
                ->scalarNode('compress_threshold')->end()
329 28
                ->scalarNode('enabled')->defaultTrue()->end()
330 28
            ->end()
331
        ;
332
333 28
        return $node;
334
    }
335
336
    /**
337
     * Returns the array node used for "_boost".
338
     */
339 28
    protected function getBoostNode()
340
    {
341 28
        $builder = new TreeBuilder();
342 28
        $node = $builder->root('_boost');
343
344
        $node
345 28
            ->children()
346 28
                ->scalarNode('name')->end()
347 28
                ->scalarNode('null_value')->end()
348 28
            ->end()
349
        ;
350
351 28
        return $node;
352
    }
353
354
    /**
355
     * Returns the array node used for "_routing".
356
     */
357 28 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
    {
359 28
        $builder = new TreeBuilder();
360 28
        $node = $builder->root('_routing');
361
362
        $node
363 28
            ->children()
364 28
                ->scalarNode('required')->end()
365 28
                ->scalarNode('path')->end()
366 28
            ->end()
367
        ;
368
369 28
        return $node;
370
    }
371
372
    /**
373
     * Returns the array node used for "_parent".
374
     */
375 28
    protected function getParentNode()
376
    {
377 28
        $builder = new TreeBuilder();
378 28
        $node = $builder->root('_parent');
379
380
        $node
381 28
            ->children()
382 28
                ->scalarNode('type')->end()
383 28
                ->scalarNode('property')->defaultValue(null)->end()
384 28
                ->scalarNode('identifier')->defaultValue('id')->end()
385 28
            ->end()
386
        ;
387
388 28
        return $node;
389
    }
390
391
    /**
392
     * Returns the array node used for "_all".
393
     */
394 28
    protected function getAllNode()
395
    {
396 28
        $builder = new TreeBuilder();
397 28
        $node = $builder->root('_all');
398
399
        $node
400 28
            ->children()
401 28
            ->scalarNode('enabled')->defaultValue(true)->end()
402 28
            ->scalarNode('analyzer')->end()
403 28
            ->end()
404
        ;
405
406 28
        return $node;
407
    }
408
409
    /**
410
     * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
411
     */
412 28
    protected function getPersistenceNode()
413
    {
414 28
        $builder = new TreeBuilder();
415 28
        $node = $builder->root('persistence');
416
417
        $node
418 28
            ->beforeNormalization()
419
                ->ifTrue(function($v) { return isset($v['immediate']); })
420
                    ->then(function($v) {
421
                        @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
423
                        return $v;
424 28
                    })
425 28
            ->end()
426 28
            ->validate()
427 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 28
                    ->thenInvalid('Propel doesn\'t support listeners')
429 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 28
                    ->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 28
                    ->thenInvalid('Hints are only supported by the "orm" driver')
433 28
            ->end()
434 28
            ->children()
435 28
                ->scalarNode('driver')
436 28
                    ->defaultValue('orm')
437 28
                    ->validate()
438 28
                    ->ifNotInArray($this->supportedDrivers)
439 28
                        ->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($this->supportedDrivers))
440 28
                    ->end()
441 28
                ->end()
442 28
                ->scalarNode('model')->defaultValue(null)->end()
443 28
                ->scalarNode('repository')->end()
444 28
                ->scalarNode('identifier')->defaultValue('id')->end()
445 28
                ->arrayNode('provider')
446 28
                    ->addDefaultsIfNotSet()
447 28
                    ->children()
448 28
                        ->scalarNode('batch_size')->defaultValue(100)->end()
449 28
                        ->scalarNode('clear_object_manager')->defaultTrue()->end()
450 28
                        ->scalarNode('debug_logging')
451 28
                            ->defaultValue($this->debug)
452 28
                            ->treatNullLike(true)
453 28
                        ->end()
454 28
                        ->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()
455 28
                        ->scalarNode('service')->end()
456 28
                    ->end()
457 28
                ->end()
458 28
                ->arrayNode('listener')
459 28
                    ->addDefaultsIfNotSet()
460 28
                    ->children()
461 28
                        ->scalarNode('insert')->defaultTrue()->end()
462 28
                        ->scalarNode('update')->defaultTrue()->end()
463 28
                        ->scalarNode('delete')->defaultTrue()->end()
464 28
                        ->scalarNode('flush')->defaultTrue()->end()
465 28
                        ->booleanNode('immediate')->defaultFalse()->end()
466 28
                        ->scalarNode('logger')
467 28
                            ->defaultFalse()
468 28
                            ->treatNullLike('fos_elastica.logger')
469 28
                            ->treatTrueLike('fos_elastica.logger')
470 28
                        ->end()
471 28
                        ->scalarNode('service')->end()
472 28
                    ->end()
473 28
                ->end()
474 28
                ->arrayNode('finder')
475 28
                    ->addDefaultsIfNotSet()
476 28
                    ->children()
477 28
                        ->scalarNode('service')->end()
478 28
                    ->end()
479 28
                ->end()
480 28
                ->arrayNode('elastica_to_model_transformer')
481 28
                    ->addDefaultsIfNotSet()
482 28
                    ->children()
483 28
                        ->arrayNode('hints')
484 28
                            ->prototype('array')
485 28
                                ->children()
486 28
                                    ->scalarNode('name')->end()
487 28
                                    ->scalarNode('value')->end()
488 28
                                ->end()
489 28
                            ->end()
490 28
                        ->end()
491 28
                        ->booleanNode('hydrate')->defaultTrue()->end()
492 28
                        ->booleanNode('ignore_missing')
493 28
                            ->defaultFalse()
494 28
                            ->info('Silently ignore results returned from Elasticsearch without corresponding persistent object.')
495 28
                        ->end()
496 28
                        ->scalarNode('query_builder_method')->defaultValue('createQueryBuilder')->end()
497 28
                        ->scalarNode('service')->end()
498 28
                    ->end()
499 28
                ->end()
500 28
                ->arrayNode('model_to_elastica_transformer')
501 28
                    ->addDefaultsIfNotSet()
502 28
                    ->children()
503 28
                        ->scalarNode('service')->end()
504 28
                    ->end()
505 28
                ->end()
506 28
                ->arrayNode('persister')
507 28
                    ->addDefaultsIfNotSet()
508 28
                    ->children()
509 28
                        ->scalarNode('service')->end()
510 28
                    ->end()
511 28
                ->end()
512 28
            ->end();
513
514 28
        return $node;
515
    }
516
517
    /**
518
     * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
519
     */
520 28
    protected function getSerializerNode()
521
    {
522 28
        $builder = new TreeBuilder();
523 28
        $node = $builder->root('serializer');
524
525
        $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 28
            ->addDefaultsIfNotSet()
527 28
            ->children()
528 28
                ->arrayNode('groups')
529 28
                    ->treatNullLike(array())
530 28
                    ->prototype('scalar')->end()
531 28
                ->end()
532 28
                ->scalarNode('version')->end()
533 28
                ->booleanNode('serialize_null')
534 28
                    ->defaultFalse()
535 28
                ->end()
536 28
            ->end();
537
538 28
        return $node;
539
    }
540
}
541