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.
コード例 #1
0
ファイル: Essence.php プロジェクト: muten84/luigibifulco.it
 /**
  *	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');
 }
コード例 #2
0
 /**
  *	Finds providers of the given url.
  *
  *	@todo Use PHP generators to yield providers.
  *	@param string $url An url which may be extracted.
  *	@return array An array of Essence\Provider.
  */
 public function providers($url)
 {
     $filters = $this->_Container->get('filters');
     foreach ($filters as $name => $filter) {
         if ($this->_matches($filter, $url)) {
             (yield $this->_Container->get($name));
         }
     }
 }
コード例 #3
0
ファイル: Collection.php プロジェクト: ashliewebb/ashliewebb
 /**
  *	Lazy loads a provider given its name and configuration.
  *
  *	@param string $name Name.
  *	@param string $config Configuration.
  *	@return Provider Instance.
  */
 protected function _provider($name, $config)
 {
     if (!isset($this->_providers[$name])) {
         $class = $config['class'];
         $Provider = $this->_Container->has($class) ? $this->_Container->get($class) : new $class();
         $Provider->configure($config);
         $this->_providers[$name] = $Provider;
     }
     return $this->_providers[$name];
 }
コード例 #4
0
 /**
  *	Constructs a provider given its configuration.
  *
  *	@param string $config Configuration.
  *	@return Provider Instance.
  */
 protected function _buildProvider($config)
 {
     $name = $config['class'];
     if (!$this->_Container->has($name)) {
         throw new Exception("The '{$name}' provider is not configured.");
     }
     $Provider = $this->_Container->get($name);
     $Provider->configure($config);
     return $Provider;
 }