mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
add enhancement
This commit is contained in:
@@ -38,11 +38,11 @@ class Application implements Specification
|
||||
*/
|
||||
public function getConfFileFromEnvName($name)
|
||||
{
|
||||
if($name === self::EXTENDED_MAIN_KEYWORD)
|
||||
if ($name === self::EXTENDED_MAIN_KEYWORD)
|
||||
{
|
||||
return $this->getMainFile();
|
||||
return $this->getMainConfigurationFile();
|
||||
}
|
||||
|
||||
|
||||
return new \SplFileObject(sprintf("%s/config_%s.%s"
|
||||
, $this->getConfigurationFilePath()
|
||||
, $name
|
||||
@@ -58,8 +58,12 @@ class Application implements Specification
|
||||
{
|
||||
return __DIR__ . '/../../../../../config';
|
||||
}
|
||||
|
||||
public function getMainFile()
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMainConfigurationFile()
|
||||
{
|
||||
$path = __DIR__ . '/../../../../../config/config.yml';
|
||||
return new \SplFileObject($path);
|
||||
|
@@ -40,20 +40,38 @@ class Handler
|
||||
* @param ConfigurationSpecification $configSpec
|
||||
* @param Parser\ParserInterface $parser
|
||||
*/
|
||||
public function __construct(Application $configSpec, Parser $parser)
|
||||
public function __construct(Specification $configSpec, Parser $parser)
|
||||
{
|
||||
$this->confSpecification = $configSpec;
|
||||
$this->parser = $parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter
|
||||
* @return Specification
|
||||
*/
|
||||
public function getSpecification()
|
||||
{
|
||||
return $this->confSpecification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter
|
||||
* @return Parser
|
||||
*/
|
||||
public function getParser()
|
||||
{
|
||||
return $this->parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stacks all envrironnement in $env that extends the loaded configuration file
|
||||
*
|
||||
* @param SplFileObject $file File of the current loaded config file
|
||||
* @param array $envs A stack of conf environnments
|
||||
* @return array
|
||||
*/
|
||||
private function retrieveExtendedEnvFromFile(\SplFileObject $file, Array $allEnvs = array())
|
||||
public function retrieveExtendedEnvFromFile(\SplFileObject $file, Array $allEnvs = array())
|
||||
{
|
||||
$env = $this->parser->parse($file);
|
||||
|
||||
@@ -119,7 +137,6 @@ class Handler
|
||||
*/
|
||||
public function handle($name)
|
||||
{
|
||||
|
||||
//get the corresepondant file
|
||||
$file = $this->confSpecification->getConfFileFromEnvName($name);
|
||||
|
||||
@@ -171,10 +188,6 @@ class Handler
|
||||
$searchArray[$k] = $value;
|
||||
break; //quit
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -29,6 +29,13 @@ interface Specification
|
||||
*/
|
||||
const EXTENDED_MAIN_KEYWORD = 'main';
|
||||
|
||||
/**
|
||||
* Return the main configuration file
|
||||
*
|
||||
* @return \SplFileObject
|
||||
*/
|
||||
public function getMainConfigurationFile();
|
||||
|
||||
/**
|
||||
* Return an array of paths that CAN'T be extended by ONLY one or more of their value
|
||||
* but must be fully replaced with new values
|
||||
|
Reference in New Issue
Block a user