Imdb\MdbBase::__construct PHP Method

__construct() public method

public __construct ( Config $config = null, Psr\Log\LoggerInterface $logger = null, CacheInterface $cache = null )
$config Config OPTIONAL override default config
$logger Psr\Log\LoggerInterface OPTIONAL override default logger
$cache CacheInterface OPTIONAL override default cache
    public function __construct(Config $config = null, LoggerInterface $logger = null, CacheInterface $cache = null)
    {
        parent::__construct();
        if ($config) {
            foreach ($config as $key => $value) {
                $this->{$key} = $value;
            }
        }
        $this->config = $config ?: $this;
        $this->logger = empty($logger) ? new Logger($this->debug) : $logger;
        $this->cache = empty($cache) ? new Cache($this->config, $this->logger) : $cache;
        $this->pages = new Pages($this->config, $this->cache, $this->logger);
        $this->cache->purge();
    }

Usage Example

示例#1
0
 /**
  * @param string id IMDBID to use for data retrieval
  * @param Config $config OPTIONAL override default config
  * @param LoggerInterface $logger OPTIONAL override default logger
  * @param CacheInterface $cache OPTIONAL override default cache
  */
 public function __construct($id, Config $config = null, LoggerInterface $logger = null, CacheInterface $cache = null)
 {
     parent::__construct($config, $logger, $cache);
     $this->revision = preg_replace('|^.*?(\\d+).*$|', '$1', '$Revision$');
     $this->setid($id);
 }
All Usage Examples Of Imdb\MdbBase::__construct