October\Rain\Config\Repository

Source: ~/vendor/october/rain/src/Config/Repository.php

Implements:

  • ArrayAccess
  • Illuminate\Contracts\Config\Repository

October config repository class.

Protected properties

protected October\Rain\Config\LoaderInterface $loader

The loader implementation.

protected string $environment

The current environment.

protected array $items

All of the configuration items.

protected array $packages

All of the registered packages.

protected array $afterLoad

The after load callbacks for namespaces.

protected array $keyParserCache

A cache of the parsed items.

Public methods

public void __construct(October\Rain\Config\LoaderInterface $loader, string $environment)

Create a new configuration repository.

Parameters

public void addNamespace(string $namespace, string $hint)

Add a new namespace to the loader.

Parameters
  • string $namespace
  • string $hint

public void afterLoading(string $namespace, Closure $callback)

Register an after load callback for a given namespace.

Parameters
  • string $namespace
  • Closure $callback

public array all()

Get all of the configuration items for the application.

public mixed get(string $key, mixed $default=NULL)

Get the specified configuration value.

Parameters
  • string $key
  • mixed $default

public array getAfterLoadCallbacks()

Get the after load callback array.

public string getEnvironment()

Get the current configuration environment.

public array getItems()

Get all of the configuration items.

public October\Rain\Config\LoaderInterface getLoader()

Get the loader implementation.

public array getNamespaces()

Returns all registered namespaces with the config loader.

public bool has(string $key)

Determine if the given configuration value exists.

Parameters
  • string $key

public bool hasGroup(string $key)

Determine if a configuration group exists.

Parameters
  • string $key

public bool offsetExists(string $key)

Determine if the given configuration option exists.

Parameters
  • string $key

public mixed offsetGet(string $key)

Get a configuration option.

Parameters
  • string $key

public void offsetSet(string $key, mixed $value)

Set a configuration option.

Parameters
  • string $key
  • mixed $value

public void offsetUnset(string $key)

Unset a configuration option.

Parameters
  • string $key

public void package(string $namespace, string $hint)

Register a package for cascading configuration.

Parameters
  • string $namespace
  • string $hint

public array parseConfigKey(string $key)

Parse a key into namespace, group, and item.

Parameters
  • string $key

public array parseKey(string $key)

Parse a key into namespace, group, and item.

Parameters
  • string $key

public void prepend(string $key, mixed $value)

Prepend a value onto an array configuration value.

Parameters
  • string $key
  • mixed $value

public void push(string $key, mixed $value)

Push a value onto an array configuration value.

Parameters
  • string $key
  • mixed $value

public void set(array|string $key, mixed $value=NULL)

Set a given configuration value.

Parameters
  • array|string $key
  • mixed $value

public void setLoader(October\Rain\Config\LoaderInterface $loader)

Set the loader implementation.

Parameters

public void setParsedKey(string $key, array $parsed)

Set the parsed value of a key.

Parameters
  • string $key
  • array $parsed

Protected methods

protected array callAfterLoad(string $namespace, string $group, array $items)

Call the after load callback for a namespace.

Parameters
  • string $namespace
  • string $group
  • array $items

protected string getCollection(string $group, string $namespace=NULL)

Get the collection identifier.

Parameters
  • string $group
  • string $namespace

protected array keyParserParseBasicSegments(array $segments)

Parse an array of basic segments.

Parameters
  • array $segments

protected array keyParserParseSegments(string $key)

Parse an array of namespaced segments.

Parameters
  • string $key

protected void load(string $group, string $namespace, string $collection)

Load the configuration group for the key.

Parameters
  • string $group
  • string $namespace
  • string $collection

protected array parseNamespacedSegments(string $key)

Parse an array of namespaced segments.

Parameters
  • string $key

protected array parsePackageSegments(string $key, string $namespace, string $item)

Parse the segments of a package namespace.

Parameters
  • string $key
  • string $namespace
  • string $item