11
11
12
12
namespace Symfony \Component \HttpKernel \DependencyInjection ;
13
13
14
- use Symfony \Component \Config \Definition \Processor ;
15
- use Symfony \Component \Config \Resource \FileResource ;
16
- use Symfony \Component \Config \Definition \ConfigurationInterface ;
17
- use Symfony \Component \DependencyInjection \Extension \ExtensionInterface ;
18
- use Symfony \Component \DependencyInjection \Extension \ConfigurationExtensionInterface ;
19
- use Symfony \Component \DependencyInjection \ContainerBuilder ;
20
- use Symfony \Component \DependencyInjection \Container ;
14
+ use Symfony \Component \DependencyInjection \Extension \Extension as BaseExtension ;
21
15
22
16
/**
23
- * Provides useful features shared by many extensions .
17
+ * Allow adding classes to the class cache .
24
18
*
25
19
* @author Fabien Potencier <fabien@symfony.com>
26
20
*/
27
- abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface
21
+ abstract class Extension extends BaseExtension
28
22
{
29
23
private $ classes = array ();
30
24
@@ -47,85 +41,4 @@ public function addClassesToCompile(array $classes)
47
41
{
48
42
$ th
10000
is ->classes = array_merge ($ this ->classes , $ classes );
49
43
}
50
-
51
- /**
52
- * Returns the base path for the XSD files.
53
- *
54
- * @return string The XSD base path
55
- */
56
- public function getXsdValidationBasePath ()
57
- {
58
- return false ;
59
- }
60
-
61
- /**
62
- * Returns the namespace to be used for this extension (XML namespace).
63
- *
64
- * @return string The XML namespace
65
- */
66
- public function getNamespace ()
67
- {
68
- return 'http://example.org/schema/dic/ ' .$ this ->getAlias ();
69
- }
70
-
71
- /**
72
- * Returns the recommended alias to use in XML.
73
- *
74
- * This alias is also the mandatory prefix to use when using YAML.
75
- *
76
- * This convention is to remove the "Extension" postfix from the class
77
- * name and then lowercase and underscore the result. So:
78
- *
79
- * AcmeHelloExtension
80
- *
81
- * becomes
82
- *
83
- * acme_hello
84
- *
85
- * This can be overridden in a sub-class to specify the alias manually.
86
- *
87
- * @return string The alias
88
- *
89
- * @throws \BadMethodCallException When the extension name does not follow conventions
90
- */
91
- public function getAlias ()
92
- {
93
- $ className = get_class ($ this );
94
- if (substr ($ className , -9 ) != 'Extension ' ) {
95
- throw new \BadMethodCallException ('This extension does not follow the naming convention; you must overwrite the getAlias() method. ' );
96
- }
97
- $ classBaseName = substr (strrchr ($ className , '\\' ), 1 , -9 );
98
-
99
- return Container::underscore ($ classBaseName );
100
- }
101
-
102
- final protected function processConfiguration (ConfigurationInterface $ configuration , array $ configs , $ normalizeKeys = true )
103
- {
104
- $ processor = new Processor ();
105
-
106
- return $ processor ->processConfiguration ($ configuration , $ configs , $ normalizeKeys );
107
- }
108
-
109
- /**
110
- * {@inheritDoc}
111
- */
112
- public function getConfiguration (array $ config , ContainerBuilder $ container )
113
- {
114
- $ reflected = new \ReflectionClass ($ this );
115
- $ namespace = $ reflected ->getNamespaceName ();
116
-
117
- $ class = $ namespace . '\\Configuration ' ;
118
- if (class_exists ($ class )) {
119
- $ r = new \ReflectionClass ($ class );
120
- $ container ->addResource (new FileResource ($ r ->getFileName ()));
121
-
122
- if (!method_exists ($ class , '__construct ' )) {
123
- $ configuration = new $ class ();
124
-
125
- return $ configuration ;
126
- }
127
- }
128
-
129
- return null ;
130
- }
131
44
}
0 commit comments