Permalink
Browse files

Expose formally protected method in ConfigListener

I made the "hasCachedConfig()" method public and added it to ConfigMergerInterface.
The reason for this is, sometimes it's useful to know, whether or not the config object is already merged and cached or not.
F.e. when I allow a method like: "getPHPUnitPaths()" in a module with an PHPUnitProviderInterface, and the return value should get merged into the config file this would lead to bugs, because the order of the modules is not correctly applied any more. Therefore I need to know, whether the work is already done and therefore I know, I can skip at this point. Otherwise it will merge together a part of config file from "getConfig()" with the return value of a custom provider method.
  • Loading branch information...
1 parent c8e832c commit 5d7e5a4e8eb9dec67b6e919949002854bdc1de1a @prolic committed Sep 19, 2012
@@ -278,6 +278,21 @@ public function addConfigStaticPath($staticPath)
}
/**
+ * Whether the config is already cached
+ *
+ * @return bool
+ */
+ public function hasCachedConfig()
+ {
+ if (($this->getOptions()->getConfigCacheEnabled())
+ && (file_exists($this->getOptions()->getConfigCacheFile()))
+ ) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Add an array of paths of config files to merge after loading modules
*
* @param Traversable|array $paths
@@ -374,19 +389,6 @@ protected function addConfigByPath($path, $type)
}
/**
- * @return bool
- */
- protected function hasCachedConfig()
- {
- if (($this->getOptions()->getConfigCacheEnabled())
- && (file_exists($this->getOptions()->getConfigCacheFile()))
- ) {
- return true;
- }
- return false;
- }
-
- /**
* @return mixed
*/
protected function getCachedConfig()
@@ -34,4 +34,11 @@ public function getMergedConfig($returnConfigAsObject = true);
* @return ConfigMergerInterface
*/
public function setMergedConfig(array $config);
+
+ /**
+ * Whether the config is already cached
+ *
+ * @return bool
+ */
+ public function hasCachedConfig();
}

0 comments on commit 5d7e5a4

Please sign in to comment.