ref::config PHP Method

config() public static method

Set or get configuration options
public static config ( string $key, mixed | null $value = null ) : mixed
$key string
$value mixed | null
return mixed
    public static function config($key, $value = null)
    {
        if (!array_key_exists($key, static::$config)) {
            throw new \Exception(sprintf('Unrecognized option: "%s". Valid options are: %s', $key, implode(', ', array_keys(static::$config))));
        }
        if ($value === null) {
            return static::$config[$key];
        }
        if (is_array(static::$config[$key])) {
            return static::$config[$key] = (array) $value;
        }
        return static::$config[$key] = $value;
    }

Usage Example

Example #1
0
 /**
  * Setup ref
  * 
  * @return void
  */
 public static function init()
 {
     \ref::config('expLvl', 0);
     \ref::config('maxDepth', 10);
     \ref::config('showIteratorContents', TRUE);
     \ref::config('showPrivateMembers', TRUE);
 }
All Usage Examples Of ref::config