Made enable(), disable() and isEnabled() method static, so they can be called from anywhere.

This commit is contained in:
Abel Hoogeveen 2019-02-04 22:38:21 +01:00
parent d1f670a8a8
commit 5d11627f47
No known key found for this signature in database
GPG Key ID: 96C2234920BF4292
1 changed files with 8 additions and 8 deletions

View File

@ -57,7 +57,7 @@ class TracyComponent implements iComponent
* *
* @var bool $enableTracy * @var bool $enableTracy
*/ */
protected $enableTracy = true; protected static $enableTracy = true;
public function getName(): string public function getName(): string
{ {
@ -80,7 +80,7 @@ class TracyComponent implements iComponent
public function onCreateContainer(Factory $container) public function onCreateContainer(Factory $container)
{ {
// If Tracy should not be enabled, escape // If Tracy should not be enabled, escape
if ($this->enableTracy == false) if (self::$enableTracy == false)
{ {
Logger::logInfo("TracyComponent added but not enabled."); Logger::logInfo("TracyComponent added but not enabled.");
return; return;
@ -156,9 +156,9 @@ class TracyComponent implements iComponent
* *
* Has no effect after container is created * Has no effect after container is created
*/ */
public function enableTracy() public static function enableTracy()
{ {
$this->enableTracy = true; self::$enableTracy = true;
} }
/** /**
@ -166,9 +166,9 @@ class TracyComponent implements iComponent
* *
* Has no effect after container is created * Has no effect after container is created
*/ */
public function disableTracy() public static function disableTracy()
{ {
$this->enableTracy = false; self::$enableTracy = false;
} }
/** /**
@ -176,8 +176,8 @@ class TracyComponent implements iComponent
* *
* @return bool * @return bool
*/ */
public function isEnabled(): bool public static function isEnabled(): bool
{ {
return $this->enableTracy; return self::$enableTracy;
} }
} }