update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,27 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik;
|
||||
|
||||
use Piwik\Container\StaticContainer;
|
||||
|
||||
/**
|
||||
* Registry class.
|
||||
*
|
||||
* @method static \Piwik\Registry getInstance()
|
||||
* @method static Registry getInstance()
|
||||
* @api
|
||||
* @deprecated This class will be removed, use the container instead.
|
||||
*/
|
||||
class Registry extends Singleton
|
||||
{
|
||||
private $data;
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$this->data = array();
|
||||
}
|
||||
|
||||
public static function isRegistered($key)
|
||||
{
|
||||
return self::getInstance()->hasKey($key);
|
||||
|
|
@ -39,19 +36,28 @@ class Registry extends Singleton
|
|||
|
||||
public function setKey($key, $value)
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
if ($key === 'auth') {
|
||||
$key = 'Piwik\Auth';
|
||||
}
|
||||
|
||||
StaticContainer::getContainer()->set($key, $value);
|
||||
}
|
||||
|
||||
public function getKey($key)
|
||||
{
|
||||
if (!$this->hasKey($key)) {
|
||||
throw new \Exception(sprintf("Key '%s' doesn't exist in Registry", $key));
|
||||
if ($key === 'auth') {
|
||||
$key = 'Piwik\Auth';
|
||||
}
|
||||
return $this->data[$key];
|
||||
|
||||
return StaticContainer::get($key);
|
||||
}
|
||||
|
||||
public function hasKey($key)
|
||||
{
|
||||
return array_key_exists($key, $this->data);
|
||||
if ($key === 'auth') {
|
||||
$key = 'Piwik\Auth';
|
||||
}
|
||||
|
||||
return StaticContainer::getContainer()->has($key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue