Get the $array['user']['name'] value from the array
$name = ArrayX::get($array, 'user.name');
Return a default from if the specified item doesn't exist
$name = ArrayX::get($array, 'user.name', 'Taylor');
/** * Reads the configuration settings from the file * @return array|mixed * @throws \Exception */ public static function settings() { if (null === self::$_settings) { self::$_settings = file_exists(self::getConfigurationDirectoryPath() . '/settings.php') ? require_once self::getConfigurationDirectoryPath() . '/settings.php' : array(); self::$_settings['envlock'] = file_exists(self::getEnvironmentLockFilePath()); if (($customSettings = ArrayX::get(self::$_settings, 'custom.path')) !== null && file_exists($customSettings)) { self::$_settings = ArrayX::merge(self::$_settings, require_once $customSettings); } } if (empty(self::$_settings)) { throw new \Exception('Unable to find Yiinitialzr settings file!'); } return self::$_settings; }
/** * Returns a value of the array * @param $value * @return mixed | null if no key is found */ public static function value($value) { return ArrayX::get(self::settings(), $value); }