Fakerino\Configuration\FakerinoConf::get PHP Method

get() public method

Returns a configuration value.
public get ( string $value ) : mixed
$value string
return mixed
    public function get($value)
    {
        if (!empty($this->conf)) {
            if (array_key_exists($value, $this->conf)) {
                return $this->conf[$value];
            }
        }
        throw new ConfValueNotFoundException($value);
    }

Usage Example

Beispiel #1
0
 protected function process($data)
 {
     $fakeTag = FakerinoConf::get('fakerinoTag');
     /**
      * When an element in the configuration is not present,
      * FakerinoConf returns an exception.
      * Because the Handler needs a null value to continue the chain handling,
      * the catch block will intercept that exception.
      */
     try {
         $elementInConf = FakerinoConf::get($fakeTag);
         if (array_key_exists($data->getName(), $elementInConf)) {
             $firstChain = self::getFirstChain();
             if ($firstChain !== null) {
                 $classes = array();
                 foreach ($elementInConf[$data->getName()] as $key => $val) {
                     $element = new FakeElement($key, $val);
                     $classes[] = $firstChain->handle($element);
                 }
                 return $classes;
             }
         }
     } catch (ConfValueNotFoundException $e) {
     }
     return;
 }
All Usage Examples Of Fakerino\Configuration\FakerinoConf::get