This repository has been archived by the owner on Jan 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from apility/release/1.0.11
Release/1.0.11
- Loading branch information
Showing
7 changed files
with
203 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace Netflex\Site; | ||
|
||
use PhpConsole\Handler; | ||
|
||
class Console { | ||
/** @var Handler */ | ||
private $handler; | ||
|
||
/** @var static */ | ||
private static $instance; | ||
|
||
protected function __construct() | ||
{ | ||
if (getenv('ENV') !== 'master') { | ||
$this->handler = Handler::getInstance();; | ||
$this->handler->getConnector()->setSourcesBasePath($_SERVER['DOCUMENT_ROOT']); | ||
$this->handler->start(); | ||
} | ||
} | ||
|
||
/** | ||
* Instantiates a Console instance | ||
* | ||
* @return Console | ||
*/ | ||
public static function getInstance () { | ||
if (!self::$instance) { | ||
self::$instance = new static; | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* Logs the text to console (if not in production) | ||
* | ||
* @param string $text | ||
* @param string $labels One or more labels separated by . | ||
* @return void | ||
*/ | ||
public function log ($text, $labels = null) { | ||
if ($this->handler) { | ||
$this->handler->debug($text, $labels); | ||
} | ||
} | ||
|
||
/** | ||
* @deprecated 1.0.11 | ||
* | ||
* @param string $text | ||
* @param string $label | ||
* @return void | ||
*/ | ||
public function debug ($text, $label) | ||
{ | ||
trigger_error('NF::$console->debug is deprecated', E_USER_DEPRECATED); | ||
return $this->log($text, $label); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.