Conditions | 2 |
Paths | 2 |
Total Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Tests | 28 |
CRAP Score | 2.0001 |
Changes | 0 |
1 | <?php |
||
13 | 11 | public function getConfigTreeBuilder() |
|
14 | { |
||
15 | 11 | $treeBuilder = new TreeBuilder('zenstruck_redirect'); |
|
16 | |||
17 | // Keep compatibility with symfony/config < 4.2 |
||
18 | 11 | if (\method_exists($treeBuilder, 'getRootNode')) { |
|
19 | 11 | $rootNode = $treeBuilder->getRootNode(); |
|
20 | } else { |
||
21 | $rootNode = $treeBuilder->root('zenstruck_redirect'); |
||
|
|||
22 | } |
||
23 | |||
24 | $rootNode |
||
25 | 11 | ->children() |
|
26 | 11 | ->scalarNode('redirect_class') |
|
27 | 11 | ->defaultNull() |
|
28 | 11 | ->validate() |
|
29 | ->ifTrue(function($value) { |
||
30 | 7 | return !\is_subclass_of($value, 'Zenstruck\RedirectBundle\Model\Redirect'); |
|
31 | 11 | }) |
|
32 | 11 | ->thenInvalid('"redirect_class" must be an instance of "Zenstruck\RedirectBundle\Model\Redirect"') |
|
33 | 11 | ->end() |
|
34 | 11 | ->end() |
|
35 | 11 | ->scalarNode('not_found_class') |
|
36 | 11 | ->defaultNull() |
|
37 | 11 | ->validate() |
|
38 | ->ifTrue(function($value) { |
||
39 | 6 | return !\is_subclass_of($value, 'Zenstruck\RedirectBundle\Model\NotFound'); |
|
40 | 11 | }) |
|
41 | 11 | ->thenInvalid('"not_found_class" must be an instance of "Zenstruck\RedirectBundle\Model\NotFound"') |
|
42 | 11 | ->end() |
|
43 | 11 | ->end() |
|
44 | 11 | ->booleanNode('remove_not_founds') |
|
45 | 11 | ->info('When enabled, when a redirect is updated or created, the NotFound entites with a matching path are removed.') |
|
46 | 11 | ->defaultTrue() |
|
47 | 11 | ->end() |
|
48 | 11 | ->scalarNode('model_manager_name')->defaultNull()->end() |
|
49 | 11 | ->end() |
|
50 | ; |
||
51 | |||
52 | 11 | return $treeBuilder; |
|
53 | } |
||
54 | } |
||
55 |
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.