Skip to content

Commit a6e3596

Browse files
committed
addCompilerPass is now public
1 parent b964de2 commit a6e3596

File tree

2 files changed

+68
-43
lines changed

2 files changed

+68
-43
lines changed

src/Application.php

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Application implements HttpKernelInterface, ContainerInterface, Extendable
3939
/**
4040
* @var bool
4141
*/
42-
private $cache;
42+
protected $cache;
4343

4444
/**
4545
* @var bool
@@ -82,7 +82,7 @@ class Application implements HttpKernelInterface, ContainerInterface, Extendable
8282
private $booted = false;
8383

8484
/**
85-
* Constructor
85+
* Constructor.
8686
*
8787
* @param string $environment
8888
* @param bool $debug
@@ -96,7 +96,7 @@ public function __construct($environment = 'dev', $debug = false, $cache = true)
9696
}
9797

9898
/**
99-
* Boot the Application
99+
* Boots the Application.
100100
*/
101101
public function boot()
102102
{
@@ -111,7 +111,7 @@ public function boot()
111111
}
112112

113113
/**
114-
* Prepend an extension
114+
* Prepends an extension.
115115
*
116116
* @param ExtensionInterface $extension
117117
*/
@@ -121,7 +121,7 @@ public function prependExtension(ExtensionInterface $extension)
121121
}
122122

123123
/**
124-
* Append an extension
124+
* Appends an extension.
125125
*
126126
* @param ExtensionInterface $extension
127127
*/
@@ -131,7 +131,7 @@ public function appendExtension(ExtensionInterface $extension)
131131
}
132132

133133
/**
134-
* Get an ordered list of extensions
134+
* Gets an ordered list of extensions.
135135
*
136136
* @return array|ExtensionInterface[]
137137
*/
@@ -141,7 +141,18 @@ public function getExtensions()
141141
}
142142

143143
/**
144-
* Register default extensions
144+
* Adds a compiler pass.
145+
*
146+
* @param CompilerPassInterface $pass A compiler pass
147+
* @param string $type The type of compiler pass
148+
*/
149+
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
150+
{
151+
$this->compilerPasses[] = array($pass, $type);
152+
}
153+
154+
/**
155+
* Registers default extensions.
145156
*
146157
* This method allows a subclass to customize default extensions
147158
*/
@@ -154,17 +165,6 @@ protected function registerDefaultExtensions()
154165
}
155166
}
156167

157-
/**
158-
* Adds a compiler pass.
159-
*
160-
* @param CompilerPassInterface $pass A compiler pass
161-
* @param string $type The type of compiler pass
162-
*/
163-
protected function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION)
164-
{
165-
$this->compilerPasses[] = array($pass, $type);
166-
}
167-
168168
/**
169169
* @return ContainerInterface
170170
*/
@@ -231,7 +231,7 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch =
231231
}
232232

233233
/**
234-
* Get the root directory
234+
* Gets the root directory.
235235
*
236236
* @return string
237237
*/
@@ -253,6 +253,8 @@ public function getRootDir()
253253
}
254254

255255
/**
256+
* Gets the cache directory.
257+
*
256258
* @return string|null Null if Caching should be disabled
257259
*/
258260
public function getCacheDir()
@@ -263,6 +265,8 @@ public function getCacheDir()
263265
}
264266

265267
/**
268+
* Gets the log directory.
269+
*
266270
* @return string
267271
*/
268272
public function getLogDir()
@@ -271,6 +275,19 @@ public function getLogDir()
271275
}
272276

273277
/**
278+
* Gets the environment.
279+
*
280+
* @return string
281+
*/
282+
public function getEnvironment()
283+
{
284+
return $this->environment;
285+
}
286+
287+
288+
/**
289+
* Gets the charset.
290+
*
274291
* @return string
275292
*/
276293
public function getCharset()
@@ -279,6 +296,28 @@ public function getCharset()
279296
}
280297

281298
/**
299+
* Returns true if debug is enabled.
300+
*
301+
* @return boolean
302+
*/
303+
public function isDebug()
304+
{
305+
return $this->debug;
306+
}
307+
308+
/**
309+
* Returns true if caching is enabled.
310+
*
311+
* @return boolean
312+
*/
313+
public function isCacheEnabled()
314+
{
315+
return $this->cache;
316+
}
317+
318+
/**
319+
* Gets the service container.
320+
*
282321
* @return ContainerInterface
283322
*/
284323
public function getContainer()
@@ -463,28 +502,4 @@ public function isScopeActive($name)
463502

464503
return $this->container->isScopeActive($name);
465504
}
466-
467-
/**
468-
* @return boolean
469-
*/
470-
public function isDebug()
471-
{
472-
return $this->debug;
473-
}
474-
475-
/**
476-
* @return boolean
477-
*/
478-
public function isCacheEnabled()
479-
{
480-
return $this->cache;
481-
}
482-
483-
/**
484-
* @return string
485-
*/
486-
public function getEnvironment()
487-
{
488-
return $this->environment;
489-
}
490505
}

src/DependencyInjection/ExtendableInterface.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace Nice\DependencyInjection;
1111

12+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
13+
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1214
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
1315

1416
/**
@@ -36,4 +38,12 @@ public function appendExtension(ExtensionInterface $extension);
3638
* @return array|ExtensionInterface[]
3739
*/
3840
public function getExtensions();
41+
42+
/**
43+
* Adds a compiler pass.
44+
*
45+
* @param CompilerPassInterface $pass A compiler pass
46+
* @param string $type The type of compiler pass
47+
*/
48+
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION);
3949
}

0 commit comments

Comments
 (0)