Essence\Di\Container::get PHP Method

get() public method

Returns the value of the given property.
public get ( string $property, mixed $default = null ) : mixed
$property string Property name.
$default mixed Default value to be returned in case the property doesn't exists.
return mixed The property value, or the result of the closure execution if property is a closure, or $default.
    public function get($property, $default = null)
    {
        if (!isset($this->_properties[$property])) {
            return $default;
        }
        $value = $this->_properties[$property];
        if ($value instanceof Closure) {
            $value = $value($this);
        }
        return $value;
    }

Usage Example

Beispiel #1
0
 /**
  *	Constructor.
  *
  *	@param array $configuration Dependency injection configuration.
  */
 public function __construct(array $configuration = [])
 {
     $this->_Container = new StandardContainer($configuration);
     $this->_Http = $this->_Container->get('Http');
     $this->_Crawler = $this->_Container->get('Crawler');
     $this->_Extractor = $this->_Container->get('Extractor');
     $this->_Replacer = $this->_Container->get('Replacer');
 }
All Usage Examples Of Essence\Di\Container::get