Noherczeg\Breadcrumb\Config::value PHP Метод

value() публичный Метод

value: Returns the value of the requested key.
public value ( String $key = null ) : String
$key String Requested value's key
Результат String
    public function value($key = null)
    {
        if (!is_string($key)) {
            throw new \InvalidArgumentException("Invalid argument provided, string required!");
        } elseif (method_exists('\\Illuminate\\Config\\Repository', 'get') && \Config::get('breadcrumb::' . $key, false) !== false) {
            return \Config::get('breadcrumb::' . $key, false);
        } elseif (!array_key_exists($key, $this->configs)) {
            throw new \OutOfRangeException("There is no " . $key . " key in the Configurations!");
        } else {
            return $this->configs[$key];
        }
    }

Usage Example

Пример #1
0
 /**
  * Builder method which returns with a result type as required.
  * Supports separator switching, casing switching, and custom property
  * insertion from an array (only if output is set to html!).
  *
  * @param String $format Format of the output
  * @param String|null $casing Casing of Segments
  * @param bool $last_not_link
  * @param String|null $separator Separator String (not there in Foundation!)
  * @param array $customizations Array of properties (only in HTML!)
  * @param bool $different_links
  * @throws \OutOfRangeException
  * @return String
  */
 public function build($format = null, $casing = null, $last_not_link = true, $separator = null, $customizations = array(), $different_links = false)
 {
     $format = is_null($format) ? $this->config->value('output_format') : $format;
     if (in_array($format, $this->build_formats)) {
         // compose the namespaced name of the builder which we wanted to use
         $builder_name = '\\Noherczeg\\Breadcrumb\\Builders\\' . ucfirst($format) . 'Builder';
         // instantiate it
         $this->builder_instance = new $builder_name($this->segments, $this->base_url, $this->config);
         // return with the results :)
         return $this->builder_instance->build($casing, $last_not_link, $separator, $customizations, $different_links);
     } else {
         throw new OutOfRangeException("Provided output format({$format}) is not supported!");
     }
 }