@@ -79,8 +79,8 @@ |
||
| 79 | 79 | <html> |
| 80 | 80 | <body> |
| 81 | 81 | <h1>Logger - Example</h1> |
| 82 | - <p><?php echo $strMessage;?></p> |
|
| 83 | - <p><?php echo $strLink;?></p> |
|
| 82 | + <p><?php echo $strMessage; ?></p> |
|
| 83 | + <p><?php echo $strLink; ?></p> |
|
| 84 | 84 | <form action="XLogTest.php" method="get"> |
| 85 | 85 | <label for="logger">Output to:</label> |
| 86 | 86 | <select name="logger" id ="logger"> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace SKien\XLogger; |
| 5 | 5 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function openLogfile() : void |
| 122 | 122 | { |
| 123 | - if (!$this->xmlDoc || !$this->xmlRoot) { |
|
| 123 | + if (!$this->xmlDoc || !$this->xmlRoot) { |
|
| 124 | 124 | $strFullPath = $this->getFullpath(); |
| 125 | 125 | if (!file_exists($strFullPath)) { |
| 126 | 126 | $this->createLogfile(); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param \DOMElement $oParent |
| 176 | 176 | * @return \DOMElement |
| 177 | 177 | */ |
| 178 | - public function addChildToDoc(string $strName, string $strValue='', \DOMElement $oParent=null) : ?\DOMElement |
|
| 178 | + public function addChildToDoc(string $strName, string $strValue = '', \DOMElement $oParent = null) : ?\DOMElement |
|
| 179 | 179 | { |
| 180 | 180 | $oChild = null; |
| 181 | 181 | if ($this->xmlDoc) { |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | ChromePhp::log($strMessage); |
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | - if (count($context) >0) { |
|
| 73 | + if (count($context) > 0) { |
|
| 74 | 74 | ChromePhp::group(); |
| 75 | 75 | foreach ($context as $key => $value) { |
| 76 | 76 | // only add, if not included as placeholder in the mesage |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // timestamp |
| 77 | - $strLine = date('Y-m-d H:i:s'); |
|
| 77 | + $strLine = date('Y-m-d H:i:s'); |
|
| 78 | 78 | // IP adress |
| 79 | - if (($this->iOptions & self::LOG_IP) != 0 ) { |
|
| 79 | + if (($this->iOptions & self::LOG_IP) != 0) { |
|
| 80 | 80 | $strIP = $_SERVER['REMOTE_ADDR']; |
| 81 | 81 | if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
| 82 | 82 | $strIP = $_SERVER['HTTP_X_FORWARDED_FOR']; |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | $strLine .= $this->strSep . $strIP; |
| 85 | 85 | } |
| 86 | 86 | // user |
| 87 | - if (($this->iOptions & self::LOG_USER) != 0 ) { |
|
| 87 | + if (($this->iOptions & self::LOG_USER) != 0) { |
|
| 88 | 88 | $strLine .= $this->strSep . $this->prepareText($this->strUser); |
| 89 | 89 | } |
| 90 | 90 | // backtrace - caller |
| 91 | - if (($this->iOptions & self::LOG_BT) != 0 ) { |
|
| 91 | + if (($this->iOptions & self::LOG_BT) != 0) { |
|
| 92 | 92 | $strLine .= $this->strSep . $this->getCaller(); |
| 93 | 93 | } |
| 94 | 94 | // the message |
| 95 | 95 | $strMessage = $this->replaceContext($message, $context); |
| 96 | 96 | $strLine .= $this->strSep . $this->prepareText(strtoupper($level) . ': ' . $strMessage); |
| 97 | 97 | // user agent |
| 98 | - if (($this->iOptions & self::LOG_BT) != 0 ) { |
|
| 98 | + if (($this->iOptions & self::LOG_BT) != 0) { |
|
| 99 | 99 | $strLine .= $this->strSep . $this->prepareText($_SERVER["HTTP_USER_AGENT"]); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | case 'csv': |
| 121 | 121 | case 'txt': |
| 122 | 122 | $this->strSep = ";"; |
| 123 | - $this->strReplace =","; |
|
| 123 | + $this->strReplace = ","; |
|
| 124 | 124 | break; |
| 125 | 125 | case 'log': |
| 126 | 126 | default: |
| 127 | 127 | $this->strSep = "\t"; |
| 128 | - $this->strReplace =" "; |
|
| 128 | + $this->strReplace = " "; |
|
| 129 | 129 | break; |
| 130 | 130 | } |
| 131 | 131 | $this->logfile = fopen($strFullPath, 'a'); |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | $this->fb->log($strMessage); |
| 81 | 81 | break; |
| 82 | 82 | } |
| 83 | - if (count($context) >0) { |
|
| 83 | + if (count($context) > 0) { |
|
| 84 | 84 | // $this->fb->group('context'); |
| 85 | 85 | foreach ($context as $key => $value) { |
| 86 | 86 | // only add, if not included as placeholder in the mesage |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | if ($aCaller) { |
| 205 | 205 | // the base path on server isn't from interest.. |
| 206 | 206 | $strFile = str_replace($_SERVER['DOCUMENT_ROOT'], '', $aCaller['file']); |
| 207 | - $strCaller = $strFile . ' ('.$aCaller['line'].')'; |
|
| 207 | + $strCaller = $strFile . ' (' . $aCaller['line'] . ')'; |
|
| 208 | 208 | } |
| 209 | 209 | return $strCaller; |
| 210 | 210 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | spl_autoload_register(function($strClassName) |
| 3 | 3 | { |
| 4 | 4 | $strInclude = ''; |
| 5 | - if( substr( $strClassName, 0, 5 ) == 'Table' ) { |
|
| 5 | + if (substr($strClassName, 0, 5) == 'Table') { |
|
| 6 | 6 | $strClassName = str_replace('Table', 't', $strClassName); |
| 7 | 7 | $strInclude = 'common/dbdesign/' . $strClassName . '.php'; |
| 8 | 8 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | public function setEnabled($enabled) |
| 335 | 335 | { |
| 336 | - $this->enabled = $enabled; |
|
| 336 | + $this->enabled = $enabled; |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -592,13 +592,13 @@ discard block |
||
| 592 | 592 | { |
| 593 | 593 | if ($this->convertAssertionErrorsToExceptions) { |
| 594 | 594 | |
| 595 | - $exception = new \ErrorException('Assertion Failed - Code[ ' . $code . ' ]', 0, null, $file, $line); |
|
| 595 | + $exception = new \ErrorException('Assertion Failed - Code[ ' . $code . ' ]', 0, null, $file, $line); |
|
| 596 | 596 | |
| 597 | - if ($this->throwAssertionExceptions) { |
|
| 598 | - throw $exception; |
|
| 599 | - } else { |
|
| 600 | - $this->fb($exception); |
|
| 601 | - } |
|
| 597 | + if ($this->throwAssertionExceptions) { |
|
| 598 | + throw $exception; |
|
| 599 | + } else { |
|
| 600 | + $this->fb($exception); |
|
| 601 | + } |
|
| 602 | 602 | |
| 603 | 603 | } else { |
| 604 | 604 | $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File' => $file, 'Line' => $line)); |
@@ -1277,12 +1277,12 @@ discard block |
||
| 1277 | 1277 | if (count($parts) > 2) { |
| 1278 | 1278 | // Message needs to be split into multiple parts |
| 1279 | 1279 | $this->setHeader('X-Wf-1-' . $structureIndex . '-' . '1-' . $this->messageIndex, |
| 1280 | - (($i == 0) ? strlen($msg) : '') |
|
| 1281 | - . '|' . $part . '|' |
|
| 1282 | - . (($i < count($parts) - 2) ? '\\' : '')); |
|
| 1280 | + (($i == 0) ? strlen($msg) : '') |
|
| 1281 | + . '|' . $part . '|' |
|
| 1282 | + . (($i < count($parts) - 2) ? '\\' : '')); |
|
| 1283 | 1283 | } else { |
| 1284 | 1284 | $this->setHeader('X-Wf-1-' . $structureIndex . '-' . '1-' . $this->messageIndex, |
| 1285 | - strlen($part) . '|' . $part . '|'); |
|
| 1285 | + strlen($part) . '|' . $part . '|'); |
|
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | $this->messageIndex++; |
@@ -1680,12 +1680,12 @@ discard block |
||
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | 1682 | } elseif ( is_bool($object) ) { |
| 1683 | - return $object; |
|
| 1684 | - } elseif ( is_null($object) ) { |
|
| 1685 | - return $object; |
|
| 1686 | - } elseif ( is_numeric($object) ) { |
|
| 1687 | - return $object; |
|
| 1688 | - } else { |
|
| 1683 | + return $object; |
|
| 1684 | + } elseif ( is_null($object) ) { |
|
| 1685 | + return $object; |
|
| 1686 | + } elseif ( is_numeric($object) ) { |
|
| 1687 | + return $object; |
|
| 1688 | + } else { |
|
| 1689 | 1689 | if ($this->is_utf8($object)) { |
| 1690 | 1690 | return $object; |
| 1691 | 1691 | } else { |
@@ -1798,17 +1798,17 @@ discard block |
||
| 1798 | 1798 | private $json_objectStack = array(); |
| 1799 | 1799 | |
| 1800 | 1800 | |
| 1801 | - /** |
|
| 1802 | - * convert a string from one UTF-8 char to one UTF-16 char |
|
| 1803 | - * |
|
| 1804 | - * Normally should be handled by mb_convert_encoding, but |
|
| 1805 | - * provides a slower PHP-only method for installations |
|
| 1806 | - * that lack the multibye string extension. |
|
| 1807 | - * |
|
| 1808 | - * @param string $utf8 UTF-8 character |
|
| 1809 | - * @return string UTF-16 character |
|
| 1810 | - * @access private |
|
| 1811 | - */ |
|
| 1801 | + /** |
|
| 1802 | + * convert a string from one UTF-8 char to one UTF-16 char |
|
| 1803 | + * |
|
| 1804 | + * Normally should be handled by mb_convert_encoding, but |
|
| 1805 | + * provides a slower PHP-only method for installations |
|
| 1806 | + * that lack the multibye string extension. |
|
| 1807 | + * |
|
| 1808 | + * @param string $utf8 UTF-8 character |
|
| 1809 | + * @return string UTF-16 character |
|
| 1810 | + * @access private |
|
| 1811 | + */ |
|
| 1812 | 1812 | private function json_utf82utf16($utf8) |
| 1813 | 1813 | { |
| 1814 | 1814 | // oh please oh please oh please oh please oh please |
@@ -1826,33 +1826,33 @@ discard block |
||
| 1826 | 1826 | // return a UTF-16 character from a 2-byte UTF-8 char |
| 1827 | 1827 | // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
| 1828 | 1828 | return chr(0x07 & (ord($utf8[0]) >> 2)) |
| 1829 | - . chr((0xC0 & (ord($utf8[0]) << 6)) |
|
| 1830 | - | (0x3F & ord($utf8[1]))); |
|
| 1829 | + . chr((0xC0 & (ord($utf8[0]) << 6)) |
|
| 1830 | + | (0x3F & ord($utf8[1]))); |
|
| 1831 | 1831 | |
| 1832 | 1832 | case 3: |
| 1833 | 1833 | // return a UTF-16 character from a 3-byte UTF-8 char |
| 1834 | 1834 | // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
| 1835 | 1835 | return chr((0xF0 & (ord($utf8[0]) << 4)) |
| 1836 | - | (0x0F & (ord($utf8[1]) >> 2))) |
|
| 1837 | - . chr((0xC0 & (ord($utf8[1]) << 6)) |
|
| 1838 | - | (0x7F & ord($utf8[2]))); |
|
| 1836 | + | (0x0F & (ord($utf8[1]) >> 2))) |
|
| 1837 | + . chr((0xC0 & (ord($utf8[1]) << 6)) |
|
| 1838 | + | (0x7F & ord($utf8[2]))); |
|
| 1839 | 1839 | } |
| 1840 | 1840 | |
| 1841 | 1841 | // ignoring UTF-32 for now, sorry |
| 1842 | 1842 | return ''; |
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | - /** |
|
| 1846 | - * encodes an arbitrary variable into JSON format |
|
| 1847 | - * |
|
| 1848 | - * @param mixed $var any number, boolean, string, array, or object to be encoded. |
|
| 1849 | - * see argument 1 to Services_JSON() above for array-parsing behavior. |
|
| 1850 | - * if var is a strng, note that encode() always expects it |
|
| 1851 | - * to be in ASCII or UTF-8 format! |
|
| 1852 | - * |
|
| 1853 | - * @return mixed JSON string representation of input var or an error if a problem occurs |
|
| 1854 | - * @access public |
|
| 1855 | - */ |
|
| 1845 | + /** |
|
| 1846 | + * encodes an arbitrary variable into JSON format |
|
| 1847 | + * |
|
| 1848 | + * @param mixed $var any number, boolean, string, array, or object to be encoded. |
|
| 1849 | + * see argument 1 to Services_JSON() above for array-parsing behavior. |
|
| 1850 | + * if var is a strng, note that encode() always expects it |
|
| 1851 | + * to be in ASCII or UTF-8 format! |
|
| 1852 | + * |
|
| 1853 | + * @return mixed JSON string representation of input var or an error if a problem occurs |
|
| 1854 | + * @access public |
|
| 1855 | + */ |
|
| 1856 | 1856 | private function json_encode($var) |
| 1857 | 1857 | { |
| 1858 | 1858 | if (is_object($var)) { |
@@ -1880,7 +1880,7 @@ discard block |
||
| 1880 | 1880 | $ascii = ''; |
| 1881 | 1881 | $strlen_var = strlen($var); |
| 1882 | 1882 | |
| 1883 | - /* |
|
| 1883 | + /* |
|
| 1884 | 1884 | * Iterate over every character in the string, |
| 1885 | 1885 | * escaping with a slash or encoding to UTF-8 where necessary |
| 1886 | 1886 | */ |
@@ -1930,8 +1930,8 @@ discard block |
||
| 1930 | 1930 | // characters U-00000800 - U-0000FFFF, mask 1110XXXX |
| 1931 | 1931 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
| 1932 | 1932 | $char = pack('C*', $ord_var_c, |
| 1933 | - ord($var[$c + 1]), |
|
| 1934 | - ord($var[$c + 2])); |
|
| 1933 | + ord($var[$c + 1]), |
|
| 1934 | + ord($var[$c + 2])); |
|
| 1935 | 1935 | $c += 2; |
| 1936 | 1936 | $utf16 = $this->json_utf82utf16($char); |
| 1937 | 1937 | $ascii .= sprintf('\u%04s', bin2hex($utf16)); |
@@ -1941,9 +1941,9 @@ discard block |
||
| 1941 | 1941 | // characters U-00010000 - U-001FFFFF, mask 11110XXX |
| 1942 | 1942 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
| 1943 | 1943 | $char = pack('C*', $ord_var_c, |
| 1944 | - ord($var[$c + 1]), |
|
| 1945 | - ord($var[$c + 2]), |
|
| 1946 | - ord($var[$c + 3])); |
|
| 1944 | + ord($var[$c + 1]), |
|
| 1945 | + ord($var[$c + 2]), |
|
| 1946 | + ord($var[$c + 3])); |
|
| 1947 | 1947 | $c += 3; |
| 1948 | 1948 | $utf16 = $this->json_utf82utf16($char); |
| 1949 | 1949 | $ascii .= sprintf('\u%04s', bin2hex($utf16)); |
@@ -1953,10 +1953,10 @@ discard block |
||
| 1953 | 1953 | // characters U-00200000 - U-03FFFFFF, mask 111110XX |
| 1954 | 1954 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
| 1955 | 1955 | $char = pack('C*', $ord_var_c, |
| 1956 | - ord($var[$c + 1]), |
|
| 1957 | - ord($var[$c + 2]), |
|
| 1958 | - ord($var[$c + 3]), |
|
| 1959 | - ord($var[$c + 4])); |
|
| 1956 | + ord($var[$c + 1]), |
|
| 1957 | + ord($var[$c + 2]), |
|
| 1958 | + ord($var[$c + 3]), |
|
| 1959 | + ord($var[$c + 4])); |
|
| 1960 | 1960 | $c += 4; |
| 1961 | 1961 | $utf16 = $this->json_utf82utf16($char); |
| 1962 | 1962 | $ascii .= sprintf('\u%04s', bin2hex($utf16)); |
@@ -1966,11 +1966,11 @@ discard block |
||
| 1966 | 1966 | // characters U-04000000 - U-7FFFFFFF, mask 1111110X |
| 1967 | 1967 | // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 |
| 1968 | 1968 | $char = pack('C*', $ord_var_c, |
| 1969 | - ord($var[$c + 1]), |
|
| 1970 | - ord($var[$c + 2]), |
|
| 1971 | - ord($var[$c + 3]), |
|
| 1972 | - ord($var[$c + 4]), |
|
| 1973 | - ord($var[$c + 5])); |
|
| 1969 | + ord($var[$c + 1]), |
|
| 1970 | + ord($var[$c + 2]), |
|
| 1971 | + ord($var[$c + 3]), |
|
| 1972 | + ord($var[$c + 4]), |
|
| 1973 | + ord($var[$c + 5])); |
|
| 1974 | 1974 | $c += 5; |
| 1975 | 1975 | $utf16 = $this->json_utf82utf16($char); |
| 1976 | 1976 | $ascii .= sprintf('\u%04s', bin2hex($utf16)); |
@@ -2058,15 +2058,15 @@ discard block |
||
| 2058 | 2058 | } |
| 2059 | 2059 | } |
| 2060 | 2060 | |
| 2061 | - /** |
|
| 2062 | - * array-walking function for use in generating JSON-formatted name-value pairs |
|
| 2063 | - * |
|
| 2064 | - * @param string $name name of key to use |
|
| 2065 | - * @param mixed $value reference to an array element to be encoded |
|
| 2066 | - * |
|
| 2067 | - * @return string JSON-formatted name-value pair, like '"name":value' |
|
| 2068 | - * @access private |
|
| 2069 | - */ |
|
| 2061 | + /** |
|
| 2062 | + * array-walking function for use in generating JSON-formatted name-value pairs |
|
| 2063 | + * |
|
| 2064 | + * @param string $name name of key to use |
|
| 2065 | + * @param mixed $value reference to an array element to be encoded |
|
| 2066 | + * |
|
| 2067 | + * @return string JSON-formatted name-value pair, like '"name":value' |
|
| 2068 | + * @access private |
|
| 2069 | + */ |
|
| 2070 | 2070 | private function json_name_value($name, $value) |
| 2071 | 2071 | { |
| 2072 | 2072 | // Encoding the $GLOBALS PHP array causes an infinite loop |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @var string |
| 76 | 76 | */ |
| 77 | - const VERSION = '0.3'; // @pinf replace '0.3' with '%%VERSION%%' |
|
| 77 | + const VERSION = '0.3'; // @pinf replace '0.3' with '%%VERSION%%' |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Firebug LOG level |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | protected $logToInsightConsole = null; |
| 258 | 258 | |
| 259 | - function __construct () |
|
| 259 | + function __construct() |
|
| 260 | 260 | { |
| 261 | 261 | $this->ignoredInTraces['paths'][__DIR__] = true; |
| 262 | 262 | $this->ignoredInTraces['paths'][__FILE__] = true; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * |
| 366 | 366 | * @param string $class The class name to ignore |
| 367 | 367 | */ |
| 368 | - public function ignoreClassInTraces ($class) |
|
| 368 | + public function ignoreClassInTraces($class) |
|
| 369 | 369 | { |
| 370 | 370 | $this->ignoredInTraces['classes'][$class] = true; |
| 371 | 371 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * |
| 376 | 376 | * @param string $path The path prefix to ignore |
| 377 | 377 | */ |
| 378 | - public function ignorePathInTraces ($path) |
|
| 378 | + public function ignorePathInTraces($path) |
|
| 379 | 379 | { |
| 380 | 380 | $this->ignoredInTraces['paths'][$path] = true; |
| 381 | 381 | } |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | * |
| 811 | 811 | * @param string $trace A debug_backtrace() trace |
| 812 | 812 | */ |
| 813 | - protected function filterDebugBacktrace ($trace, $offset = 0) { |
|
| 813 | + protected function filterDebugBacktrace($trace, $offset = 0) { |
|
| 814 | 814 | $discardedTrace = array(); |
| 815 | 815 | $filteredTrace = array(); |
| 816 | 816 | for ($i = 0; $i < sizeof($trace); $i++) { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | isset($this->ignoredInTraces['classes'][$trace[$i]['class']]) || |
| 822 | 822 | array_reduce( |
| 823 | 823 | array_keys($this->ignoredInTraces['classes']), |
| 824 | - function ($carry, $class) use ($trace, $i) |
|
| 824 | + function($carry, $class) use ($trace, $i) |
|
| 825 | 825 | { |
| 826 | 826 | if (strpos($trace[$i]['class'], $class) === 0) { |
| 827 | 827 | $carry += 1; |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | isset($this->ignoredInTraces['paths'][$trace[$i]['file']]) || |
| 843 | 843 | array_reduce( |
| 844 | 844 | array_keys($this->ignoredInTraces['paths']), |
| 845 | - function ($carry, $path) use ($trace, $i) |
|
| 845 | + function($carry, $path) use ($trace, $i) |
|
| 846 | 846 | { |
| 847 | 847 | if (strpos($trace[$i]['file'], $path) === 0) { |
| 848 | 848 | $carry += 1; |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | array_push($filteredTrace, $trace[$i]); |
| 860 | 860 | } |
| 861 | 861 | if ($offset < 0) { |
| 862 | - for ($i = sizeof($discardedTrace) -1; $i >= ($offset * -1); $i--) { |
|
| 862 | + for ($i = sizeof($discardedTrace) - 1; $i >= ($offset * -1); $i--) { |
|
| 863 | 863 | array_unshift($filteredTrace, $discardedTrace[$i]); |
| 864 | 864 | } |
| 865 | 865 | } |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | |
| 937 | 937 | // Get folder name where firephp is located. |
| 938 | 938 | $parentFolder = basename(dirname(__FILE__)); |
| 939 | - $parentFolderLength = strlen( $parentFolder ); |
|
| 939 | + $parentFolderLength = strlen($parentFolder); |
|
| 940 | 940 | $fbLength = 7 + $parentFolderLength; |
| 941 | 941 | $fireClassLength = 18 + $parentFolderLength; |
| 942 | 942 | |
@@ -951,16 +951,16 @@ discard block |
||
| 951 | 951 | } |
| 952 | 952 | if (isset($trace[$i]['file'])) { |
| 953 | 953 | $path = $this->_standardizePath($trace[$i]['file']); |
| 954 | - if (substr($path, -1*$fbLength, $fbLength) == $parentFolder.'/fb.php' || substr($path, -1*$fireClassLength, $fireClassLength) == $parentFolder.'/FirePHP.class.php') { |
|
| 954 | + if (substr($path, -1 * $fbLength, $fbLength) == $parentFolder . '/fb.php' || substr($path, -1 * $fireClassLength, $fireClassLength) == $parentFolder . '/FirePHP.class.php') { |
|
| 955 | 955 | continue; |
| 956 | 956 | } |
| 957 | 957 | } |
| 958 | 958 | if (isset($trace[$i]['function']) && $trace[$i]['function'] == 'fb' && |
| 959 | - isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { |
|
| 959 | + isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -1 * $fbLength, $fbLength) == $parentFolder . '/fb.php') { |
|
| 960 | 960 | continue; |
| 961 | 961 | } |
| 962 | 962 | if (isset($trace[$i]['class']) && $trace[$i]['class'] == 'FB' && |
| 963 | - isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -1*$fbLength, $fbLength) == $parentFolder.'/fb.php') { |
|
| 963 | + isset($trace[$i - 1]['file']) && substr($this->_standardizePath($trace[$i - 1]['file']), -1 * $fbLength, $fbLength) == $parentFolder . '/fb.php') { |
|
| 964 | 964 | continue; |
| 965 | 965 | } |
| 966 | 966 | break; |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | |
| 1208 | 1208 | if ($this->options['includeLineNumbers']) { |
| 1209 | 1209 | if (!isset($meta['file']) || !isset($meta['line'])) { |
| 1210 | - $trace = $this->filterDebugBacktrace(debug_backtrace()); // ??? why?... don't work correctly anyway.... , -1); |
|
| 1210 | + $trace = $this->filterDebugBacktrace(debug_backtrace()); // ??? why?... don't work correctly anyway.... , -1); |
|
| 1211 | 1211 | $encounteredCount = 0; |
| 1212 | 1212 | for ($i = 0; $trace && $i < sizeof($trace); $i++) { |
| 1213 | 1213 | if ( |
@@ -1511,7 +1511,7 @@ discard block |
||
| 1511 | 1511 | //#2801 is_resource reports false for closed resources https://bugs.php.net/bug.php?id=28016 |
| 1512 | 1512 | if (is_resource($object) || gettype($object) === "unknown type") { |
| 1513 | 1513 | |
| 1514 | - return '** ' . (string) $object . ' **'; |
|
| 1514 | + return '** ' . (string)$object . ' **'; |
|
| 1515 | 1515 | |
| 1516 | 1516 | } else if (is_object($object)) { |
| 1517 | 1517 | |
@@ -1679,11 +1679,11 @@ discard block |
||
| 1679 | 1679 | return '** Max Depth (' . $maxDepth . ') **'; |
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | - } elseif ( is_bool($object) ) { |
|
| 1682 | + } elseif (is_bool($object)) { |
|
| 1683 | 1683 | return $object; |
| 1684 | - } elseif ( is_null($object) ) { |
|
| 1684 | + } elseif (is_null($object)) { |
|
| 1685 | 1685 | return $object; |
| 1686 | - } elseif ( is_numeric($object) ) { |
|
| 1686 | + } elseif (is_numeric($object)) { |
|
| 1687 | 1687 | return $object; |
| 1688 | 1688 | } else { |
| 1689 | 1689 | if ($this->is_utf8($object)) { |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | elseif ($c >= 192) $bits = 2; |
| 1725 | 1725 | else return false; |
| 1726 | 1726 | if (($i + $bits) > $len) return false; |
| 1727 | - while($bits > 1) { |
|
| 1727 | + while ($bits > 1) { |
|
| 1728 | 1728 | $i++; |
| 1729 | 1729 | $b = ord($str[$i]); |
| 1730 | 1730 | if ($b < 128 || $b > 191) return false; |
@@ -1869,11 +1869,11 @@ discard block |
||
| 1869 | 1869 | return 'null'; |
| 1870 | 1870 | |
| 1871 | 1871 | case 'integer': |
| 1872 | - return (int) $var; |
|
| 1872 | + return (int)$var; |
|
| 1873 | 1873 | |
| 1874 | 1874 | case 'double': |
| 1875 | 1875 | case 'float': |
| 1876 | - return (float) $var; |
|
| 1876 | + return (float)$var; |
|
| 1877 | 1877 | |
| 1878 | 1878 | case 'string': |
| 1879 | 1879 | // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT |
@@ -942,7 +942,9 @@ discard block |
||
| 942 | 942 | |
| 943 | 943 | if ($this->logToInsightConsole !== null && (get_class($this) == 'FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) { |
| 944 | 944 | $trace = debug_backtrace(); |
| 945 | - if (!$trace) return false; |
|
| 945 | + if (!$trace) { |
|
| 946 | + return false; |
|
| 947 | + } |
|
| 946 | 948 | for ($i = 0; $i < sizeof($trace); $i++) { |
| 947 | 949 | if (isset($trace[$i]['class'])) { |
| 948 | 950 | if ($trace[$i]['class'] == 'FirePHP' || $trace[$i]['class'] == 'FB') { |
@@ -1317,7 +1319,9 @@ discard block |
||
| 1317 | 1319 | */ |
| 1318 | 1320 | protected function _escapeTrace($trace, $options = array()) |
| 1319 | 1321 | { |
| 1320 | - if (!$trace) return $trace; |
|
| 1322 | + if (!$trace) { |
|
| 1323 | + return $trace; |
|
| 1324 | + } |
|
| 1321 | 1325 | for ($i = 0; $i < sizeof($trace); $i++) { |
| 1322 | 1326 | if (isset($trace[$i]['file'])) { |
| 1323 | 1327 | $trace[$i]['file'] = $this->_escapeTraceFile($trace[$i]['file']); |
@@ -1377,7 +1381,9 @@ discard block |
||
| 1377 | 1381 | */ |
| 1378 | 1382 | protected function getUserAgent() |
| 1379 | 1383 | { |
| 1380 | - if (!isset($_SERVER['HTTP_USER_AGENT'])) return false; |
|
| 1384 | + if (!isset($_SERVER['HTTP_USER_AGENT'])) { |
|
| 1385 | + return false; |
|
| 1386 | + } |
|
| 1381 | 1387 | return $_SERVER['HTTP_USER_AGENT']; |
| 1382 | 1388 | } |
| 1383 | 1389 | |
@@ -1464,7 +1470,9 @@ discard block |
||
| 1464 | 1470 | */ |
| 1465 | 1471 | protected function encodeTable($table, $options = array()) |
| 1466 | 1472 | { |
| 1467 | - if (!$table) return $table; |
|
| 1473 | + if (!$table) { |
|
| 1474 | + return $table; |
|
| 1475 | + } |
|
| 1468 | 1476 | |
| 1469 | 1477 | $newTable = array(); |
| 1470 | 1478 | foreach ($table as $row) { |
@@ -1716,18 +1724,30 @@ discard block |
||
| 1716 | 1724 | for ($i = 0; $i < $len; $i++) { |
| 1717 | 1725 | $c = ord($str[$i]); |
| 1718 | 1726 | if ($c > 128) { |
| 1719 | - if (($c >= 254)) return false; |
|
| 1720 | - elseif ($c >= 252) $bits = 6; |
|
| 1721 | - elseif ($c >= 248) $bits = 5; |
|
| 1722 | - elseif ($c >= 240) $bits = 4; |
|
| 1723 | - elseif ($c >= 224) $bits = 3; |
|
| 1724 | - elseif ($c >= 192) $bits = 2; |
|
| 1725 | - else return false; |
|
| 1726 | - if (($i + $bits) > $len) return false; |
|
| 1727 | + if (($c >= 254)) { |
|
| 1728 | + return false; |
|
| 1729 | + } elseif ($c >= 252) { |
|
| 1730 | + $bits = 6; |
|
| 1731 | + } elseif ($c >= 248) { |
|
| 1732 | + $bits = 5; |
|
| 1733 | + } elseif ($c >= 240) { |
|
| 1734 | + $bits = 4; |
|
| 1735 | + } elseif ($c >= 224) { |
|
| 1736 | + $bits = 3; |
|
| 1737 | + } elseif ($c >= 192) { |
|
| 1738 | + $bits = 2; |
|
| 1739 | + } else { |
|
| 1740 | + return false; |
|
| 1741 | + } |
|
| 1742 | + if (($i + $bits) > $len) { |
|
| 1743 | + return false; |
|
| 1744 | + } |
|
| 1727 | 1745 | while($bits > 1) { |
| 1728 | 1746 | $i++; |
| 1729 | 1747 | $b = ord($str[$i]); |
| 1730 | - if ($b < 128 || $b > 191) return false; |
|
| 1748 | + if ($b < 128 || $b > 191) { |
|
| 1749 | + return false; |
|
| 1750 | + } |
|
| 1731 | 1751 | $bits--; |
| 1732 | 1752 | } |
| 1733 | 1753 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | */ |
| 106 | 106 | public static function setObjectFilter($class, $filter) |
| 107 | 107 | { |
| 108 | - FirePHP::getInstance(true)->setObjectFilter($class, $filter); |
|
| 108 | + FirePHP::getInstance(true)->setObjectFilter($class, $filter); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param array $options OPTIONAL Instructions on how to log the group |
| 157 | 157 | * @return true |
| 158 | 158 | */ |
| 159 | - public static function group($name, $options=null) |
|
| 159 | + public static function group($name, $options = null) |
|
| 160 | 160 | { |
| 161 | 161 | return FirePHP::getInstance(true)->group($name, $options); |
| 162 | 162 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @return true |
| 182 | 182 | * @throws \Exception |
| 183 | 183 | */ |
| 184 | - public static function log($object, $label=null) |
|
| 184 | + public static function log($object, $label = null) |
|
| 185 | 185 | { |
| 186 | 186 | return self::send($object, $label, FirePHP::LOG); |
| 187 | 187 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return true |
| 196 | 196 | * @throws \Exception |
| 197 | 197 | */ |
| 198 | - public static function info($object, $label=null) |
|
| 198 | + public static function info($object, $label = null) |
|
| 199 | 199 | { |
| 200 | 200 | return self::send($object, $label, FirePHP::INFO); |
| 201 | 201 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return true |
| 210 | 210 | * @throws \Exception |
| 211 | 211 | */ |
| 212 | - public static function warn($object, $label=null) |
|
| 212 | + public static function warn($object, $label = null) |
|
| 213 | 213 | { |
| 214 | 214 | return self::send($object, $label, FirePHP::WARN); |
| 215 | 215 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * @return true |
| 224 | 224 | * @throws \Exception |
| 225 | 225 | */ |
| 226 | - public static function error($object, $label=null) |
|
| 226 | + public static function error($object, $label = null) |
|
| 227 | 227 | { |
| 228 | 228 | return self::send($object, $label, FirePHP::ERROR); |
| 229 | 229 | } |