1 | <?php |
||||
2 | |||||
3 | /* |
||||
4 | * This file is part of the FOSCKEditor Bundle. |
||||
5 | * |
||||
6 | * (c) 2018 - present Friends of Symfony |
||||
7 | * (c) 2009 - 2017 Eric GELOEN <[email protected]> |
||||
8 | * |
||||
9 | * For the full copyright and license information, please read the LICENSE |
||||
10 | * file that was distributed with this source code. |
||||
11 | */ |
||||
12 | |||||
13 | namespace FOS\CKEditorBundle\DependencyInjection; |
||||
14 | |||||
15 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||||
16 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||
17 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||
18 | |||||
19 | /** |
||||
20 | * @author GeLo <[email protected]> |
||||
21 | */ |
||||
22 | final class Configuration implements ConfigurationInterface |
||||
23 | { |
||||
24 | public function getConfigTreeBuilder(): TreeBuilder |
||||
25 | { |
||||
26 | $treeBuilder = $this->createTreeBuilder(); |
||||
27 | $treeBuilder |
||||
28 | ->root('fos_ck_editor') |
||||
29 | ->children() |
||||
30 | ->booleanNode('enable')->defaultTrue()->end() |
||||
31 | ->booleanNode('async')->defaultFalse()->end() |
||||
32 | ->booleanNode('auto_inline')->defaultTrue()->end() |
||||
33 | ->booleanNode('inline')->defaultFalse()->end() |
||||
34 | ->booleanNode('autoload')->defaultTrue()->end() |
||||
35 | ->booleanNode('jquery')->defaultFalse()->end() |
||||
36 | ->booleanNode('require_js')->defaultFalse()->end() |
||||
37 | ->booleanNode('input_sync')->defaultFalse()->end() |
||||
38 | ->scalarNode('base_path')->defaultValue('bundles/fosckeditor/')->end() |
||||
39 | ->scalarNode('js_path')->defaultValue('bundles/fosckeditor/ckeditor.js')->end() |
||||
40 | ->scalarNode('jquery_path')->defaultValue('bundles/fosckeditor/adapters/jquery.js')->end() |
||||
41 | ->scalarNode('default_config')->defaultValue(null)->end() |
||||
42 | ->append($this->createConfigsNode()) |
||||
43 | ->append($this->createPluginsNode()) |
||||
44 | ->append($this->createStylesNode()) |
||||
45 | ->append($this->createTemplatesNode()) |
||||
46 | ->append($this->createFilebrowsersNode()) |
||||
47 | ->append($this->createToolbarsNode()) |
||||
48 | ->end(); |
||||
49 | |||||
50 | return $treeBuilder; |
||||
51 | } |
||||
52 | |||||
53 | private function createConfigsNode(): ArrayNodeDefinition |
||||
54 | { |
||||
55 | return $this->createPrototypeNode('configs') |
||||
56 | ->prototype('array') |
||||
57 | ->normalizeKeys(false) |
||||
0 ignored issues
–
show
|
|||||
58 | ->useAttributeAsKey('name') |
||||
59 | ->prototype('variable')->end() |
||||
60 | ->end(); |
||||
61 | } |
||||
62 | |||||
63 | private function createPluginsNode(): ArrayNodeDefinition |
||||
64 | { |
||||
65 | return $this->createPrototypeNode('plugins') |
||||
66 | ->prototype('array') |
||||
67 | ->children() |
||||
68 | ->scalarNode('path')->end() |
||||
69 | ->scalarNode('filename')->end() |
||||
70 | ->end() |
||||
71 | ->end(); |
||||
72 | } |
||||
73 | |||||
74 | private function createStylesNode(): ArrayNodeDefinition |
||||
75 | { |
||||
76 | return $this->createPrototypeNode('styles') |
||||
77 | ->prototype('array') |
||||
78 | ->prototype('array') |
||||
0 ignored issues
–
show
The method
prototype() does not exist on Symfony\Component\Config...\Builder\NodeDefinition . It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
79 | ->children() |
||||
80 | ->scalarNode('name')->end() |
||||
81 | ->scalarNode('type')->end() |
||||
82 | ->scalarNode('widget')->end() |
||||
83 | ->variableNode('element')->end() |
||||
84 | ->append($this->createPrototypeNode('styles')->prototype('scalar')->end()) |
||||
85 | ->append($this->createPrototypeNode('attributes')->prototype('scalar')->end()) |
||||
86 | ->end() |
||||
87 | ->end() |
||||
88 | ->end(); |
||||
89 | } |
||||
90 | |||||
91 | private function createTemplatesNode(): ArrayNodeDefinition |
||||
92 | { |
||||
93 | return $this->createPrototypeNode('templates') |
||||
94 | ->prototype('array') |
||||
95 | ->children() |
||||
96 | ->scalarNode('imagesPath')->end() |
||||
97 | ->arrayNode('templates') |
||||
98 | ->prototype('array') |
||||
99 | ->children() |
||||
100 | ->scalarNode('title')->end() |
||||
101 | ->scalarNode('image')->end() |
||||
102 | ->scalarNode('description')->end() |
||||
103 | ->scalarNode('html')->end() |
||||
104 | ->scalarNode('template')->end() |
||||
105 | ->append($this->createPrototypeNode('template_parameters')->prototype('scalar')->end()) |
||||
106 | ->end() |
||||
107 | ->end() |
||||
108 | ->end() |
||||
109 | ->end() |
||||
110 | ->end(); |
||||
111 | } |
||||
112 | |||||
113 | private function createFilebrowsersNode(): ArrayNodeDefinition |
||||
114 | { |
||||
115 | return $this->createNode('filebrowsers') |
||||
0 ignored issues
–
show
|
|||||
116 | ->useAttributeAsKey('name') |
||||
117 | ->prototype('scalar') |
||||
118 | ->end(); |
||||
119 | } |
||||
120 | |||||
121 | private function createToolbarsNode(): ArrayNodeDefinition |
||||
122 | { |
||||
123 | return $this->createNode('toolbars') |
||||
124 | ->addDefaultsIfNotSet() |
||||
125 | ->children() |
||||
126 | ->arrayNode('configs') |
||||
127 | ->useAttributeAsKey('name') |
||||
128 | ->prototype('array') |
||||
129 | ->prototype('variable')->end() |
||||
130 | ->end() |
||||
131 | ->end() |
||||
132 | ->arrayNode('items') |
||||
133 | ->useAttributeAsKey('name') |
||||
134 | ->prototype('array') |
||||
135 | ->prototype('variable')->end() |
||||
136 | ->end() |
||||
137 | ->end() |
||||
138 | ->end(); |
||||
139 | } |
||||
140 | |||||
141 | private function createPrototypeNode(string $name): ArrayNodeDefinition |
||||
142 | { |
||||
143 | return $this->createNode($name) |
||||
144 | ->normalizeKeys(false) |
||||
145 | ->useAttributeAsKey('name'); |
||||
146 | } |
||||
147 | |||||
148 | private function createNode(string $name): ArrayNodeDefinition |
||||
149 | { |
||||
150 | return $this->createTreeBuilder()->root($name); |
||||
0 ignored issues
–
show
|
|||||
151 | } |
||||
152 | |||||
153 | private function createTreeBuilder(): TreeBuilder |
||||
154 | { |
||||
155 | return new TreeBuilder(); |
||||
156 | } |
||||
157 | } |
||||
158 |
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.