@@ -8,21 +8,21 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | abstract class Utils { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Retorna o SQL Formatado e Destacado |
|
| 13 | - * |
|
| 14 | - * @param String $query |
|
| 15 | - */ |
|
| 16 | - public static function dump_sql($query) { |
|
| 11 | + /** |
|
| 12 | + * Retorna o SQL Formatado e Destacado |
|
| 13 | + * |
|
| 14 | + * @param String $query |
|
| 15 | + */ |
|
| 16 | + public static function dump_sql($query) { |
|
| 17 | 17 | echo SqlFormatter::format($query); |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public static function kill() { |
|
| 20 | + public static function kill() { |
|
| 21 | 21 | call_user_func_array("dump", func_get_args()); |
| 22 | 22 | die("\nFIM\n"); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public static function dump() { |
|
| 25 | + public static function dump() { |
|
| 26 | 26 | return call_user_func_array("dump", func_get_args()); |
| 27 | - } |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -2,57 +2,57 @@ |
||
| 2 | 2 | |
| 3 | 3 | class DebugArray extends \ArrayObject { |
| 4 | 4 | |
| 5 | - const TYPE_GET = 'GET'; |
|
| 6 | - const TYPE_SET = 'SET'; |
|
| 7 | - const TYPE_EXISTS = 'EXISTS'; |
|
| 8 | - const TYPE_UNSET = 'UNSET'; |
|
| 5 | + const TYPE_GET = 'GET'; |
|
| 6 | + const TYPE_SET = 'SET'; |
|
| 7 | + const TYPE_EXISTS = 'EXISTS'; |
|
| 8 | + const TYPE_UNSET = 'UNSET'; |
|
| 9 | 9 | |
| 10 | - private $logger; |
|
| 10 | + private $logger; |
|
| 11 | 11 | |
| 12 | - public function __construct() { |
|
| 12 | + public function __construct() { |
|
| 13 | 13 | |
| 14 | 14 | $this->logger = function($type, $key, $value = null, array $backtrace ) { |
| 15 | 15 | |
| 16 | - $log = $type.' | Key: '.$key; |
|
| 16 | + $log = $type.' | Key: '.$key; |
|
| 17 | 17 | |
| 18 | - if ($type === static::TYPE_SET) { |
|
| 18 | + if ($type === static::TYPE_SET) { |
|
| 19 | 19 | $log .= ' -> Value:' . $value; |
| 20 | - } |
|
| 21 | - dump($log, $backtrace); |
|
| 20 | + } |
|
| 21 | + dump($log, $backtrace); |
|
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | return call_user_func_array('parent::__construct', func_get_args()); |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function setLogger(\Closure $logger) { |
|
| 27 | + public function setLogger(\Closure $logger) { |
|
| 28 | 28 | $this->logger = $logger; |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function offsetGet($name) { |
|
| 31 | + public function offsetGet($name) { |
|
| 32 | 32 | |
| 33 | 33 | $logger = $this->logger; |
| 34 | 34 | $logger(static::TYPE_GET, $name, null, debug_backtrace()); |
| 35 | 35 | return call_user_func_array('parent::offsetGet', func_get_args()); |
| 36 | - } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function offsetSet($name, $value) { |
|
| 38 | + public function offsetSet($name, $value) { |
|
| 39 | 39 | |
| 40 | 40 | $logger = $this->logger; |
| 41 | 41 | $logger(static::TYPE_SET, $name, $value, debug_backtrace()); |
| 42 | 42 | return call_user_func_array('parent::offsetSet', func_get_args()); |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function offsetExists($name) { |
|
| 45 | + public function offsetExists($name) { |
|
| 46 | 46 | |
| 47 | 47 | $logger = $this->logger; |
| 48 | 48 | $logger(static::TYPE_EXISTS, $name, null, debug_backtrace()); |
| 49 | 49 | return call_user_func_array('parent::offsetExists', func_get_args()); |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function offsetUnset($name) { |
|
| 52 | + public function offsetUnset($name) { |
|
| 53 | 53 | |
| 54 | 54 | $logger = $this->logger; |
| 55 | 55 | $logger(static::TYPE_UNSET, $name, null, debug_backtrace()); |
| 56 | 56 | return call_user_func_array('parent::offsetUnset', func_get_args()); |
| 57 | - } |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -11,9 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function __construct() { |
| 13 | 13 | |
| 14 | - $this->logger = function($type, $key, $value = null, array $backtrace ) { |
|
| 14 | + $this->logger = function($type, $key, $value = null, array $backtrace) { |
|
| 15 | 15 | |
| 16 | - $log = $type.' | Key: '.$key; |
|
| 16 | + $log = $type . ' | Key: ' . $key; |
|
| 17 | 17 | |
| 18 | 18 | if ($type === static::TYPE_SET) { |
| 19 | 19 | $log .= ' -> Value:' . $value; |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function kill() { |
| 4 | - return call_user_func_array("\\PHP\\Utils::kill", func_get_args()); |
|
| 4 | + return call_user_func_array("\\PHP\\Utils::kill", func_get_args()); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | function dump_sql($sSql) { |
| 8 | - return \PHP\Utils::dump_sql($sSql); |
|
| 8 | + return \PHP\Utils::dump_sql($sSql); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | function kill_sql($sSql) { |
| 12 | 12 | |
| 13 | - \PHP\Utils::dump_sql($sSql); |
|
| 14 | - die("FIM SQL"); |
|
| 13 | + \PHP\Utils::dump_sql($sSql); |
|
| 14 | + die("FIM SQL"); |
|
| 15 | 15 | } |
@@ -3,26 +3,26 @@ |
||
| 3 | 3 | |
| 4 | 4 | class Log { |
| 5 | 5 | |
| 6 | - private static $oInstance; |
|
| 6 | + private static $oInstance; |
|
| 7 | 7 | |
| 8 | - private $oLogger; |
|
| 8 | + private $oLogger; |
|
| 9 | 9 | |
| 10 | - private function __construct() { |
|
| 10 | + private function __construct() { |
|
| 11 | 11 | |
| 12 | 12 | $this->oLogger = new \Monolog\Logger("PHPUtils"); |
| 13 | 13 | $this->oLogger->pushHandler( new \Monolog\Handler\StreamHandler("/tmp/PHPUtils.log") ); |
| 14 | 14 | $this->oLogger->pushHandler( new \Monolog\Handler\ChromePHPHandler() ); |
| 15 | 15 | $this->oLogger->pushHandler( new \Monolog\Handler\FirePHPHandler() ); |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function log() {} |
|
| 18 | + public function log() {} |
|
| 19 | 19 | |
| 20 | - public function debug() { } |
|
| 20 | + public function debug() { } |
|
| 21 | 21 | |
| 22 | - public function warn() { } |
|
| 22 | + public function warn() { } |
|
| 23 | 23 | |
| 24 | - public function info() { } |
|
| 24 | + public function info() { } |
|
| 25 | 25 | |
| 26 | - public function error() { } |
|
| 26 | + public function error() { } |
|
| 27 | 27 | |
| 28 | 28 | } |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | private function __construct() { |
| 11 | 11 | |
| 12 | 12 | $this->oLogger = new \Monolog\Logger("PHPUtils"); |
| 13 | - $this->oLogger->pushHandler( new \Monolog\Handler\StreamHandler("/tmp/PHPUtils.log") ); |
|
| 14 | - $this->oLogger->pushHandler( new \Monolog\Handler\ChromePHPHandler() ); |
|
| 15 | - $this->oLogger->pushHandler( new \Monolog\Handler\FirePHPHandler() ); |
|
| 13 | + $this->oLogger->pushHandler(new \Monolog\Handler\StreamHandler("/tmp/PHPUtils.log")); |
|
| 14 | + $this->oLogger->pushHandler(new \Monolog\Handler\ChromePHPHandler()); |
|
| 15 | + $this->oLogger->pushHandler(new \Monolog\Handler\FirePHPHandler()); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function log() {} |