Example #1
0
 /**
  * Merges options from another epConfig instance or array
  * Same behavior as {@link epArrayMergeRecursive()}
  * @param mixed epConfig or array
  * @return bool
  * @throws epExceptionConfig
  * @access public
  */
 public function merge($config_or_options)
 {
     // if input config is invalid, do nothing
     if (!$config_or_options) {
         return false;
     }
     // get options in input config
     $options = null;
     $source = false;
     if ($config_or_options instanceof epConfig) {
         $options =& $config_or_options->options();
         $source = $config_or_options->getSource();
     } else {
         if (is_array($config_or_options)) {
             $options =& $config_or_options;
         } else {
             throw new epExceptionConfig('Argument unrecognized');
             return false;
         }
     }
     // check options
     if (empty($options)) {
         return false;
     }
     // merge options
     $this->options = epArrayMergeRecursive($this->options, epArrayStr2Bool($options));
     // set source file
     $this->setSource($source);
     return true;
 }
Example #2
0
/**
 * Converts array value string to boolean recursively
 * @see epStr2Bool()
 * @return array
 */
function epArrayStr2Bool($array)
{
    $array_b = $array;
    foreach ($array as $key => $value) {
        if (!is_array($value)) {
            $array_b[$key] = epStr2Bool($value);
            continue;
        }
        $array_b[$key] = epArrayStr2Bool($array[$key]);
    }
    return $array_b;
}