File manager - Edit - /home/opticamezl/www/newok/configuration.zip
Back
PK k�\wbn�T T src/ConfigObject.phpnu �[��� <?php namespace YOOtheme; class ConfigObject extends \ArrayObject { /** * Constructor. */ public function __construct(array $values = []) { parent::__construct($values, static::ARRAY_AS_PROPS); } /** * Get all configuration values. */ public function all(): array { return $this->getArrayCopy(); } /** * Get a configuration value. * * @param mixed $default * @return mixed */ public function get(string $key, $default = null) { return Arr::get($this, $key, $default); } /** * Set a configuration value. * * @param mixed $value */ public function set(string $key, $value): void { Arr::set($this, $key, $value); } /** * Remove the last value from an array configuration value. * * @return mixed */ public function pop(string $key) { $array = $this->get($key, []); $value = array_pop($array); $this->set($key, $array); return $value; } /** * Push a value onto an array configuration value. * * @param mixed ...$values */ public function push(string $key, ...$values): void { $array = $this->get($key, []); array_push($array, ...$values); $this->set($key, $array); } /** * Remove the first value from an array configuration value. * * @return mixed */ public function shift(string $key) { $array = $this->get($key, []); $value = array_shift($array); $this->set($key, $array); return $value; } /** * Prepend a value onto an array configuration value. * * @param mixed ...$values */ public function unshift(string $key, ...$values): void { $array = $this->get($key, []); array_unshift($array, ...$values); $this->set($key, $array); } /** * Assign an array of configuration values. */ public function assign(array $values): void { $this->exchangeArray(array_replace($this->getArrayCopy(), $values)); } /** * Merge an array of configuration values recursively. */ public function merge(array $values): void { $this->exchangeArray(array_replace_recursive($this->getArrayCopy(), $values)); } } PK k�\t�� � src/Config.phpnu �[��� <?php namespace YOOtheme; interface Config { /** * Gets a value (shortcut). * * @param string $index * @param mixed $default * * @return mixed */ public function __invoke($index, $default = null); /** * Gets a value. * * @param string $index * @param mixed $default * * @return mixed */ public function get($index, $default = null); /** * Sets a value. * * @param string $index * @param mixed $value * * @return $this */ public function set($index, $value); /** * Deletes a value. * * @param string $index * * @return $this */ public function del($index); /** * Adds a value array. * * @param string $index * @param array $values * @param bool $replace * * @return $this */ public function add($index, array $values = [], $replace = true); /** * Sets a value using a update callback. * * @param string $index * @param callable $callback * * @return $this */ public function update($index, callable $callback); /** * Adds an alias. * * @param string $name * @param string $index * * @return $this */ public function addAlias($name, $index); /** * Adds a file. * * @param string $index * @param string $file * @param bool $replace * * @throws \RuntimeException * * @return $this */ public function addFile($index, $file, $replace = true); /** * Adds a filter callback. * * @param string $name * @param callable $filter * * @return $this */ public function addFilter($name, callable $filter); /** * Loads a config file. * * @param string $file * * @throws \RuntimeException * * @return array */ public function loadFile($file); } PK k�\ �oG G src/Configuration/Node.phpnu �[��� <?php namespace YOOtheme\Configuration; abstract class Node { /** * Resolves node to their values. * * @param array $params * * @return mixed */ abstract public function resolve(array $params); /** * Compiles node as parsable string. * * @param array $params * * @return string */ abstract public function compile(array $params); /** * Resolves arguments to their values. * * @param array $arguments * @param array $params * * @return array */ public function resolveArgs(array $arguments, array $params = []) { $args = []; foreach ($arguments as $argument) { $args[] = $argument instanceof Node ? $argument->resolve($params) : $argument; } return $args; } /** * Compiles arguments as parsable string. * * @param array $arguments * @param array $params * * @return string */ public function compileArgs(array $arguments, array $params = []) { $args = []; foreach ($arguments as $argument) { $args[] = $argument instanceof Node ? $argument->compile($params) : var_export($argument, true); } return join(', ', $args); } } PK k�\���[� � "