path() public static method

Returns true if found and false if not.
public static path ( $array, $path, &$found, $delimiter = '.' ) : boolean
return boolean
コード例 #1
0
ファイル: Resque.php プロジェクト: mjphaynes/php-resque
 /**
  * Gets Resque config variable
  *
  * @param  string  $key     The key to search for (optional)
  * @param  mixed   $default If key not found returns this (optional)
  * @return mixed
  */
 public static function getConfig($key = null, $default = null)
 {
     if (!is_null($key)) {
         if (false !== Util::path(static::$config, $key, $found)) {
             return $found;
         } else {
             return $default;
         }
     }
     return static::$config;
 }
コード例 #2
0
ファイル: Command.php プロジェクト: mjphaynes/php-resque
 /**
  * Parses the configuration file
  *
  * @return bool
  */
 protected function parseConfig($config, $defaults)
 {
     if (array_key_exists('config', $config)) {
         $configFileData = Resque::readConfigFile($config['config']);
         foreach ($config as $key => &$value) {
             // If the config value is equal to the default value set in the command then
             // have a look at the config file. This is so that the config options can be
             // over-ridden in the command line.
             if (isset($this->configOptionMap[$key]) and (($key === 'verbose' or $value === $defaults[$key]) and false !== Util::path($configFileData, $this->configOptionMap[$key], $found))) {
                 switch ($key) {
                     // Need to make sure the log handlers are in the correct format
                     case 'log':
                         $value = array();
                         foreach ((array) $found as $handler => $target) {
                             $handler = strtolower($handler);
                             if ($target !== true) {
                                 $handler .= ':';
                                 if (in_array($handler, array('redis:', 'mongodb:', 'couchdb:', 'amqp:'))) {
                                     $handler .= '//';
                                 }
                                 $handler .= $target;
                             }
                             $value[] = $handler;
                         }
                         break;
                     default:
                         $value = $found;
                         break;
                 }
             }
         }
         $this->config = $config;
         return true;
     }
     return false;
 }