[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * (c) 2004-2006 Sean Kerr. 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 /** 13 * sfConfigHandler allows a developer to create a custom formatted configuration 14 * file pertaining to any information they like and still have it auto-generate 15 * PHP code. 16 * 17 * @package symfony 18 * @subpackage config 19 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 20 * @author Sean Kerr <skerr@mojavi.org> 21 * @version SVN: $Id: sfConfigHandler.class.php 3203 2007-01-09 18:32:54Z fabien $ 22 */ 23 abstract class sfConfigHandler 24 { 25 protected 26 $parameterHolder = null; 27 28 /** 29 * Executes this configuration handler 30 * 31 * @param array An array of filesystem path to a configuration file 32 * 33 * @return string Data to be written to a cache file 34 * 35 * @throws <b>sfConfigurationException</b> If a requested configuration file does not exist or is not readable 36 * @throws <b>sfParseException</b> If a requested configuration file is improperly formatted 37 */ 38 abstract public function execute($configFiles); 39 40 /** 41 * Initializes this configuration handler. 42 * 43 * @param array An associative array of initialization parameters 44 * 45 * @return bool true, if initialization completes successfully, otherwise false 46 * 47 * @throws <b>sfInitializationException</b> If an error occurs while initializing this ConfigHandler 48 */ 49 public function initialize($parameters = null) 50 { 51 $this->parameterHolder = new sfParameterHolder(); 52 $this->parameterHolder->add($parameters); 53 } 54 55 /** 56 * Replaces constant identifiers in a value. 57 * 58 * If the value is an array replacements are made recursively. 59 * 60 * @param mixed The value on which to run the replacement procedure 61 * 62 * @return string The new value 63 */ 64 public static function replaceConstants($value) 65 { 66 if (is_array($value)) 67 { 68 array_walk_recursive($value, create_function('&$value', '$value = sfToolkit::replaceConstants($value);')); 69 } 70 else 71 { 72 $value = sfToolkit::replaceConstants($value); 73 } 74 75 return $value; 76 } 77 78 /** 79 * Replaces a relative filesystem path with an absolute one. 80 * 81 * @param string A relative filesystem path 82 * 83 * @return string The new path 84 */ 85 public static function replacePath($path) 86 { 87 if (!sfToolkit::isPathAbsolute($path)) 88 { 89 // not an absolute path so we'll prepend to it 90 $path = sfConfig::get('sf_app_dir').'/'.$path; 91 } 92 93 return $path; 94 } 95 96 /** 97 * Gets the parameter holder for this configuration handler. 98 * 99 * @return sfParameterHolder A sfParameterHolder instance 100 */ 101 public function getParameterHolder() 102 { 103 return $this->parameterHolder; 104 } 105 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |