配列に値がある場合は値を、無い場合はデフォルト値を返します。

@param	mixed	$array			値の取得元配列
@param	mixed	$name			キー名
@param	mixed	$default_value	デフォルト値
329446
public static function AdjustValue ($array, $name, $default_value = null) {
		if (is_array($array) || $array instanceof \Traversable) {
			foreach ((array) $name as $name) {
				if (isset($array[$name])) {
					return $array[$name];
				}
			}
		}
		return $default_value;
	}
93163
private function dumpArray(array &$value, $name): void
  {
    list($id, $ref) = $this->isReference($value);

    if ($ref===null)
    {
      $this->writer->writeArrayOpen($id, $name);

      foreach ($value as $key => &$item)
      {
        $this->recursiveDump($item, $key);
      }

      $this->writer->writeArrayClose($id, $name);
    }
    else
    {
      $this->writer->writeArrayReference($ref, $name);
    }
  }
517498
function (name, default_value) {
	if (l_states.hasOwnProperty(name) === false) {
		LOG.warn('[' + name + '] initialized to: ' + default_value, 'handlers.system');
		l_states[name] = default_value;
	}
}
1061300
public function setDefaultFilter(array $default_filter, $use_on_reset = true)
	{
		foreach ($default_filter as $key => $value) {
			$filter = $this->getFilter($key);

			if (!$filter) {
				throw new DataGridException("Can not set default value to nonexisting filter [$key]");
			}

			if ($filter instanceof Filter\FilterMultiSelect && !is_array($value)) {
				throw new DataGridException(
					"Default value of filter [$key] - MultiSelect has to be an array"
				);
			}

			if ($filter instanceof Filter\FilterRange || $filter instanceof Filter\FilterDateRange) {
				if (!is_array($value)) {
					throw new DataGridException(
						"Default value of filter [$key] - Range/DateRange has to be an array [from/to => ...]"
					);
				}

				$temp = $value;
				unset($temp['from'], $temp['to']);

				if (!empty($temp)) {
					throw new DataGridException(
						"Default value of filter [$key] - Range/DateRange can contain only [from/to => ...] values"
					);
				}
			}
		}

		$this->default_filter = $default_filter;
		$this->default_filter_use_on_reset = (bool) $use_on_reset;

		return $this;
	}
808044
public static function get($array, $key, $default = null)
    {
        if (null === $key) {
            return $array;
        }

        if (isset($array[$key])) {
            return $array[$key];
        }

        foreach (explode('.', $key) as $segment) {
            if (static::accessible($array) && static::exists($array, $segment)) {
                $array = $array[$segment];
            } else {
                return value($default);
            }
        }

        return $array;
    }
531711
static function setArrayValue(&$data,$name=null,$val=null) {   
        if(!is_array($data) || $name === NULL || $val === NULL) return(false);
        
        if(is_array($name))
            $path = $name;
        else
            $path = explode(".", $name);

        if(sizeof($path) < 1) return false;
        
        $ptr=&$data; 
        for($i=0;$i < sizeof($path); $i++) {            
            $attr = $path[$i];
            if(!isset($ptr[$attr])) return false;
            $ptr = &$ptr[$attr];
        }
        
        // kraj
        $ptr = $val;
        return true;
    }
1146546
protected function arrayDotKeysToScope(array $input, $default_name)
    {
        $data = [];
        foreach($input as $key => $value) {
            $tokens = explode('.', $key);
            @list($name, $property) = $tokens;
            if ($property === null) {
                if ($this->isIterable($value) && empty($value) === false) {
                    foreach ($value as $value_name => $value_value) {
                        //$data["$name.$value_name"] = $value_value;
                    }
                }
                else {
                    $data["$default_name.$name"] = $value;
                }
            }
            else {
                $data[$key] = $value;
            }
        }
        return $data;
    }
803745
public function loadArray($config_array)
    {
        if ($this->isFinalized('Cannot load directives after finalization')) {
            return;
        }
        foreach ($config_array as $key => $value) {
            $key = str_replace('_', '.', $key);
            if (strpos($key, '.') !== false) {
                $this->set($key, $value);
            } else {
                $namespace = $key;
                $namespace_values = $value;
                foreach ($namespace_values as $directive => $value2) {
                    $this->set($namespace .'.'. $directive, $value2);
                }
            }
        }
    }
792772
public static function get(array $array, $key, $default = null)
    {
        if (strpos($key, '.') !== false) {
            $keys = explode('.', $key);
            $topKey = array_shift($keys);

            return (isset($array[$topKey])) ? static::get($array[$topKey], implode('.', $keys), $default) : $default;
        } else {
            return (isset($array[$key])) ? $array[$key] : $default;
        }
    }
1163698
public static function Get ($const_name, $default_value = NULL, $undefined_exception = FALSE) {
		$separator_pos = Strings::RearPosition($const_name, '::');
		if ($separator_pos && !class_exists(Strings::Substring($const_name, 0, $separator_pos), TRUE) && $undefined_exception) {
			throw CoreException::RaiseSystemError('存在しないクラスが設定されています。const name:%s', [$const_name]);
		}
		if (!defined($const_name)) {
			if ($undefined_exception) {
				throw CoreException::RaiseSystemError('存在しない定数名が設定されています。const name:%s', [$const_name]);
			}
			return $default_value;
		}
		return constant($const_name);
	}
119724
public static function sGet($array, $key, $default = null)
    {
        $value = self::get($array, $key);
        return !empty($value) ? $value : $default;
    }
686684
public static function a2sInsert($iArray, $defaultArray = array()) {
        $nameStr = $valStr = "";
//        self::pln($iArray,"ns");
        while (list($key, $val) = each($iArray)) {
//            self::pln(gettype($val),"t=$key");
            // use single quote to work around sqlsrv error
            // override value from $defaultArray value of the same key
            if (empty($val) and isset($defaultArray[$key])) {
               $valStr .= "'" .  $defaultArray[$key] . "', ";
            // catch the case of integer val=0
            } elseif (isset($val) and empty($val) and gettype($val)<>"string") {
               $valStr .= "'$val', ";
            } elseif (!empty($val)) {
               $valStr .= "'" .  self::escapeQuote($val).  "', ";
            // catch the case of null in date field
            } else {
               $valStr .= "null, ";
            }
        }
        $nameStr = implode(", ", array_keys($iArray));       
//        self::pln($nameStr,"ns");
//        self::pln($valStr,"vs");
        // take out comma and space
        $valStr = substr($valStr, 0, strlen($valStr) - 2); 
        return "($nameStr) VALUES ($valStr)";
    }
1256634
public function getValue($name, $default = null)
    {
        return isset($this->data[$name]) ? $this->data[$name] : $default;
    }
391485
protected function _updateColumnDefaultValues ($table_name) {
		$this->_columnDefaultValues[$table_name] = [];
		foreach ($this->getColumns($table_name) as $column_name => $column) {
			if ($column['default'] !== null) {
				$this->_columnDefaultValues[$table_name][$column_name] = $column['default'];
			}
		}
	}
621967
public static function acfg($name, array $default = []) {
        $value = self::cfg($name);
        if ($value) {
            if (is_string($value)) {
                $value = @json_decode($value, true);
            }
            if ($value === false) {
                $value = [];
            }
        } else {
            $value = $default;
        }

        return $value;
    }
94155
public static function toInteger(&$array, $default=0)
  {
    if ( is_array($array) ){
      foreach ($array as $i => $v){
        $array[$i] = (int)$v;
      }
    }
    else {
      if ( $default === null ){
        $array = [];
      }
      elseif ( is_array($default) ){
        self::toInteger($default, null);
        $array = $default;
      }
      else {
        $array = array((int)$default);
      }
    }
  }
1341462
public function array_pluck( $array, $key, $default = null, $filter = false ) {
		$array = $this->get_array_value( $array );

		return array_map( function ( $d ) use ( $key, $default ) {
			is_object( $d ) and $d = (array) $d;

			return is_array( $d ) && array_key_exists( $key, $d ) ? $d[ $key ] : $default;
		}, $filter ? array_filter( $array, function ( $d ) use ( $key ) {
			is_object( $d ) and $d = (array) $d;

			return is_array( $d ) && array_key_exists( $key, $d );
		} ) : $array );
	}