diff --git a/composer.json b/composer.json index 63ea60ac..a04e6de5 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ }, "require": { "php": ">=5.4.0", - "bdk/http-message": "^1.2 || ^2.0 || ^3.0" + "bdk/http-message": "^1.3 || ^2.3 || ^3.3" }, "require-dev": { "bdk/devutil": "dev-master", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 34061f34..74be118f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -33,6 +33,7 @@ --> + src/Debug/Collector/DoctrineLogger/CompatTrait_legacy.php src/Debug/Dump/charData.php src/Debug/Framework src/Debug/node_modules diff --git a/src/Backtrace/Backtrace.php b/src/Backtrace/Backtrace.php index 972df664..0e9cba4a 100644 --- a/src/Backtrace/Backtrace.php +++ b/src/Backtrace/Backtrace.php @@ -5,7 +5,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2020-2024 Brad Kent - * @version v2.2 + * @since v2.2 * @link http://www.github.com/bkdotcom/Backtrace */ diff --git a/src/Backtrace/Context.php b/src/Backtrace/Context.php index cc92191a..23f06d69 100644 --- a/src/Backtrace/Context.php +++ b/src/Backtrace/Context.php @@ -5,7 +5,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2020-2024 Brad Kent - * @version v2.2 + * @since v2.2 * @link http://www.github.com/bkdotcom/Backtrace */ diff --git a/src/Backtrace/Normalizer.php b/src/Backtrace/Normalizer.php index 05355ce5..3b61bd52 100644 --- a/src/Backtrace/Normalizer.php +++ b/src/Backtrace/Normalizer.php @@ -5,7 +5,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2020-2024 Brad Kent - * @version v2.2 + * @since v2.2 * @link http://www.github.com/bkdotcom/Backtrace */ @@ -128,7 +128,7 @@ private static function normalizeFrameFunction(array $frame) // xdebug_get_function_stack $frame['function'] = $matches[1]; } - if (\preg_match('/^(.*)\{closure(?::(.*):(\d*)-(\d*))?\}$/', (string) $frame['function'])) { + if (\preg_match('/^([^\{]*)\{closure(?::(.*):(\d*)(?:-(\d*))?)?\}$/', (string) $frame['function'])) { // both debug_backtrace and xdebug_get_function_stack may have the namespace prefix // xdebug provides the filepath, start and end lines $frame['function'] = '{closure}'; diff --git a/src/Backtrace/SkipInternal.php b/src/Backtrace/SkipInternal.php index 2daef904..c7ba5fb7 100644 --- a/src/Backtrace/SkipInternal.php +++ b/src/Backtrace/SkipInternal.php @@ -5,7 +5,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2020-2024 Brad Kent - * @version v2.2 + * @since v2.2 * @link http://www.github.com/bkdotcom/Backtrace */ diff --git a/src/Backtrace/Xdebug.php b/src/Backtrace/Xdebug.php index 6df25ca6..944012a1 100644 --- a/src/Backtrace/Xdebug.php +++ b/src/Backtrace/Xdebug.php @@ -5,7 +5,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2020-2024 Brad Kent - * @version v2.2 + * @since v2.2 * @link http://www.github.com/bkdotcom/Backtrace */ diff --git a/src/Container/Container.php b/src/Container/Container.php index fe85cde7..b784b49e 100644 --- a/src/Container/Container.php +++ b/src/Container/Container.php @@ -7,13 +7,17 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since v3.0 */ namespace bdk; +use ArrayAccess; use bdk\Container\ServiceProviderInterface; +use InvalidArgumentException; use OutOfBoundsException; +use RuntimeException; +use SplObjectStorage; /** * Container @@ -30,7 +34,7 @@ * @author Fabien Potencier * @author Brad Kent */ -class Container implements \ArrayAccess +class Container implements ArrayAccess { /** @var array */ private $cfg = array( @@ -38,28 +42,43 @@ class Container implements \ArrayAccess 'onInvoke' => null, // callable ); + /** + * Closures used to modify / extend service definitions when invoked + * + * @var array + */ + private $extenders; + /** * Closures flagged as factories * - * @var \SplObjectStorage + * @var SplObjectStorage */ private $factories; - /** @var array */ - private $invoked = array(); // keep track of invoked service closures + /** + * Keep track of invoked service closures + * + * @var array + */ + private $invoked = array(); /** @var array */ private $keys = array(); /** - * wrap anonymous functions with the protect() method to store them as value + * Wrap anonymous functions with the protect() method to store them as value * vs treating as service * - * @var \SplObjectStorage + * @var SplObjectStorage */ private $protected; - /** @var array */ + /** + * Populated with the original raw service/factory closure when invoked + * + * @var array + */ private $raw = array(); /** @var array */ @@ -75,13 +94,38 @@ class Container implements \ArrayAccess */ public function __construct($values = array(), $cfg = array()) { - $this->factories = new \SplObjectStorage(); - $this->protected = new \SplObjectStorage(); + $this->factories = new SplObjectStorage(); + $this->protected = new SplObjectStorage(); $this->setCfg($cfg); $this->setValues($values); } + /** + * Extends an object definition. + * + * Useful for + * - Extend an existing object definition without necessarily loading that object. + * - Ensure user-supplied factory is decorated with additional functionality. + * + * The callable should: + * - take the value as its first argument and the container as its second argument + * - return the modified value + * + * @param string $id The unique identifier for the object + * @param callable $callable A service definition to extend the original + * + * @return void + */ + public function extend($name, $callable) + { + $this->assertExists($name); + $this->assertInvokable($this->values[$name]); + $this->assertInvokable($callable); + + $this->extenders[$name] = $callable; + } + /** * Marks a callable as being a factory service. * A new instance will be returned each time it is accessed @@ -93,19 +137,17 @@ public function __construct($values = array(), $cfg = array()) * @param callable $invokable A service definition to be used as a factory * * @return callable The passed callable - * @throws \InvalidArgumentException Service definition has to be a closure or an invokable object + * @throws InvalidArgumentException Service definition has to be a closure or an invokable object */ public function factory($invokable) { - if (\is_object($invokable) === false || \method_exists($invokable, '__invoke') === false) { - throw new \InvalidArgumentException('Closure or invokable object expected.'); - } + $this->assertInvokable($invokable); $this->factories->attach($invokable); return $invokable; } /** - * Finds an entry of the container by its identifier and returns it. + * Finds an entry by its identifier and returns it. * * @param string $name Identifier of the entry to look for. * @@ -158,8 +200,7 @@ public function needsInvoked($name) } /** - * ArrayAccess - * Checks if a parameter or an object is set. + * ArrayAccess: Checks if a parameter or an object is set. * * @param string $name The unique identifier for the parameter or object * @@ -172,8 +213,7 @@ public function offsetExists($name) } /** - * ArrayAccess - * Gets a parameter or an object. + * ArrayAccess: Gets a parameter or an object. * * @param string $name The unique identifier for the parameter or object * @@ -184,46 +224,43 @@ public function offsetExists($name) public function offsetGet($name) { $this->assertExists($name); + if ($this->needsInvoked($name) === false) { return $this->values[$name]; } + if (isset($this->factories[$this->values[$name]])) { // we're a factory $val = $this->values[$name]($this); - if (\is_callable($this->cfg['onInvoke'])) { - $this->cfg['onInvoke']($val, $name, $this); - } - return $val; + return $this->onInvoke($name, $val); } + // we're a service $raw = $this->values[$name]; $this->invoked[$name] = true; $this->raw[$name] = $raw; $val = $raw($this); - if (\is_callable($this->cfg['onInvoke'])) { - $this->cfg['onInvoke']($val, $name, $this); - } + $val = $this->onInvoke($name, $val); $this->values[$name] = $val; return $val; } /** - * ArrayAccess - * Sets a parameter or an object. + * ArrayAccess: Sets a parameter or an object. * * @param string $offset The unique identifier for the parameter or object * @param mixed $value The value of the parameter or a closure to define an object * - * @throws \RuntimeException Prevent override of a already built service + * @throws RuntimeException Prevent override of a already built service * @return void */ #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { if (isset($this->invoked[$offset]) && $this->cfg['allowOverride'] === false) { - throw new \RuntimeException( + throw new RuntimeException( \sprintf('Cannot update "%s" after it has been instantiated.', $offset) ); } @@ -237,8 +274,7 @@ public function offsetSet($offset, $value) } /** - * ArrayAccess - * Unsets a parameter or an object. + * ArrayAccess: Unsets a parameter or an object. * * @param string $name The unique identifier for the parameter or object * @@ -276,13 +312,11 @@ public function offsetUnset($name) * @param callable $invokable A callable to protect from being evaluated * * @return callable The passed callable - * @throws \InvalidArgumentException Service definition has to be a closure or an invokable object + * @throws InvalidArgumentException Service definition has to be a closure or an invokable object */ public function protect($invokable) { - if (\is_object($invokable) === false || \method_exists($invokable, '__invoke') === false) { - throw new \InvalidArgumentException('Closure or invokable object expected.'); - } + $this->assertInvokable($invokable); $this->protected->attach($invokable); return $invokable; } @@ -375,4 +409,57 @@ private function assertExists($name) ); } } + + /** + * Assert that the identifier exists + * + * @param string $name Identifier of entry to check + * + * @return void + * + * @throws InvalidArgumentException If the identifier is not defined + */ + private function assertInvokable($val) + { + if (\is_object($val) === false || \method_exists($val, '__invoke') === false) { + throw new InvalidArgumentException(\sprintf( + 'Closure or invokable object expected. %s provided', + $this->getDebugType($val) + )); + } + } + + /** + * Gets the type name of a variable in a way that is suitable for debugging + * + * @param mixed $value Value to inspect + * + * @return string + */ + protected static function getDebugType($value) + { + return \is_object($value) + ? \get_class($value) + : \gettype($value); + } + + /** + * Undocumented function + * + * @param string $name The service or factory name + * @param mixed $value The value returned by the definition + * + * @return mixed the value (possibly modified by extenders) + */ + private function onInvoke($name, $value) + { + if (isset($this->extenders[$name])) { + $callable = $this->extenders[$name]; + $value = $callable($value, $this); + } + if (\is_callable($this->cfg['onInvoke'])) { + $this->cfg['onInvoke']($value, $name, $this); + } + return $value; + } } diff --git a/src/Container/ServiceProviderInterface.php b/src/Container/ServiceProviderInterface.php index c8e40c5b..c2ff957e 100644 --- a/src/Container/ServiceProviderInterface.php +++ b/src/Container/ServiceProviderInterface.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since v3.0 */ namespace bdk\Container; diff --git a/src/Container/Utility.php b/src/Container/Utility.php index feafe3b3..8999f2ed 100644 --- a/src/Container/Utility.php +++ b/src/Container/Utility.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since v3.1 */ namespace bdk\Container; diff --git a/src/CurlHttpMessage/AbstractClient.php b/src/CurlHttpMessage/AbstractClient.php index b6f5ccb2..fbbd5d1e 100644 --- a/src/CurlHttpMessage/AbstractClient.php +++ b/src/CurlHttpMessage/AbstractClient.php @@ -266,7 +266,7 @@ public function request($method, $uri, array $options = array()) /** * apply options to request * - * @param RequestInterface $request Request instance + * @param RequestInterface $request Request instance * @param array $options options * * @return RequestInterface diff --git a/src/CurlHttpMessage/CurlReqRes.php b/src/CurlHttpMessage/CurlReqRes.php index 912fa115..6e07a182 100644 --- a/src/CurlHttpMessage/CurlReqRes.php +++ b/src/CurlHttpMessage/CurlReqRes.php @@ -69,7 +69,7 @@ public function __destruct() if (!$this->curlHandle) { return; } - \set_error_handler(function ($type, $message) { + \set_error_handler(static function ($type, $message) { // ignore error }); try { diff --git a/src/CurlHttpMessage/Exception/RequestException.php b/src/CurlHttpMessage/Exception/RequestException.php index dc4b91bf..9681b416 100644 --- a/src/CurlHttpMessage/Exception/RequestException.php +++ b/src/CurlHttpMessage/Exception/RequestException.php @@ -23,14 +23,17 @@ class RequestException extends RuntimeException /** * Construct * - * @param string $message Exception message - * @param RequestInterface $request Request object - * @param ResponseInterface $response Response object - * @param Exception|null $prevException Previous exception + * @param string $message Exception message + * @param RequestInterface $request Request object + * @param ResponseInterface|null $response Response object + * @param Exception|null $prevException Previous exception */ - public function __construct($message, RequestInterface $request, ResponseInterface $response = null, Exception $prevException = null) + public function __construct($message, RequestInterface $request, $response = null, $prevException = null) { - $this->request = $request; + \bdk\Debug\Utility\Php::assertType($response, 'Psr\Http\Message\ResponseInterface'); + \bdk\Debug\Utility\Php::assertType($prevException, 'Exception'); + + $this->request = $request; $this->response = $response; $code = $response ? $response->getStatusCode() : 0; @@ -40,14 +43,17 @@ public function __construct($message, RequestInterface $request, ResponseInterfa /** * Build exception * - * @param RequestInterface $request Request - * @param ResponseInterface $response Response - * @param Throwable|Exception $prevException Previous exception + * @param RequestInterface $request Request + * @param ResponseInterface|null $response Response + * @param Throwable|Exception|null $prevException Previous exception * * @return self */ - public static function create(RequestInterface $request, ResponseInterface $response = null, Exception $prevException = null) + public static function create(RequestInterface $request, $response = null, $prevException = null) { + \bdk\Debug\Utility\Php::assertType($response, 'Psr\Http\Message\ResponseInterface'); + \bdk\Debug\Utility\Php::assertType($prevException, 'Exception'); + $level = $response ? (int) \floor($response->getStatusCode() / 100) : 0; @@ -89,8 +95,10 @@ public function getResponse() * * @return string */ - private static function buildMessage(RequestInterface $request, ResponseInterface $response = null) + private static function buildMessage(RequestInterface $request, $response = null) { + \bdk\Debug\Utility\Php::assertType($response, 'Psr\Http\Message\ResponseInterface'); + if (!$response) { $label = 'Error completing request'; return \sprintf( diff --git a/src/CurlHttpMessage/Factory.php b/src/CurlHttpMessage/Factory.php index 883fb0a2..7bb8c9bf 100644 --- a/src/CurlHttpMessage/Factory.php +++ b/src/CurlHttpMessage/Factory.php @@ -126,8 +126,9 @@ public function buildResponse($code = 200, $reasonPhrase = '', $headers = array( * * @return HandlerStack */ - public static function buildStack(callable $handler = null) + public static function buildStack($handler = null) { + \bdk\Debug\Utility\Php::assertType($handler, 'callable'); if ($handler === null) { $syncHandler = new Curl(); $asyncHandler = new CurlMulti(); diff --git a/src/CurlHttpMessage/Handler/Mock.php b/src/CurlHttpMessage/Handler/Mock.php index a64716e3..cfbd8e9e 100644 --- a/src/CurlHttpMessage/Handler/Mock.php +++ b/src/CurlHttpMessage/Handler/Mock.php @@ -31,15 +31,17 @@ class Mock implements Countable /** * The passed in value must be an array of - * {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions, - * callables, or Promises. + * {@see \Psr\Http\Message\ResponseInterface} objects, Exceptions, callables, or Promises. * - * @param array|null $queue The parameters to be passed to the append function, as an indexed array. - * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. - * @param callable|null $onRejected Callback to invoke when the return value is rejected. + * @param array $queue The parameters to be passed to the append function, as an indexed array. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. */ - public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null) + public function __construct(array $queue = array(), $onFulfilled = null, $onRejected = null) { + \bdk\Debug\Utility\Php::assertType($onFulfilled, 'callable'); + \bdk\Debug\Utility\Php::assertType($onRejected, 'callable'); + $this->onFulfilled = $onFulfilled; $this->onRejected = $onRejected; diff --git a/src/Debug/AbstractComponent.php b/src/Debug/AbstractComponent.php index 27ed3938..ac06cad9 100644 --- a/src/Debug/AbstractComponent.php +++ b/src/Debug/AbstractComponent.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug; diff --git a/src/Debug/AbstractDebug.php b/src/Debug/AbstractDebug.php index 57059250..f0c1f10a 100644 --- a/src/Debug/AbstractDebug.php +++ b/src/Debug/AbstractDebug.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug; @@ -19,6 +19,7 @@ use bdk\Debug\LogEntry; use bdk\Debug\ServiceProvider; use bdk\PubSub\Event; +use InvalidArgumentException; use ReflectionMethod; /** @@ -28,6 +29,9 @@ */ abstract class AbstractDebug { + /** @var array */ + protected $cfg = array(); + /** @var \bdk\Debug\Config */ protected $config; @@ -230,16 +234,17 @@ public function onCfgServiceProvider($val) * Publish/Trigger/Dispatch event * Event will get published on ancestor channels if propagation not stopped * - * @param string $eventName Event name - * @param Event $event Event instance - * @param Debug $debug Specify Debug instance to start on. - * If not specified will check if getSubject returns Debug instance - * Fallback: this->debug + * @param string $eventName Event name + * @param Event $event Event instance + * @param Debug|null $debug Specify Debug instance to start on. + * If not specified will check if getSubject returns Debug instance + * Fallback: this->debug * * @return Event */ - public function publishBubbleEvent($eventName, Event $event, Debug $debug = null) + public function publishBubbleEvent($eventName, Event $event, $debug = null) { + $this->php->assertType($debug, 'bdk\Debug'); if ($debug === null) { $subject = $event->getSubject(); /** @var Debug */ diff --git a/src/Debug/Abstraction/AbstractArray.php b/src/Debug/Abstraction/AbstractArray.php index d0060185..c9ee8754 100644 --- a/src/Debug/Abstraction/AbstractArray.php +++ b/src/Debug/Abstraction/AbstractArray.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Abstraction; diff --git a/src/Debug/Abstraction/AbstractObject.php b/src/Debug/Abstraction/AbstractObject.php index d039ca1d..0fb43242 100644 --- a/src/Debug/Abstraction/AbstractObject.php +++ b/src/Debug/Abstraction/AbstractObject.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.0 */ namespace bdk\Debug\Abstraction; @@ -22,7 +22,6 @@ use bdk\Debug\Abstraction\Object\Methods; use bdk\Debug\Abstraction\Object\Properties; use bdk\Debug\Abstraction\Object\Subscriber; -use bdk\Debug\Utility\Reflection; use ReflectionClass; use ReflectionEnumUnitCase; use RuntimeException; @@ -216,7 +215,7 @@ public function __construct(Abstracter $abstracter) */ public function getAbstraction($obj, $method = null, array $hist = array()) { - $reflector = Reflection::getReflector($obj); + $reflector = $this->debug->reflection->getReflector($obj); if ($reflector instanceof ReflectionEnumUnitCase) { $reflector = $reflector->getEnum(); } diff --git a/src/Debug/Abstraction/AbstractString.php b/src/Debug/Abstraction/AbstractString.php index c9a2b89c..96823cd4 100644 --- a/src/Debug/Abstraction/AbstractString.php +++ b/src/Debug/Abstraction/AbstractString.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Abstraction; @@ -112,10 +112,14 @@ private function absFinish(Abstraction $abs) $typeMore = $abs['typeMore']; if ($abs['brief'] && $typeMore !== Type::TYPE_STRING_BINARY) { $matches = array(); - $maxLen = $abs['maxlen'] > -1 ? $abs['maxlen'] : 128; + $maxLen = $abs['maxlen'] > -1 + ? $abs['maxlen'] + : 128; $regex = '/^([^\r\n]{1,' . $maxLen . '})/'; \preg_match($regex, $abs['value'], $matches); - $abs['value'] = $matches[1]; + $abs['value'] = $matches + ? $matches[1] + : \substr($abs['value'], 0, $maxLen); $abs['strlenValue'] = \strlen($abs['value']); } if ($abs['strlen'] === $abs['strlenValue'] && $abs['strlen'] === \strlen($abs['value'])) { diff --git a/src/Debug/Abstraction/Abstracter.php b/src/Debug/Abstraction/Abstracter.php index 64473c56..81fced80 100644 --- a/src/Debug/Abstraction/Abstracter.php +++ b/src/Debug/Abstraction/Abstracter.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Abstraction; diff --git a/src/Debug/Abstraction/Abstraction.php b/src/Debug/Abstraction/Abstraction.php index e077e82c..3cc1e32f 100644 --- a/src/Debug/Abstraction/Abstraction.php +++ b/src/Debug/Abstraction/Abstraction.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Abstraction; diff --git a/src/Debug/Abstraction/Object/AbstractInheritable.php b/src/Debug/Abstraction/Object/AbstractInheritable.php index cbf1de2f..3c87be0e 100644 --- a/src/Debug/Abstraction/Object/AbstractInheritable.php +++ b/src/Debug/Abstraction/Object/AbstractInheritable.php @@ -7,16 +7,13 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Abstraction\Object; use bdk\Debug\Abstraction\AbstractObject; use ReflectionClass; -use ReflectionClassConstant; -use ReflectionProperty; -use Reflector; /** * Base class for collecting constants, properties, & methods @@ -41,24 +38,33 @@ public function __construct(AbstractObject $abstractObject) } /** - * Pass reflector and each parent class reflector to callable + * Pass reflector and ancestor reflectors to callable * * @param ReflectionClass $reflector ReflectionClass instance * @param callable $callable callable to be invoked on each parent - * @param bool $inclInterfaces (false) Whether to also iterate over interfaces + * @param array|bool $inclInterfaces (false) + * bool: Whether to also iterate over interfaces + * array: interfaces/classes to iterate over + * interfaces have multiple inheritance / getParentClass returns false + * constants may be inherited from interfaces + * properties only from parent classes * * @return void */ protected function traverseAncestors(ReflectionClass $reflector, callable $callable, $inclInterfaces = false) { - $interfaces = $reflector->getInterfaceNames(); + $interfaces = array(); + if ($inclInterfaces === true) { + $interfaces = $reflector->getInterfaceNames(); + } elseif (\is_array($inclInterfaces)) { + // flatten interface tree + \preg_match_all('/("[^"]+")/', \json_encode($inclInterfaces), $matches); + $interfaces = \array_map('json_decode', $matches[1]); + } while ($reflector) { $callable($reflector); $reflector = $reflector->getParentClass(); } - if ($inclInterfaces === false) { - return; - } foreach ($interfaces as $className) { $reflector = new ReflectionClass($className); $callable($reflector); diff --git a/src/Debug/Abstraction/Object/Abstraction.php b/src/Debug/Abstraction/Object/Abstraction.php index 8d17ee8c..51bba6a5 100644 --- a/src/Debug/Abstraction/Object/Abstraction.php +++ b/src/Debug/Abstraction/Object/Abstraction.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.4 */ namespace bdk\Debug\Abstraction\Object; diff --git a/src/Debug/Abstraction/Object/Constants.php b/src/Debug/Abstraction/Object/Constants.php index bf049195..dcfd8a82 100644 --- a/src/Debug/Abstraction/Object/Constants.php +++ b/src/Debug/Abstraction/Object/Constants.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Abstraction\Object; @@ -80,7 +80,7 @@ public function add(Abstraction $abs) PHP_VERSION_ID >= 70100 ? $this->addConstantsReflection($reflector) : $this->addConstantsLegacy($reflector); - }, true); + }, $abs['isInterface'] ? $abs['extends'] : true); $this->abstracter->debug->setCfg('brief', $briefBak, Debug::CONFIG_NO_PUBLISH | Debug::CONFIG_NO_RETURN); $this->abs = null; $abs['constants'] = $this->constants; diff --git a/src/Debug/Abstraction/Object/Definition.php b/src/Debug/Abstraction/Object/Definition.php index 4caef8b6..d4143e9d 100644 --- a/src/Debug/Abstraction/Object/Definition.php +++ b/src/Debug/Abstraction/Object/Definition.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.4 */ namespace bdk\Debug\Abstraction\Object; @@ -199,12 +199,21 @@ protected function addDefinition(ValueStore $abs) /** * Collect classes this class extends * + * If interface, collect ancestor interfaces as a tree. + * ReflectionClass::getParentClass() doesn't work for interfaces + * as interfaces can extend multiple interfaces + * * @param ValueStore $abs ValueStore instance * * @return void */ protected function addExtends(ValueStore $abs) { + if ($abs['isInterface']) { + // interfaces can EXTEND multiple interfaces + $abs['extends'] = $this->getInterfaces($abs['reflector']); + return; + } $reflector = $abs['reflector']; $extends = array(); while ($reflector = $reflector->getParentClass()) { @@ -214,7 +223,7 @@ protected function addExtends(ValueStore $abs) } /** - * Collect interfaces that object implements + * Collect interfaces that class implements * * @param ValueStore $abs ValueStore instance * @@ -222,7 +231,9 @@ protected function addExtends(ValueStore $abs) */ protected function addImplements(ValueStore $abs) { - $abs['implements'] = $this->getInterfaces($abs['reflector']); + $abs['implements'] = $abs['isInterface'] + ? array() + : $this->getInterfaces($abs['reflector']); } /** diff --git a/src/Debug/Abstraction/Object/Helper.php b/src/Debug/Abstraction/Object/Helper.php index f75cd129..119b583e 100644 --- a/src/Debug/Abstraction/Object/Helper.php +++ b/src/Debug/Abstraction/Object/Helper.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3 */ namespace bdk\Debug\Abstraction\Object; @@ -232,8 +232,9 @@ public static function getType($phpDocType, Reflector $reflector) * * @return string|null */ - protected static function getTypeString(ReflectionType $type = null) + protected static function getTypeString($type = null) { + PhpUtil::assertType($type, 'ReflectionType'); if ($type === null) { return null; } diff --git a/src/Debug/Abstraction/Object/MethodParams.php b/src/Debug/Abstraction/Object/MethodParams.php index 82af7fa9..4e460731 100644 --- a/src/Debug/Abstraction/Object/MethodParams.php +++ b/src/Debug/Abstraction/Object/MethodParams.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3 */ namespace bdk\Debug\Abstraction\Object; diff --git a/src/Debug/Abstraction/Object/Methods.php b/src/Debug/Abstraction/Object/Methods.php index d72d367f..f4dae791 100644 --- a/src/Debug/Abstraction/Object/Methods.php +++ b/src/Debug/Abstraction/Object/Methods.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3 */ namespace bdk\Debug\Abstraction\Object; @@ -318,7 +318,7 @@ private function addViaRef(Abstraction $abs) foreach ($refMethods as $refMethod) { $this->addViaRefBuild($abs, $refMethod, $className); } - }); + }, $abs['isInterface'] ? $abs['extends'] : false); $abs['methods'] = $this->methods; $methodsWithStatic = \array_unique($this->methodsWithStatic); \sort($methodsWithStatic); diff --git a/src/Debug/Abstraction/Object/Properties.php b/src/Debug/Abstraction/Object/Properties.php index f7e4e4bd..e79b9c92 100644 --- a/src/Debug/Abstraction/Object/Properties.php +++ b/src/Debug/Abstraction/Object/Properties.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.0 */ namespace bdk\Debug\Abstraction\Object; @@ -36,6 +36,9 @@ class Properties extends AbstractInheritable // populated only if overridden 'forceShow' => false, // initially show the property/value (even if protected or private) // if value is an array, expand it + 'isDeprecated' => false, // some internal php objects may raise a deprecation notice when accessing + // example: `DOMDocument::$actualEncoding` + // or may come from phpDoc tag 'isPromoted' => false, 'isReadOnly' => false, 'isStatic' => false, @@ -268,7 +271,7 @@ private function addValuesPropInfo(Abstraction $abs, ReflectionProperty $refProp * * @return array updated propInfo */ - private function addValue($propInfo, Abstraction $abs, ReflectionProperty $refProperty) + private function addValue(array $propInfo, Abstraction $abs, ReflectionProperty $refProperty) { $obj = $abs->getSubject(); $propName = $refProperty->getName(); @@ -280,15 +283,38 @@ private function addValue($propInfo, Abstraction $abs, ReflectionProperty $refPr } $propInfo['value'] = $value; } elseif (\is_object($obj)) { - $refProperty->setAccessible(true); // only accessible via reflection - $isInitialized = PHP_VERSION_ID < 70400 || $refProperty->isInitialized($obj); - $propInfo['value'] = $isInitialized - ? $refProperty->getValue($obj) - : Abstracter::UNDEFINED; // value won't be displayed + $propInfo = $this->addValueInstance($propInfo, $abs, $refProperty); } return $propInfo; } + /** + * Obtain property value from instance + * + * @param array $propInfo propInfo array + * @param Abstraction $abs Object Abstraction instance + * @param ReflectionProperty $refProperty ReflectionProperty + * + * @return array updated propInfo + */ + private function addValueInstance(array $propInfo, Abstraction $abs, ReflectionProperty $refProperty) + { + $obj = $abs->getSubject(); + $refProperty->setAccessible(true); // only accessible via reflection + $isInitialized = PHP_VERSION_ID < 70400 || $refProperty->isInitialized($obj); + \set_error_handler(static function ($errType) use (&$propInfo) { + // example: DOMDocument::$actualEncoding raises a deprecation notice when accessed + if ($errType & (E_DEPRECATED | E_USER_DEPRECATED)) { + $propInfo['isDeprecated'] = true; + } + }); + $propInfo['value'] = $isInitialized + ? $refProperty->getValue($obj) + : Abstracter::UNDEFINED; // value won't be displayed + \restore_error_handler(); + return $propInfo; + } + /** * Adds properties to abstraction via reflection * @@ -342,6 +368,8 @@ private function buildViaRef(Abstraction $abs, ReflectionProperty $refProperty) 'attributes' => $abs['cfgFlags'] & AbstractObject::PROP_ATTRIBUTE_COLLECT ? $this->helper->getAttributes($refProperty) : array(), + 'isDeprecated' => isset($phpDoc['deprecated']), // if inspecting an instance, + // we will also check if ReflectionProperty::getValue throws a deprecation notice 'isPromoted' => PHP_VERSION_ID >= 80000 ? $refProperty->isPromoted() : false, diff --git a/src/Debug/Abstraction/Object/PropertiesDom.php b/src/Debug/Abstraction/Object/PropertiesDom.php index 95b403a6..086c4c9a 100644 --- a/src/Debug/Abstraction/Object/PropertiesDom.php +++ b/src/Debug/Abstraction/Object/PropertiesDom.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Abstraction\Object; diff --git a/src/Debug/Abstraction/Object/PropertiesPhpDoc.php b/src/Debug/Abstraction/Object/PropertiesPhpDoc.php index 1e8f3202..50eb306a 100644 --- a/src/Debug/Abstraction/Object/PropertiesPhpDoc.php +++ b/src/Debug/Abstraction/Object/PropertiesPhpDoc.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Abstraction\Object; diff --git a/src/Debug/Abstraction/Object/Subscriber.php b/src/Debug/Abstraction/Object/Subscriber.php index 96a3d5aa..8fc30ffa 100644 --- a/src/Debug/Abstraction/Object/Subscriber.php +++ b/src/Debug/Abstraction/Object/Subscriber.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0.4 */ namespace bdk\Debug\Abstraction\Object; diff --git a/src/Debug/Abstraction/Type.php b/src/Debug/Abstraction/Type.php index 1e0e5196..4c9f189f 100644 --- a/src/Debug/Abstraction/Type.php +++ b/src/Debug/Abstraction/Type.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Abstraction; diff --git a/src/Debug/AssetProviderInterface.php b/src/Debug/AssetProviderInterface.php index 6ce9954d..366f7c67 100644 --- a/src/Debug/AssetProviderInterface.php +++ b/src/Debug/AssetProviderInterface.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug; diff --git a/src/Debug/Autoloader.php b/src/Debug/Autoloader.php index cf4b7d5a..ab78f1b5 100644 --- a/src/Debug/Autoloader.php +++ b/src/Debug/Autoloader.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug; diff --git a/src/Debug/Collector/AbstractAsyncMiddleware.php b/src/Debug/Collector/AbstractAsyncMiddleware.php index 54d0c96f..dcdb05d2 100644 --- a/src/Debug/Collector/AbstractAsyncMiddleware.php +++ b/src/Debug/Collector/AbstractAsyncMiddleware.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -15,7 +15,6 @@ use bdk\Debug; use bdk\Debug\AbstractComponent; use bdk\Debug\LogEntry; -use Exception; use Psr\Http\Message\MessageInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -50,15 +49,16 @@ class AbstractAsyncMiddleware extends AbstractComponent /** * Constructor * - * @param array $cfg configuration - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create Guzzle channel on singleton instance - * if root channel is specified, will create a Guzzle channel + * @param array $cfg configuration + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create Guzzle channel on singleton instance + * if root channel is specified, will create a Guzzle channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct($cfg = array(), Debug $debug = null) + public function __construct($cfg = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); $this->setCfg($cfg); if (!$debug) { $debug = Debug::getChannel($this->cfg['label'], array('channelIcon' => $this->cfg['icon'])); @@ -279,14 +279,17 @@ protected function logRequestBody(RequestInterface $request) /** * Log request headers and request body * - * @param ResponseInterface|null $response Response - * @param array $requestInfo Request information - * @param RequestException|GuzzleException $rejectReason Response exception + * @param ResponseInterface|null $response Response + * @param array $requestInfo Request information + * @param RequestException|GuzzleException|null $rejectReason Response exception * * @return void */ - protected function logResponse(ResponseInterface $response = null, array $requestInfo = array(), Exception $rejectReason = null) + protected function logResponse($response = null, array $requestInfo = array(), $rejectReason = null) { + \bdk\Debug\Utility\Php::assertType($response, 'Psr\Http\Message\ResponseInterface'); + \bdk\Debug\Utility\Php::assertType($rejectReason, 'Exception'); + $duration = $this->debug->timeEnd($this->cfg['label'] . ':' . $requestInfo['requestId'], false); $metaAppend = $requestInfo['isAsynchronous'] && $this->cfg['asyncResponseWithRequest'] ? $this->debug->meta('appendGroup', $this->cfg['idPrefix'] . $requestInfo['requestId']) diff --git a/src/Debug/Collector/CurlHttpMessageMiddleware.php b/src/Debug/Collector/CurlHttpMessageMiddleware.php index e4a1fe77..db224ac7 100644 --- a/src/Debug/Collector/CurlHttpMessageMiddleware.php +++ b/src/Debug/Collector/CurlHttpMessageMiddleware.php @@ -7,14 +7,13 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3 */ namespace bdk\Debug\Collector; use bdk\CurlHttpMessage\CurlReqRes; use bdk\CurlHttpMessage\Exception\RequestException; -use bdk\Debug; use bdk\Promise; use Psr\Http\Message\ResponseInterface; @@ -26,8 +25,10 @@ class CurlHttpMessageMiddleware extends AbstractAsyncMiddleware /** * {@inheritDoc} */ - public function __construct($cfg = array(), Debug $debug = null) + public function __construct($cfg = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->cfg = \array_merge($this->cfg, array( 'idPrefix' => 'curl_', 'label' => 'CurlHttpMessage', diff --git a/src/Debug/Collector/DatabaseTrait.php b/src/Debug/Collector/DatabaseTrait.php index 09cea72f..f7180e11 100644 --- a/src/Debug/Collector/DatabaseTrait.php +++ b/src/Debug/Collector/DatabaseTrait.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Collector; diff --git a/src/Debug/Collector/DoctrineLogger.php b/src/Debug/Collector/DoctrineLogger.php index e68a4d61..ef538387 100644 --- a/src/Debug/Collector/DoctrineLogger.php +++ b/src/Debug/Collector/DoctrineLogger.php @@ -7,13 +7,14 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; use bdk\Debug; use bdk\Debug\Collector\DatabaseTrait; +use bdk\Debug\Collector\DoctrineLogger\CompatTrait; use bdk\Debug\Collector\StatementInfo; use bdk\PubSub\Event; use Doctrine\DBAL\Connection; @@ -27,6 +28,7 @@ class DoctrineLogger implements SQLLogger { use DatabaseTrait; + use CompatTrait; /** @var StatementInfo|null */ protected $statementInfo; @@ -40,14 +42,17 @@ class DoctrineLogger implements SQLLogger /** * Constructor * - * @param Connection $connection Optional Doctrine DBAL connection instance - * pass to log connection info - * @param Debug $debug Optional DebugInstance + * @param Connection|null $connection Optional Doctrine DBAL connection instance + * pass to log connection info + * @param Debug|null $debug Optional DebugInstance * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Connection $connection = null, Debug $debug = null) + public function __construct($connection = null, $debug = null) { + \bdk\Debug\Utility\Php::assertType($connection, 'Doctrine\DBAL\Connection'); + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('Doctrine', array('channelIcon' => $this->icon)); } elseif ($debug === $debug->rootInstance) { @@ -94,13 +99,7 @@ public function onDebugOutput(Event $event) $debug->groupEnd(); // groupSummary } - /** - * {@inheritDoc} - */ - public function startQuery($sql, array $params = null, array $types = null) - { - $this->statementInfo = new StatementInfo($sql, $params, $types); - } + // startQuery defined in DoctrineLoggerTrait /** * {@inheritDoc} diff --git a/src/Debug/Collector/DoctrineLogger/CompatTrait.php b/src/Debug/Collector/DoctrineLogger/CompatTrait.php new file mode 100644 index 00000000..7c010fee --- /dev/null +++ b/src/Debug/Collector/DoctrineLogger/CompatTrait.php @@ -0,0 +1,13 @@ += 80400 + ? __DIR__ . '/CompatTrait_php8.4.php' + : __DIR__ . '/CompatTrait_legacy.php'; + +require $require; diff --git a/src/Debug/Collector/DoctrineLogger/CompatTrait_legacy.php b/src/Debug/Collector/DoctrineLogger/CompatTrait_legacy.php new file mode 100644 index 00000000..4b5254e8 --- /dev/null +++ b/src/Debug/Collector/DoctrineLogger/CompatTrait_legacy.php @@ -0,0 +1,33 @@ +|array|null $params Statement parameters + * @param array|array|null $types Parameter types + * + * @return void + * + * @phpcs:disable Generic.Classes.DuplicateClassName.Found + */ + public function startQuery($sql, array $params = null, array $types = null) + { + $this->statementInfo = new StatementInfo($sql, $params, $types); + } + } +} diff --git a/src/Debug/Collector/DoctrineLogger/CompatTrait_php8.4.php b/src/Debug/Collector/DoctrineLogger/CompatTrait_php8.4.php new file mode 100644 index 00000000..3e596d2e --- /dev/null +++ b/src/Debug/Collector/DoctrineLogger/CompatTrait_php8.4.php @@ -0,0 +1,33 @@ += 8.4 + */ + trait CompatTrait + { + /** + * Logs a SQL statement somewhere. + * + * @param string $sql SQL statement + * @param array|array|null $params Statement parameters + * @param array|array|null $types Parameter types + * + * @return void + * + * @phpcs:disable Generic.Classes.DuplicateClassName.Found + */ + public function startQuery($sql, ?array $params = null, ?array $types = null) + { + $this->statementInfo = new StatementInfo($sql, $params, $types); + } + } +} diff --git a/src/Debug/Collector/GuzzleMiddleware.php b/src/Debug/Collector/GuzzleMiddleware.php index 2fb5c84c..128bf175 100644 --- a/src/Debug/Collector/GuzzleMiddleware.php +++ b/src/Debug/Collector/GuzzleMiddleware.php @@ -7,12 +7,11 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; -use bdk\Debug; use GuzzleHttp; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\RequestException; @@ -29,8 +28,10 @@ class GuzzleMiddleware extends AbstractAsyncMiddleware /** * {@inheritDoc} */ - public function __construct($cfg = array(), Debug $debug = null) + public function __construct($cfg = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->cfg = \array_merge($this->cfg, array( 'idPrefix' => 'guzzle_', 'label' => 'Guzzle', diff --git a/src/Debug/Collector/MonologHandler.php b/src/Debug/Collector/MonologHandler.php index 321f838a..19100311 100644 --- a/src/Debug/Collector/MonologHandler.php +++ b/src/Debug/Collector/MonologHandler.php @@ -7,13 +7,13 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Collector; use bdk\Debug; -use bdk\Debug\Collector\MonologHandlerCompatTrait; +use bdk\Debug\Collector\MonologHandler\CompatTrait; use InvalidArgumentException; use Monolog\Handler\PsrHandler; use Monolog\Logger; @@ -24,7 +24,7 @@ */ class MonologHandler extends PsrHandler { - use MonologHandlerCompatTrait; + use CompatTrait; /** * Constructor diff --git a/src/Debug/Collector/MonologHandlerCompatTrait.php b/src/Debug/Collector/MonologHandler/CompatTrait.php similarity index 81% rename from src/Debug/Collector/MonologHandlerCompatTrait.php rename to src/Debug/Collector/MonologHandler/CompatTrait.php index 4e45ed4f..b6b0cb95 100644 --- a/src/Debug/Collector/MonologHandlerCompatTrait.php +++ b/src/Debug/Collector/MonologHandler/CompatTrait.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ -namespace bdk\Debug\Collector; +namespace bdk\Debug\Collector\MonologHandler; use bdk\Debug\Abstraction\Object\Helper as ObjectHelper; @@ -25,13 +25,13 @@ $refParam = $refMethod->getParameters()[0]; $type = ObjectHelper::getType(null, $refParam); require $type === 'array' - ? __DIR__ . '/MonologHandlerCompatTrait_2.0.php' - : __DIR__ . '/MonologHandlerCompatTrait_3.0.php'; -} elseif (\trait_exists(__NAMESPACE__ . '\\MonologHandlerCompatTrait', false) === false) { + ? __DIR__ . '/CompatTrait_2.0.php' + : __DIR__ . '/CompatTrait_3.0.php'; +} elseif (\trait_exists(__NAMESPACE__ . '\\CompatTrait', false) === false) { /** * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ - trait MonologHandlerCompatTrait + trait CompatTrait { /** * Handles a record. diff --git a/src/Debug/Collector/MonologHandlerCompatTrait_2.0.php b/src/Debug/Collector/MonologHandler/CompatTrait_2.0.php similarity index 84% rename from src/Debug/Collector/MonologHandlerCompatTrait_2.0.php rename to src/Debug/Collector/MonologHandler/CompatTrait_2.0.php index 9c930e01..2a728868 100644 --- a/src/Debug/Collector/MonologHandlerCompatTrait_2.0.php +++ b/src/Debug/Collector/MonologHandler/CompatTrait_2.0.php @@ -7,22 +7,22 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ -namespace bdk\Debug\Collector; +namespace bdk\Debug\Collector\MonologHandler; /* Wrap in condition. PHPUnit code coverage scans all files and will conflict */ -if (\trait_exists(__NAMESPACE__ . '\\MonologHandlerCompatTrait', false) === false) { +if (\trait_exists(__NAMESPACE__ . '\\CompatTrait', false) === false) { /** * Provide handle method (with return type-hint) * * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ - trait MonologHandlerCompatTrait + trait CompatTrait { /** * Handles a record. diff --git a/src/Debug/Collector/MonologHandlerCompatTrait_3.0.php b/src/Debug/Collector/MonologHandler/CompatTrait_3.0.php similarity index 85% rename from src/Debug/Collector/MonologHandlerCompatTrait_3.0.php rename to src/Debug/Collector/MonologHandler/CompatTrait_3.0.php index 4e965b5a..0d25ec3b 100644 --- a/src/Debug/Collector/MonologHandlerCompatTrait_3.0.php +++ b/src/Debug/Collector/MonologHandler/CompatTrait_3.0.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ -namespace bdk\Debug\Collector; +namespace bdk\Debug\Collector\MonologHandler; use Monolog\LogRecord; @@ -18,11 +18,11 @@ Wrap in condition. PHPUnit code coverage scans all files and will conflict */ -if (\trait_exists(__NAMESPACE__ . '\\MonologHandlerCompatTrait', false) === false) { +if (\trait_exists(__NAMESPACE__ . '\\CompatTrait', false) === false) { /** * Provide handle method (with return type-hint) */ - trait MonologHandlerCompatTrait + trait CompatTrait { /** * Handles a record. diff --git a/src/Debug/Collector/MySqli.php b/src/Debug/Collector/MySqli.php index 309533b5..2fd06ac0 100644 --- a/src/Debug/Collector/MySqli.php +++ b/src/Debug/Collector/MySqli.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -47,20 +47,22 @@ class MySqli extends mysqliBase /** * Constructor * - * @param string $host host name or IP - * @param string $username MySQL user name - * @param string $passwd password - * @param string $dbname default database used when performing queries - * @param int $port port number - * @param string $socket socket or named pipe that should be used - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create MySqli channel on singleton instance - * if root channel is specified, will create a MySqli channel + * @param string $host host name or IP + * @param string $username MySQL user name + * @param string $passwd password + * @param string $dbname default database used when performing queries + * @param int $port port number + * @param string $socket socket or named pipe that should be used + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create MySqli channel on singleton instance + * if root channel is specified, will create a MySqli channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct($host = null, $username = null, $passwd = null, $dbname = null, $port = null, $socket = null, Debug $debug = null) // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter + public function __construct($host = null, $username = null, $passwd = null, $dbname = null, $port = null, $socket = null, $debug = null) // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->doConstruct(\func_num_args() ? \array_slice(\func_get_args(), 0, 6) : array()); diff --git a/src/Debug/Collector/MySqli/ExecuteQueryTrait_php8.2.php b/src/Debug/Collector/MySqli/ExecuteQueryTrait_php8.2.php index 811bafb6..1247099d 100644 --- a/src/Debug/Collector/MySqli/ExecuteQueryTrait_php8.2.php +++ b/src/Debug/Collector/MySqli/ExecuteQueryTrait_php8.2.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b3 */ namespace bdk\Debug\Collector\MySqli; diff --git a/src/Debug/Collector/MySqli/MySqliStmt.php b/src/Debug/Collector/MySqli/MySqliStmt.php index f15b6ff4..39febc0b 100644 --- a/src/Debug/Collector/MySqli/MySqliStmt.php +++ b/src/Debug/Collector/MySqli/MySqliStmt.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector\MySqli; diff --git a/src/Debug/Collector/OAuth.php b/src/Debug/Collector/OAuth.php index bd8872ba..ec2ed5ac 100644 --- a/src/Debug/Collector/OAuth.php +++ b/src/Debug/Collector/OAuth.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b3 */ namespace bdk\Debug\Collector; diff --git a/src/Debug/Collector/Pdo.php b/src/Debug/Collector/Pdo.php index 485aba2a..f33929af 100644 --- a/src/Debug/Collector/Pdo.php +++ b/src/Debug/Collector/Pdo.php @@ -7,14 +7,14 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; use bdk\Debug; use bdk\Debug\Collector\DatabaseTrait; -use bdk\Debug\Collector\Pdo\MethodSignatureCompatTrait; +use bdk\Debug\Collector\Pdo\CompatTrait; use bdk\Debug\Collector\StatementInfo; use bdk\PubSub\Event; use PDO as PdoBase; @@ -25,8 +25,8 @@ */ class Pdo extends PdoBase { + use CompatTrait; use DatabaseTrait; - use MethodSignatureCompatTrait; /** @var Debug */ private $debug; @@ -37,15 +37,17 @@ class Pdo extends PdoBase /** * Constructor * - * @param PdoBase $pdo PDO instance - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create PDO channel on singleton instance - * if root channel is specified, will create a PDO channel + * @param PdoBase $pdo PDO instance + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create PDO channel on singleton instance + * if root channel is specified, will create a PDO channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(PdoBase $pdo, Debug $debug = null) + public function __construct(PdoBase $pdo, $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('PDO', array('channelIcon' => $this->icon)); } elseif ($debug === $debug->rootInstance) { @@ -186,7 +188,7 @@ public function prepare($statement, $driverOptions = array()) } /* - query() is in MethodSignatureCompatTrait + query() is in CompatTrait */ /** diff --git a/src/Debug/Collector/Pdo/MethodSignatureCompatTrait.php b/src/Debug/Collector/Pdo/CompatTrait.php similarity index 89% rename from src/Debug/Collector/Pdo/MethodSignatureCompatTrait.php rename to src/Debug/Collector/Pdo/CompatTrait.php index fdc2af59..d7e0e720 100644 --- a/src/Debug/Collector/Pdo/MethodSignatureCompatTrait.php +++ b/src/Debug/Collector/Pdo/CompatTrait.php @@ -8,12 +8,12 @@ namespace bdk\Debug\Collector\Pdo; if (PHP_VERSION_ID >= 50600) { - require __DIR__ . '/MethodSignatureCompatTrait_php5.6.php'; + require __DIR__ . '/CompatTrait_php5.6.php'; } else { /** * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ - trait MethodSignatureCompatTrait + trait CompatTrait { /** * Executes an SQL statement, returning a result set as a PDOStatement object diff --git a/src/Debug/Collector/Pdo/MethodSignatureCompatTrait_php5.6.php b/src/Debug/Collector/Pdo/CompatTrait_php5.6.php similarity index 96% rename from src/Debug/Collector/Pdo/MethodSignatureCompatTrait_php5.6.php rename to src/Debug/Collector/Pdo/CompatTrait_php5.6.php index 39b7a27a..f5cf004c 100644 --- a/src/Debug/Collector/Pdo/MethodSignatureCompatTrait_php5.6.php +++ b/src/Debug/Collector/Pdo/CompatTrait_php5.6.php @@ -5,7 +5,7 @@ /** * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ -trait MethodSignatureCompatTrait +trait CompatTrait { /** * Executes an SQL statement, returning a result set as a PDOStatement object diff --git a/src/Debug/Collector/Pdo/Statement.php b/src/Debug/Collector/Pdo/Statement.php index f93eab67..19d684f9 100644 --- a/src/Debug/Collector/Pdo/Statement.php +++ b/src/Debug/Collector/Pdo/Statement.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector\Pdo; diff --git a/src/Debug/Collector/PhpCurlClass.php b/src/Debug/Collector/PhpCurlClass.php index ff2116ba..cd6a67f4 100644 --- a/src/Debug/Collector/PhpCurlClass.php +++ b/src/Debug/Collector/PhpCurlClass.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -52,15 +52,17 @@ class PhpCurlClass extends Curl /** * Constructor * - * @param array $options options - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create Curl channel on singleton instance - * if root channel is specified, will create a Curl channel + * @param array $options options + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create Curl channel on singleton instance + * if root channel is specified, will create a Curl channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct($options = array(), Debug $debug = null) + public function __construct($options = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->debugOptions = \array_merge($this->debugOptions, $options); if (!$debug) { $debug = Debug::getChannel($this->debugOptions['label'], array('channelIcon' => $this->icon)); diff --git a/src/Debug/Collector/SimpleCache.php b/src/Debug/Collector/SimpleCache.php index fb3c9631..da06814f 100644 --- a/src/Debug/Collector/SimpleCache.php +++ b/src/Debug/Collector/SimpleCache.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -41,14 +41,16 @@ class SimpleCache implements CacheInterface * Constructor * * @param CacheInterface $cache SimpleCache instance - * @param Debug $debug (optional) Specify PHPDebugConsole instance + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance * if not passed, will create PDO channel on singleton instance * if root channel is specified, will create a PDO channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(CacheInterface $cache, Debug $debug = null) + public function __construct(CacheInterface $cache, $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('SimpleCache', array('channelIcon' => $this->icon)); } elseif ($debug === $debug->rootInstance) { @@ -66,6 +68,8 @@ public function __construct(CacheInterface $cache, Debug $debug = null) * @param array $args method arguments * * @return mixed + * + * @throws BadMethodCallException */ public function __call($method, $args) { diff --git a/src/Debug/Collector/SimpleCache/CallInfo.php b/src/Debug/Collector/SimpleCache/CallInfo.php index 8b473004..88835edb 100644 --- a/src/Debug/Collector/SimpleCache/CallInfo.php +++ b/src/Debug/Collector/SimpleCache/CallInfo.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector\SimpleCache; @@ -96,8 +96,10 @@ public function __debugInfo() * * @return void */ - public function end(Exception $exception = null) + public function end($exception = null) { + \bdk\Debug\Utility\Php::assertType($exception, 'Exception'); + $this->exception = $exception; $this->timeEnd = \microtime(true); $this->memoryEnd = \memory_get_usage(false); diff --git a/src/Debug/Collector/SoapClient.php b/src/Debug/Collector/SoapClient.php index d53fc5b6..ed84f10c 100644 --- a/src/Debug/Collector/SoapClient.php +++ b/src/Debug/Collector/SoapClient.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -44,18 +44,20 @@ class SoapClient extends SoapClientBase * list_functions: (false) * list_types: (false) * - * @param string $wsdl URI of the WSDL file or NULL if working in non-WSDL mode. - * @param array $options Array of options - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create Soap channel on singleton instance - * if root channel is specified, will create a Soap channel + * @param string $wsdl URI of the WSDL file or NULL if working in non-WSDL mode. + * @param array $options Array of options + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create Soap channel on singleton instance + * if root channel is specified, will create a Soap channel * * @throws Exception * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct($wsdl, $options = array(), Debug $debug = null) + public function __construct($wsdl, $options = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('Soap', array('channelIcon' => $this->icon)); } elseif ($debug === $debug->rootInstance) { @@ -265,8 +267,10 @@ private function isViaCall() * * @return void */ - private function logConstruct($wsdl, $options, Exception $exception = null) + private function logConstruct($wsdl, $options, $exception = null) { + \bdk\Debug\Utility\Php::assertType($exception, 'Exception'); + $this->debug->groupCollapsed('SoapClient::__construct', $wsdl ?: 'non-WSDL mode', $this->debug->meta('icon', $this->icon)); if ($wsdl && !empty($options['list_functions'])) { $this->debug->log( @@ -299,8 +303,10 @@ private function logConstruct($wsdl, $options, Exception $exception = null) * * @return void */ - private function logReqRes($action, Exception $exception = null, $logParsedFault = false) + private function logReqRes($action, $exception = null, $logParsedFault = false) { + \bdk\Debug\Utility\Php::assertType($exception, 'Exception'); + $fault = null; $xmlRequest = $this->debugGetXmlRequest($action); $xmlResponse = $this->debugGetXmlResponse($fault); diff --git a/src/Debug/Collector/StatementInfo.php b/src/Debug/Collector/StatementInfo.php index 9b25452b..6be5ce6c 100644 --- a/src/Debug/Collector/StatementInfo.php +++ b/src/Debug/Collector/StatementInfo.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -68,7 +68,7 @@ class StatementInfo extends AbstractComponent protected $timeEnd; /** @var float */ protected $timeStart; - /** @var array|null */ + /** @var array */ protected $types; /** @var list */ @@ -96,16 +96,19 @@ class StatementInfo extends AbstractComponent /** * @param string $sql SQL - * @param array|null $params bound params - * @param array $types bound types + * @param array|null $params (optional) bound params + * @param array|null $types (optional) bound types */ - public function __construct($sql, $params = array(), $types = null) + public function __construct($sql, $params = array(), $types = array()) { + \bdk\Debug\Utility\Php::assertType($params, 'array'); + \bdk\Debug\Utility\Php::assertType($types, 'array'); + $this->memoryStart = \memory_get_usage(false); $this->params = $params ?: array(); $this->sql = \trim($sql); $this->timeStart = \microtime(true); - $this->types = $types; + $this->types = $types ?: array(); if (!self::$constants) { $this->setConstants(); } @@ -172,8 +175,10 @@ public function appendLog(Debug $debug, array $metaOverride = array()) * * @return void */ - public function end(Exception $exception = null, $rowCount = null) + public function end($exception = null, $rowCount = null) { + \bdk\Debug\Utility\Php::assertType($exception, 'Exception'); + $this->exception = $exception; $this->rowCount = $rowCount; $this->timeEnd = \microtime(true); @@ -271,7 +276,7 @@ private function getGroupLabel() $afterWhereKeys = array('groupBy', 'having', 'window', 'orderBy', 'limit', 'for'); $afterWhereValues = \array_intersect_key($parsed, \array_flip($afterWhereKeys)); $haveMore = \count($afterWhereValues) > 0; - if ($parsed['where'] && \strlen($parsed['where']) < 30) { + if ($parsed['where'] && \strlen($parsed['where']) < 35) { $label .= $parsed['afterMethod'] ? ' (…)' : ''; $label .= ' WHERE ' . $parsed['where']; } elseif (\array_filter(array($parsed['afterMethod'], $parsed['where']))) { diff --git a/src/Debug/Collector/SwiftMailerLogger.php b/src/Debug/Collector/SwiftMailerLogger.php index df60d194..8b56c2db 100644 --- a/src/Debug/Collector/SwiftMailerLogger.php +++ b/src/Debug/Collector/SwiftMailerLogger.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Collector; @@ -54,14 +54,16 @@ class SwiftMailerLogger implements Swift_Events_CommandListener, Swift_Events_Re /** * Constructor * - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create Slim channel on singleton instance - * if root channel is specified, will create a SwiftMailer channel + * @param Debu|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create Slim channel on singleton instance + * if root channel is specified, will create a SwiftMailer channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null) + public function __construct($debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('SwiftMailer', array('channelIcon' => $this->icon)); } elseif ($debug === $debug->rootInstance) { diff --git a/src/Debug/Collector/TwigExtension.php b/src/Debug/Collector/TwigExtension.php index 2997f411..5a168777 100644 --- a/src/Debug/Collector/TwigExtension.php +++ b/src/Debug/Collector/TwigExtension.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Collector; @@ -30,13 +30,16 @@ class TwigExtension extends ProfilerExtension /** * Constructor * - * @param Debug $debug (optional) Debug instance - * @param Profile $profile (optional) Profile instance + * @param Debug|null $debug (optional) Debug instance + * @param Profile|null $profile (optional) Profile instance * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null, Profile $profile = null) + public function __construct($debug = null, $profile = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + \bdk\Debug\Utility\Php::assertType($profile, 'Twig\Profiler\Profile'); + if (!$debug) { $debug = Debug::getChannel('Twig', array('channelIcon' => $this->icon)); } elseif ($debug === $debug->rootInstance) { diff --git a/src/Debug/Config.php b/src/Debug/Config.php index 236785ed..ceba00e4 100644 --- a/src/Debug/Config.php +++ b/src/Debug/Config.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 1.3.2 */ namespace bdk\Debug; diff --git a/src/Debug/ConfigurableInterface.php b/src/Debug/ConfigurableInterface.php index 0450a27f..5d465ef3 100644 --- a/src/Debug/ConfigurableInterface.php +++ b/src/Debug/ConfigurableInterface.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug; diff --git a/src/Debug/Data.php b/src/Debug/Data.php index 6e639c36..343ab395 100644 --- a/src/Debug/Data.php +++ b/src/Debug/Data.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug; diff --git a/src/Debug/Debug.php b/src/Debug/Debug.php index f425f72e..893cbbf8 100644 --- a/src/Debug/Debug.php +++ b/src/Debug/Debug.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 1.0 * * @link http://www.github.com/bkdotcom/PHPDebugConsole * @link https://developer.mozilla.org/en-US/docs/Web/API/console @@ -79,7 +79,7 @@ * @property-read Debug\Utility\Php $php * @property-read Debug\Utility\PhpDoc $phpDoc * @property-read \Psr\Http\Message\ResponseInterface $response lazy-loaded ResponseInterface (set via writeToResponse) - * @property-read HttpMessage\ServerRequest $serverRequest + * @property-read \bdk\HttpMessage\ServerRequestExtendedInterface $serverRequest * @property-read Debug $rootInstance root "channel" * @property-read Debug\Utility\StringUtil $stringUtil * @property-read Debug\Utility\StopWatch $stopWatch diff --git a/src/Debug/Dump/AbstractValue.php b/src/Debug/Dump/AbstractValue.php index 5437d58d..e036e241 100644 --- a/src/Debug/Dump/AbstractValue.php +++ b/src/Debug/Dump/AbstractValue.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 2.0 */ namespace bdk\Debug\Dump; @@ -75,13 +75,15 @@ public function __construct(Dumper $dumper) /** * Is value a timestamp? * - * @param mixed $val value to check - * @param Abstraction $abs (optional) full abstraction + * @param mixed $val value to check + * @param Abstraction|null $abs (optional) full abstraction * * @return string|false */ - public function checkTimestamp($val, Abstraction $abs = null) + public function checkTimestamp($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if ($abs && $abs['typeMore'] === Type::TYPE_TIMESTAMP) { $datetime = new DateTime('@' . (int) $val); $datetimeStr = $datetime->format('Y-m-d H:i:s T'); @@ -275,12 +277,12 @@ private function dumpAbstractionOpts(Abstraction $abs) /** * Dump array * - * @param array $array array to be dumped - * @param Abstraction $abs (optional) full abstraction + * @param array $array array to be dumped + * @param Abstraction|null $abs (optional) full abstraction * * @return array|string */ - abstract protected function dumpArray(array $array, Abstraction $abs = null); + abstract protected function dumpArray(array $array, $abs = null); /** * Dump boolean @@ -294,22 +296,22 @@ abstract protected function dumpBool($val); /** * Dump float value * - * @param float|int $val float value - * @param Abstraction $abs (optional) full abstraction + * @param float|int $val float value + * @param Abstraction|null $abs (optional) full abstraction * * @return float|string */ - abstract protected function dumpFloat($val, Abstraction $abs = null); + abstract protected function dumpFloat($val, $abs = null); /** * Dump integer value * - * @param int $val integer value - * @param Abstraction $abs (optional) full abstraction + * @param int $val integer value + * @param Abstraction|null $abs (optional) full abstraction * * @return int|string */ - abstract protected function dumpInt($val, Abstraction $abs = null); + abstract protected function dumpInt($val, $abs = null); /** * Dump null value @@ -330,12 +332,12 @@ abstract protected function dumpObject(ObjectAbstraction $abs); /** * Dump string * - * @param string $val string value - * @param Abstraction $abs (optional) full abstraction + * @param string $val string value + * @param Abstraction|null $abs (optional) full abstraction * * @return string */ - abstract protected function dumpString($val, Abstraction $abs = null); + abstract protected function dumpString($val, $abs = null); /** * Escape hex and unicode escape sequences. diff --git a/src/Debug/Dump/Base.php b/src/Debug/Dump/Base.php index 95febc79..7e3aab9f 100644 --- a/src/Debug/Dump/Base.php +++ b/src/Debug/Dump/Base.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Dump; diff --git a/src/Debug/Dump/Base/BaseObject.php b/src/Debug/Dump/Base/BaseObject.php index 33a55665..67dc62ba 100644 --- a/src/Debug/Dump/Base/BaseObject.php +++ b/src/Debug/Dump/Base/BaseObject.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Dump\Base; diff --git a/src/Debug/Dump/Base/Value.php b/src/Debug/Dump/Base/Value.php index 2ab3aab8..6a65ac47 100644 --- a/src/Debug/Dump/Base/Value.php +++ b/src/Debug/Dump/Base/Value.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Dump\Base; @@ -49,8 +49,10 @@ public function markupIdentifier($val) /** * {@inheritDoc} */ - protected function dumpArray(array $array, Abstraction $abs = null) + protected function dumpArray(array $array, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if ($this->optionGet('isMaxDepth')) { return 'array *MAX DEPTH*'; } @@ -104,8 +106,10 @@ protected function dumpConst(Abstraction $abs) /** * {@inheritDoc} */ - protected function dumpFloat($val, Abstraction $abs = null) + protected function dumpFloat($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $date = $this->checkTimestamp($val, $abs); return $date ? $val . ' (' . $date . ')' @@ -115,8 +119,10 @@ protected function dumpFloat($val, Abstraction $abs = null) /** * {@inheritDoc} */ - protected function dumpInt($val, Abstraction $abs = null) + protected function dumpInt($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $val = $this->dumpFloat($val, $abs); return \is_string($val) ? $val @@ -178,8 +184,10 @@ protected function dumpResource(Abstraction $abs) /** * {@inheritDoc} */ - protected function dumpString($val, Abstraction $abs = null) + protected function dumpString($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if (\is_numeric($val)) { $date = $this->checkTimestamp($val, $abs); return $date diff --git a/src/Debug/Dump/Html.php b/src/Debug/Dump/Html.php index 284fe7f1..dae778c5 100644 --- a/src/Debug/Dump/Html.php +++ b/src/Debug/Dump/Html.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Dump; diff --git a/src/Debug/Dump/Html/Group.php b/src/Debug/Dump/Html/Group.php index fa8fb43b..21b47222 100644 --- a/src/Debug/Dump/Html/Group.php +++ b/src/Debug/Dump/Html/Group.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Dump\Html; diff --git a/src/Debug/Dump/Html/Helper.php b/src/Debug/Dump/Html/Helper.php index 2da5912f..1e614ad0 100644 --- a/src/Debug/Dump/Html/Helper.php +++ b/src/Debug/Dump/Html/Helper.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Dump\Html; diff --git a/src/Debug/Dump/Html/HtmlObject.php b/src/Debug/Dump/Html/HtmlObject.php index 02019c01..f1b5970c 100644 --- a/src/Debug/Dump/Html/HtmlObject.php +++ b/src/Debug/Dump/Html/HtmlObject.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.1 */ namespace bdk\Debug\Dump\Html; @@ -17,11 +17,12 @@ use bdk\Debug\Abstraction\Object\Abstraction as ObjectAbstraction; use bdk\Debug\Abstraction\Type; use bdk\Debug\Dump\Html\Helper; -use bdk\Debug\Dump\Html\ObjectCases; -use bdk\Debug\Dump\Html\ObjectConstants; -use bdk\Debug\Dump\Html\ObjectMethods; -use bdk\Debug\Dump\Html\ObjectPhpDoc; -use bdk\Debug\Dump\Html\ObjectProperties; +use bdk\Debug\Dump\Html\Object\Cases; +use bdk\Debug\Dump\Html\Object\Constants; +use bdk\Debug\Dump\Html\Object\ExtendsImplements; +use bdk\Debug\Dump\Html\Object\Methods; +use bdk\Debug\Dump\Html\Object\PhpDoc; +use bdk\Debug\Dump\Html\Object\Properties; use bdk\Debug\Dump\Html\Value as ValDumper; use bdk\Debug\Utility\Html as HtmlUtil; @@ -33,25 +34,28 @@ class HtmlObject /** @var ValDumper */ public $valDumper; - /** @var ObjectCases */ + /** @var Cases */ protected $cases; - /** @var ObjectConstants */ + /** @var Constants */ protected $constants; + /** @var ExtendsImplements */ + protected $extendsImplements; + /** @var Helper */ protected $helper; /** @var HtmlUtil */ protected $html; - /** @var ObjectMethods */ + /** @var Methods */ protected $methods; - /** @var ObjectPhpDoc */ + /** @var PhpDoc */ protected $phpDoc; - /** @var ObjectProperties */ + /** @var Properties */ protected $properties; /** @var array */ @@ -69,17 +73,18 @@ public function __construct(ValDumper $valDumper, Helper $helper, HtmlUtil $html $this->valDumper = $valDumper; $this->helper = $helper; $this->html = $html; - $this->cases = new ObjectCases($valDumper, $helper, $html); - $this->constants = new ObjectConstants($valDumper, $helper, $html); - $this->methods = new ObjectMethods($valDumper, $helper, $html); - $this->phpDoc = new ObjectPhpDoc($valDumper, $helper); - $this->properties = new ObjectProperties($valDumper, $helper, $html); + $this->cases = new Cases($valDumper, $helper, $html); + $this->constants = new Constants($valDumper, $helper, $html); + $this->extendsImplements = new ExtendsImplements($valDumper, $helper, $html); + $this->methods = new Methods($valDumper, $helper, $html); + $this->phpDoc = new PhpDoc($valDumper, $helper); + $this->properties = new Properties($valDumper, $helper, $html); $this->sectionCallables = array( 'attributes' => array($this, 'dumpAttributes'), 'cases' => array($this->cases, 'dump'), 'constants' => array($this->constants, 'dump'), - 'extends' => array($this, 'dumpExtends'), - 'implements' => array($this, 'dumpImplements'), + 'extends' => array($this->extendsImplements, 'dumpExtends'), + 'implements' => array($this->extendsImplements, 'dumpImplements'), 'methods' => array($this->methods, 'dump'), 'phpDoc' => array($this->phpDoc, 'dump'), 'properties' => array($this->properties, 'dump'), @@ -123,39 +128,6 @@ public function dump(ObjectAbstraction $abs) return $this->cleanup($html); } - /** - * Build implements tree - * - * @param list $implements Implements structure - * @param list $interfacesCollapse Interfaces that should initially be hidden - * - * @return string - */ - private function buildImplementsTree(array $implements, array $interfacesCollapse) - { - $str = '
    ' . "\n"; - foreach ($implements as $k => $v) { - $className = \is_array($v) - ? $k - : $v; - $str .= '
  • ' - . $this->html->buildTag( - 'span', - array( - 'class' => array( - 'interface' => true, - 'toggle-off' => \in_array($className, $interfacesCollapse, true), - ), - ), - $this->valDumper->markupIdentifier($className, 'classname') - ) - . (\is_array($v) ? "\n" . self::buildImplementsTree($v, $interfacesCollapse) : '') - . '
  • ' . "\n"; - } - $str .= '
' . "\n"; - return $str; - } - /** * Remove empty tags and unneeded attributes * @@ -166,7 +138,7 @@ private function buildImplementsTree(array $implements, array $interfacesCollaps private function cleanup($html) { // remove
's that have no
' - $html = \preg_replace('#(?:
(?:extends|implements|phpDoc)
\n)+((?:phpDoc)\n)+(sort($attributes, $abs['sort']); - foreach ($attributes as $info) { - $str .= '
' - . $this->valDumper->markupIdentifier($info['name'], 'classname') - . $this->dumpAttributeArgs($info['arguments']) - . '
' . "\n"; - } - return $str; + return '
attributes
' . "\n" + . \implode(\array_map(function ($info) { + return '
' + . $this->valDumper->markupIdentifier($info['name'], 'classname') + . $this->dumpAttributeArgs($info['arguments']) + . '
' . "\n"; + }, $attributes)); } /** @@ -276,36 +247,6 @@ protected function dumpClassName(ObjectAbstraction $abs) )); } - /** - * Dump classNames of classes obj extends - * - * @param ObjectAbstraction $abs Object Abstraction instance - * - * @return string html fragment - */ - protected function dumpExtends(ObjectAbstraction $abs) - { - return '
extends
' . "\n" - . \implode(\array_map(function ($className) { - return '
' . $this->valDumper->markupIdentifier($className, 'classname') . '
' . "\n"; - }, $abs['extends'])); - } - - /** - * Dump classNames of interfaces obj extends - * - * @param ObjectAbstraction $abs Object Abstraction instance - * - * @return string html fragment - */ - protected function dumpImplements(ObjectAbstraction $abs) - { - return empty($abs['implements']) - ? '' - : '
implements
' . "\n" - . '
' . $this->buildImplementsTree($abs['implements'], $abs['interfacesCollapse']) . '
' . "\n"; - } - /** * Dump modifiers (final & readonly) * diff --git a/src/Debug/Dump/Html/HtmlString.php b/src/Debug/Dump/Html/HtmlString.php index 2bcdbb85..a18978c9 100644 --- a/src/Debug/Dump/Html/HtmlString.php +++ b/src/Debug/Dump/Html/HtmlString.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.0b1 */ namespace bdk\Debug\Dump\Html; @@ -82,13 +82,15 @@ public function __get($property) /** * Dump string * - * @param string $val string value - * @param Abstraction $abs (optional) full abstraction + * @param string $val string value + * @param Abstraction|null $abs (optional) full abstraction * * @return string */ - public function dump($val, Abstraction $abs = null) + public function dump($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if (\is_numeric($val)) { $this->valDumper->checkTimestamp($val, $abs); } diff --git a/src/Debug/Dump/Html/HtmlStringBinary.php b/src/Debug/Dump/Html/HtmlStringBinary.php index 5c9a3658..0670c2c2 100644 --- a/src/Debug/Dump/Html/HtmlStringBinary.php +++ b/src/Debug/Dump/Html/HtmlStringBinary.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.3 */ namespace bdk\Debug\Dump\Html; diff --git a/src/Debug/Dump/Html/HtmlStringEncoded.php b/src/Debug/Dump/Html/HtmlStringEncoded.php index 3b2075d8..327d982b 100644 --- a/src/Debug/Dump/Html/HtmlStringEncoded.php +++ b/src/Debug/Dump/Html/HtmlStringEncoded.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0.2 */ namespace bdk\Debug\Dump\Html; diff --git a/src/Debug/Dump/Html/AbstractObjectSection.php b/src/Debug/Dump/Html/Object/AbstractSection.php similarity index 90% rename from src/Debug/Dump/Html/AbstractObjectSection.php rename to src/Debug/Dump/Html/Object/AbstractSection.php index e4661a09..3b816a81 100644 --- a/src/Debug/Dump/Html/AbstractObjectSection.php +++ b/src/Debug/Dump/Html/Object/AbstractSection.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ -namespace bdk\Debug\Dump\Html; +namespace bdk\Debug\Dump\Html\Object; use bdk\Debug\Abstraction\Abstracter; use bdk\Debug\Abstraction\Abstraction; @@ -23,7 +23,7 @@ /** * Base class for dumping object constants/enum-cases/properties/methods */ -abstract class AbstractObjectSection +abstract class AbstractSection { /** @var Helper */ protected $helper; @@ -78,7 +78,7 @@ public function dumpItems(ObjectAbstraction $abs, $what, array $cfg) ), $cfg); return $cfg['groupByInheritance'] ? $this->dumpItemsByInheritance($abs, $cfg) - : $this->dumpItemsFiltered($abs, \array_keys($this->getItems($abs, $cfg)), $cfg); + : $this->dumpItemsFiltered($abs, \array_keys($this->getItems($abs, $what)), $cfg); } /** @@ -157,7 +157,7 @@ protected function dumpItemInner($name, array $info, array $cfg) private function dumpItemsFiltered(ObjectAbstraction $abs, array $keys, array $cfg) { $html = ''; - $items = $this->getItems($abs, $cfg); + $items = $this->getItems($abs, $cfg['what']); $items = \array_intersect_key($items, \array_flip($keys)); $items = $abs->sort($items, $abs['sort']); $absKeys = $abs['keys']; @@ -193,7 +193,7 @@ private function dumpItemsFiltered(ObjectAbstraction $abs, array $keys, array $c private function dumpItemsByInheritance(ObjectAbstraction $abs, array $cfg) { $html = ''; - $items = $this->getItems($abs, $cfg); + $items = $this->getItems($abs, $cfg['what']); $items = $abs->sort($items, $abs['sort']); $itemCount = \count($items); $itemOutCount = 0; @@ -201,7 +201,7 @@ private function dumpItemsByInheritance(ObjectAbstraction $abs, array $cfg) // no sense in showing "inherited from" when no more inherited items // Or, we could only display the heading when itemsFiltered non-empty $className = $abs['className']; - $classes = $this->getInheritedClasses($abs, $abs['what']); + $classes = $this->getInheritedClasses($abs, $cfg['what']); \array_unshift($classes, $className); while ($classes && $itemOutCount < $itemCount) { $classNameCur = \array_shift($classes); @@ -281,23 +281,19 @@ abstract protected function getClasses(array $info); private function getInheritedClasses(ObjectAbstraction $abs, $what) { $classes = $abs['extends']; - if ($what !== 'constants') { - return $classes; + if ($abs['isInterface']) { + // flatten the tree + \preg_match_all('/("[^"]+")/', \json_encode($classes), $matches); + $classes = \array_map('json_decode', $matches[1]); } - // constants can be defined in interface - $implements = $abs['implements']; - $implementsList = array(); - while ($implements) { - $key = \key($implements); - $val = \array_shift($implements); - if (\is_array($val)) { - $implementsList[] = $key; - \array_splice($implements, 0, 0, $val); - continue; - } - $implementsList[] = $val; + if ($what === 'constants') { + // constants can be defined in interface + // flatten the tree + \preg_match_all('/("[^"]+")/', \json_encode($abs['implements']), $matches); + $implementsList = \array_map('json_decode', $matches[1]); + $classes = \array_merge($classes, $implementsList); } - return \array_merge($classes, $implementsList); + return $classes; } /** @@ -305,14 +301,13 @@ private function getInheritedClasses(ObjectAbstraction $abs, $what) * * Extend me for custom filtering * - * @param ObjectAbstraction $abs Object abstraction - * @param array $cfg Config options + * @param ObjectAbstraction $abs Object abstraction + * @param string $what 'cases', 'constants', 'properties', or 'methods' * * @return array */ - protected function getItems(ObjectAbstraction $abs, array $cfg) + protected function getItems(ObjectAbstraction $abs, $what) { - $what = $cfg['what']; // 'cases', 'constants', 'properties', or 'methods' return $abs[$what]; } diff --git a/src/Debug/Dump/Html/ObjectCases.php b/src/Debug/Dump/Html/Object/Cases.php similarity index 94% rename from src/Debug/Dump/Html/ObjectCases.php rename to src/Debug/Dump/Html/Object/Cases.php index 1c9bad4c..74126cf7 100644 --- a/src/Debug/Dump/Html/ObjectCases.php +++ b/src/Debug/Dump/Html/Object/Cases.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ -namespace bdk\Debug\Dump\Html; +namespace bdk\Debug\Dump\Html\Object; use bdk\Debug\Abstraction\AbstractObject; use bdk\Debug\Abstraction\Object\Abstraction as ObjectAbstraction; @@ -18,7 +18,7 @@ /** * Dump object constants and Enum cases as HTML */ -class ObjectCases extends AbstractObjectSection +class Cases extends AbstractSection { /** * Dump enum cases diff --git a/src/Debug/Dump/Html/ObjectConstants.php b/src/Debug/Dump/Html/Object/Constants.php similarity index 95% rename from src/Debug/Dump/Html/ObjectConstants.php rename to src/Debug/Dump/Html/Object/Constants.php index 33d0425b..202368f8 100644 --- a/src/Debug/Dump/Html/ObjectConstants.php +++ b/src/Debug/Dump/Html/Object/Constants.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b2 */ -namespace bdk\Debug\Dump\Html; +namespace bdk\Debug\Dump\Html\Object; use bdk\Debug\Abstraction\AbstractObject; use bdk\Debug\Abstraction\Object\Abstraction as ObjectAbstraction; @@ -18,7 +18,7 @@ /** * Dump object constants as HTML */ -class ObjectConstants extends AbstractObjectSection +class Constants extends AbstractSection { /** * Dump object constants diff --git a/src/Debug/Dump/Html/Object/ExtendsImplements.php b/src/Debug/Dump/Html/Object/ExtendsImplements.php new file mode 100644 index 00000000..176b5b11 --- /dev/null +++ b/src/Debug/Dump/Html/Object/ExtendsImplements.php @@ -0,0 +1,165 @@ + + * @license http://opensource.org/licenses/MIT MIT + * @copyright 2014-2024 Brad Kent + * @since 3.3 + */ + +namespace bdk\Debug\Dump\Html\Object; + +use bdk\Debug\Abstraction\Object\Abstraction as ObjectAbstraction; +use bdk\Debug\Dump\Html\Helper; +use bdk\Debug\Dump\Html\Value as ValDumper; +use bdk\Debug\Utility\Html as HtmlUtil; + +/** + * Dump object constants and Enum cases as HTML + */ +class ExtendsImplements +{ + /** @var Helper */ + protected $helper; + + /** @var HtmlUtil */ + protected $html; + + /** @var ValDumper */ + protected $valDumper; + + /** + * Constructor + * + * @param ValDumper $valDumper Html dumper + * @param Helper $helper Html dump helpers + * @param HtmlUtil $html Html methods + */ + public function __construct(ValDumper $valDumper, Helper $helper, HtmlUtil $html) + { + $this->valDumper = $valDumper; + $this->helper = $helper; + $this->html = $html; + } + + /** + * Dump classNames of classes/interface extended by class/interface + * + * @param ObjectAbstraction $abs Object Abstraction instance + * + * @return string html fragment + */ + public function dumpExtends(ObjectAbstraction $abs) + { + $extends = $this->getItems($abs, 'extends'); + return $this->dumpExtendsImplements($extends, 'extends', 'extends', 'extends'); + } + + /** + * Dump classNames of interfaces obj implements + * + * @param ObjectAbstraction $abs Object Abstraction instance + * + * @return string html fragment + */ + public function dumpImplements(ObjectAbstraction $abs) // array $interfacesCollapse = array() + { + $interfaces = $this->getItems($abs, 'implements'); + return $this->dumpExtendsImplements($interfaces, 'implements', 'implements', 'interface', $abs['interfacesCollapse']); + } + + /** + * Build inheritance tree + * + * This method is used to display + * - interfaces implemented by a class + * - parent interfaces an interface extends (interface may extend multiple interfaces) + * + * @param array $implements Implements structure + * @param string $cssClass CSS class + * @param list $interfacesCollapse Interfaces that should initially be hidden + * + * @return string + */ + private function buildTree(array $implements, $cssClass, array $interfacesCollapse = array()) + { + $str = '
    ' . "\n"; + foreach ($implements as $k => $v) { + $className = \is_array($v) + ? $k + : $v; + $str .= '
  • ' + . $this->html->buildTag( + 'span', + array( + 'class' => array( + $cssClass => true, + 'toggle-off' => \in_array($className, $interfacesCollapse, true), + ), + ), + $this->valDumper->markupIdentifier($className, 'classname') + ) + . (\is_array($v) ? "\n" . self::buildTree($v, $cssClass, $interfacesCollapse) : '') + . '
  • ' . "\n"; + } + $str .= '
' . "\n"; + return $str; + } + + /** + * Dump classNames of classes/interface extended by class/interface + * + * Note: interfaces may extend multiple interfaces (multiple inheritance) + * + * @param array $listOrTree List or tree of classes + * @param string $label "heading" + * @param string $treeClass Tree wrapped in
with this class + * @param string $itemClass Each item in tree or list has this class + * @param array $interfacesCollapse Interfaces that should initially be hidden + * + * @return string html fragment + */ + private function dumpExtendsImplements(array $listOrTree, $label, $treeClass, $itemClass, array $interfacesCollapse = array()) + { + if (empty($listOrTree)) { + return ''; + } + if ($this->valDumper->debug->arrayUtil->isList($listOrTree)) { + return '
' . $label . '
' . "\n" + . \implode(\array_map(function ($className) use ($itemClass, $interfacesCollapse) { + return $this->html->buildTag( + 'dd', + array( + 'class' => array( + $itemClass => true, + 'toggle-off' => \in_array($className, $interfacesCollapse, true), + ), + ), + $this->valDumper->markupIdentifier($className, 'classname') + ) . "\n"; + }, $listOrTree)); + } + return '
' . $label . '
' . "\n" + . '
' . "\n" + . $this->buildTree($listOrTree, $itemClass, $interfacesCollapse) + . '
' . "\n"; + } + + /** + * Get the items to be dumped + * + * Extend me for custom filtering + * + * @param ObjectAbstraction $abs Object abstraction + * @param string $what 'extends' or 'implements' + * + * @return array + */ + protected function getItems(ObjectAbstraction $abs, $what) + { + return $abs[$what]; + } +} diff --git a/src/Debug/Dump/Html/ObjectMethods.php b/src/Debug/Dump/Html/Object/Methods.php similarity index 98% rename from src/Debug/Dump/Html/ObjectMethods.php rename to src/Debug/Dump/Html/Object/Methods.php index e27ae48c..f84bdc64 100644 --- a/src/Debug/Dump/Html/ObjectMethods.php +++ b/src/Debug/Dump/Html/Object/Methods.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ -namespace bdk\Debug\Dump\Html; +namespace bdk\Debug\Dump\Html\Object; use bdk\Debug\Abstraction\Abstracter; use bdk\Debug\Abstraction\Abstraction; @@ -21,7 +21,7 @@ /** * Dump object methods as HTML */ -class ObjectMethods extends AbstractObjectSection +class Methods extends AbstractSection { /** @var array */ protected $opts = array(); @@ -289,6 +289,7 @@ protected function getClasses(array $info) { $visClasses = \array_diff((array) $info['visibility'], array('debug')); $classes = \array_keys(\array_filter(array( + 'isAbstract' => $info['isAbstract'], 'isDeprecated' => $info['isDeprecated'], 'isFinal' => $info['isFinal'], 'isStatic' => $info['isStatic'], diff --git a/src/Debug/Dump/Html/ObjectPhpDoc.php b/src/Debug/Dump/Html/Object/PhpDoc.php similarity index 80% rename from src/Debug/Dump/Html/ObjectPhpDoc.php rename to src/Debug/Dump/Html/Object/PhpDoc.php index 92d5f2e3..ceb40930 100644 --- a/src/Debug/Dump/Html/ObjectPhpDoc.php +++ b/src/Debug/Dump/Html/Object/PhpDoc.php @@ -7,12 +7,12 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ -namespace bdk\Debug\Dump\Html; +namespace bdk\Debug\Dump\Html\Object; -use bdk\Debug\Abstraction\Abstraction; +use bdk\Debug\Abstraction\Object\Abstraction as ObjectAbstraction; use BDK\Debug\Abstraction\Type; use bdk\Debug\Dump\Html\Helper; use bdk\Debug\Dump\Html\Value as ValDumper; @@ -20,7 +20,7 @@ /** * Dump object properties as HTML */ -class ObjectPhpDoc +class PhpDoc { /** @var ValDumper */ public $valDumper; @@ -41,19 +41,21 @@ public function __construct(ValDumper $valDumper, Helper $helper) } /** - * Dump object's phpDoc info + * Dump phpDoc info * - * @param Abstraction $abs Object Abstraction instance + * @param ObjectAbstraction|array $phpDoc Object Abstraction instance or array of phpDoc tags/values * * @return string html fragment */ - public function dump(Abstraction $abs) + public function dump($phpDoc) { + if ($phpDoc instanceof ObjectAbstraction) { + $phpDoc = $phpDoc['phpDoc']; + } + $phpDoc = \array_filter($phpDoc, 'is_array'); + $phpDoc = $this->getItems($phpDoc); $str = '
phpDoc
' . "\n"; - foreach ($abs['phpDoc'] as $tagName => $values) { - if (\is_array($values) === false) { - continue; - } + foreach ($phpDoc as $tagName => $values) { foreach ($values as $tagData) { $tagData['tagName'] = $tagName; $str .= $this->dumpTag($tagData); @@ -133,4 +135,18 @@ private function dumpTagSeeLink(array $tagData) . ' ' . $desc . ''; return \str_replace(' ', '', $info); } + + /** + * Get the phpDoc tags to be dumped + * + * Extend me for custom filtering + * + * @param array $phpDoc info + * + * @return array + */ + protected function getItems(array $phpDoc) + { + return $phpDoc; + } } diff --git a/src/Debug/Dump/Html/ObjectProperties.php b/src/Debug/Dump/Html/Object/Properties.php similarity index 96% rename from src/Debug/Dump/Html/ObjectProperties.php rename to src/Debug/Dump/Html/Object/Properties.php index 217d6c7f..1a7963bb 100644 --- a/src/Debug/Dump/Html/ObjectProperties.php +++ b/src/Debug/Dump/Html/Object/Properties.php @@ -7,10 +7,10 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ -namespace bdk\Debug\Dump\Html; +namespace bdk\Debug\Dump\Html\Object; use bdk\Debug\Abstraction\AbstractObject; use bdk\Debug\Abstraction\Object\Abstraction as ObjectAbstraction; @@ -18,7 +18,7 @@ /** * Dump object properties as HTML */ -class ObjectProperties extends AbstractObjectSection +class Properties extends AbstractSection { /** * Dump object properties as HTML diff --git a/src/Debug/Dump/Html/Table.php b/src/Debug/Dump/Html/Table.php index 508ccf3f..cc3dca1e 100644 --- a/src/Debug/Dump/Html/Table.php +++ b/src/Debug/Dump/Html/Table.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Dump\Html; diff --git a/src/Debug/Dump/Html/Value.php b/src/Debug/Dump/Html/Value.php index 34d90692..87747e05 100644 --- a/src/Debug/Dump/Html/Value.php +++ b/src/Debug/Dump/Html/Value.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Dump\Html; @@ -58,13 +58,15 @@ public function __construct(Dumper $dumper) * Is value a timestamp? * Add classname & title if so * - * @param mixed $val value to check - * @param Abstraction $abs (optional) full abstraction + * @param mixed $val value to check + * @param Abstraction|null $abs (optional) full abstraction * * @return string|false */ - public function checkTimestamp($val, Abstraction $abs = null) + public function checkTimestamp($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $date = parent::checkTimestamp($val, $abs); if ($date) { $this->optionSet('postDump', function ($dumped, $opts) use ($val, $date) { @@ -174,8 +176,10 @@ public function optionSet($what, $val = null) /** * {@inheritDoc} */ - protected function dumpArray(array $array, Abstraction $abs = null) + protected function dumpArray(array $array, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $opts = \array_merge(array( 'asFileTree' => false, 'expand' => null, @@ -284,8 +288,10 @@ protected function dumpConst(Abstraction $abs) /** * {@inheritDoc} */ - protected function dumpFloat($val, Abstraction $abs = null) + protected function dumpFloat($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if ($val === Type::TYPE_FLOAT_INF) { return 'INF'; } @@ -332,13 +338,15 @@ protected function dumpRecursion() /** * Dump string * - * @param string $val string value - * @param Abstraction $abs (optional) full abstraction + * @param string $val string value + * @param Abstraction|null $abs (optional) full abstraction * * @return string */ - protected function dumpString($val, Abstraction $abs = null) + protected function dumpString($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + return $this->string->dump($val, $abs); } diff --git a/src/Debug/Dump/Substitution.php b/src/Debug/Dump/Substitution.php index ec3a38da..f5f488fd 100644 --- a/src/Debug/Dump/Substitution.php +++ b/src/Debug/Dump/Substitution.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Dump; diff --git a/src/Debug/Dump/Text.php b/src/Debug/Dump/Text.php index f8c83953..4d35cb3a 100644 --- a/src/Debug/Dump/Text.php +++ b/src/Debug/Dump/Text.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Dump; diff --git a/src/Debug/Dump/Text/TextObject.php b/src/Debug/Dump/Text/TextObject.php index ddc12abc..34190010 100644 --- a/src/Debug/Dump/Text/TextObject.php +++ b/src/Debug/Dump/Text/TextObject.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 2.0 */ namespace bdk\Debug\Dump\Text; diff --git a/src/Debug/Dump/Text/Value.php b/src/Debug/Dump/Text/Value.php index ba734dea..d905a0f5 100644 --- a/src/Debug/Dump/Text/Value.php +++ b/src/Debug/Dump/Text/Value.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Dump\Text; @@ -80,8 +80,10 @@ protected function addQuotes($val) * * @SuppressWarnings(PHPMD.DevelopmentCodeFragment) */ - protected function dumpArray(array $array, Abstraction $abs = null) + protected function dumpArray(array $array, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $isNested = $this->valDepth > 0; $this->valDepth++; $array = parent::dumpArray($array, $abs); @@ -111,13 +113,15 @@ protected function dumpBool($val) /** * Dump float value * - * @param float $val float value - * @param Abstraction $abs (optional) full abstraction + * @param float $val float value + * @param Abstraction|null $abs (optional) full abstraction * * @return float|string */ - protected function dumpFloat($val, Abstraction $abs = null) + protected function dumpFloat($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if ($val === Type::TYPE_FLOAT_INF) { return 'INF'; } @@ -155,13 +159,15 @@ protected function dumpObject(ObjectAbstraction $abs) /** * Dump string * - * @param string $val string value - * @param Abstraction $abs (optional) full abstraction + * @param string $val string value + * @param Abstraction|null $abs (optional) full abstraction * * @return string */ - protected function dumpString($val, Abstraction $abs = null) + protected function dumpString($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $date = \is_numeric($val) ? $this->checkTimestamp($val, $abs) : null; diff --git a/src/Debug/Dump/TextAnsi.php b/src/Debug/Dump/TextAnsi.php index 790e33b3..f147825e 100644 --- a/src/Debug/Dump/TextAnsi.php +++ b/src/Debug/Dump/TextAnsi.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Dump; diff --git a/src/Debug/Dump/TextAnsi/TextAnsiObject.php b/src/Debug/Dump/TextAnsi/TextAnsiObject.php index 72ce4755..c2a637b4 100644 --- a/src/Debug/Dump/TextAnsi/TextAnsiObject.php +++ b/src/Debug/Dump/TextAnsi/TextAnsiObject.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Dump\TextAnsi; diff --git a/src/Debug/Dump/TextAnsi/Value.php b/src/Debug/Dump/TextAnsi/Value.php index 15462904..95284a20 100644 --- a/src/Debug/Dump/TextAnsi/Value.php +++ b/src/Debug/Dump/TextAnsi/Value.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Dump\TextAnsi; @@ -113,8 +113,10 @@ protected function addQuotes($val) /** * {@inheritDoc} */ - protected function dumpArray(array $array, Abstraction $abs = null) + protected function dumpArray(array $array, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $this->valDepth++; $isNested = $this->valDepth > 0; $escapeCodes = $this->cfg['escapeCodes']; @@ -196,13 +198,15 @@ protected function dumpConst(Abstraction $abs) /** * Dump float value * - * @param float $val float value - * @param Abstraction $abs (optional) full abstraction + * @param float $val float value + * @param Abstraction|null $abs (optional) full abstraction * * @return float|string */ - protected function dumpFloat($val, Abstraction $abs = null) + protected function dumpFloat($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if ($val === Type::TYPE_FLOAT_INF) { $val = 'INF'; } elseif ($val === Type::TYPE_FLOAT_NAN) { @@ -252,13 +256,15 @@ protected function dumpRecursion() /** * Dump string * - * @param string $val string value - * @param Abstraction $abs (optional) full abstraction + * @param string $val string value + * @param Abstraction|null $abs (optional) full abstraction * * @return string */ - protected function dumpString($val, Abstraction $abs = null) + protected function dumpString($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + if (\is_numeric($val)) { return $this->dumpStringNumeric($val, $abs); } @@ -324,13 +330,15 @@ protected function dumpStringBinary(Abstraction $abs) /** * Dump numeric string * - * @param string $val numeric string value - * @param Abstraction $abs (optional) full abstraction + * @param string $val numeric string value + * @param Abstraction|null $abs (optional) full abstraction * * @return string */ - private function dumpStringNumeric($val, Abstraction $abs = null) + private function dumpStringNumeric($val, $abs = null) { + \bdk\Debug\Utility\Php::assertType($abs, 'bdk\Debug\Abstraction\Abstraction'); + $escapeCodes = $this->cfg['escapeCodes']; $date = $this->checkTimestamp($val, $abs); $val = $escapeCodes['numeric'] . $val . $this->escapeReset; diff --git a/src/Debug/Framework/Cake4.php b/src/Debug/Framework/Cake4.php index 80feefe1..e3e68452 100644 --- a/src/Debug/Framework/Cake4.php +++ b/src/Debug/Framework/Cake4.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3.1 */ namespace bdk\Debug\Framework; diff --git a/src/Debug/Framework/Laravel/CacheEventsSubscriber.php b/src/Debug/Framework/Laravel/CacheEventsSubscriber.php index 51bcd94f..3c6c7f19 100644 --- a/src/Debug/Framework/Laravel/CacheEventsSubscriber.php +++ b/src/Debug/Framework/Laravel/CacheEventsSubscriber.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Laravel; @@ -45,15 +45,17 @@ class CacheEventsSubscriber /** * Constructor * - * @param array $options Options - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create PDO channel on singleton instance - * if root channel is specified, will create a PDO channel + * @param array $options Options + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create PDO channel on singleton instance + * if root channel is specified, will create a PDO channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct($options = array(), Debug $debug = null) + public function __construct($options = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->options = \array_merge($this->options, $options); $channelOptions = array( 'channelIcon' => $this->options['icon'], diff --git a/src/Debug/Framework/Laravel/EventServiceProvider.php b/src/Debug/Framework/Laravel/EventServiceProvider.php index 8ac30b59..4929d3d9 100644 --- a/src/Debug/Framework/Laravel/EventServiceProvider.php +++ b/src/Debug/Framework/Laravel/EventServiceProvider.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Laravel; diff --git a/src/Debug/Framework/Laravel/EventsSubscriber.php b/src/Debug/Framework/Laravel/EventsSubscriber.php index ef1d68ed..ef918d8c 100644 --- a/src/Debug/Framework/Laravel/EventsSubscriber.php +++ b/src/Debug/Framework/Laravel/EventsSubscriber.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Laravel; @@ -33,14 +33,16 @@ class EventsSubscriber /** * Constructor * - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create PDO channel on singleton instance - * if root channel is specified, will create a PDO channel + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create PDO channel on singleton instance + * if root channel is specified, will create a PDO channel * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null) + public function __construct($debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $channelOptions = array( 'channelIcon' => $this->icon, 'channelShow' => false, diff --git a/src/Debug/Framework/Laravel/LogDb.php b/src/Debug/Framework/Laravel/LogDb.php index aeba699b..8e633a5f 100644 --- a/src/Debug/Framework/Laravel/LogDb.php +++ b/src/Debug/Framework/Laravel/LogDb.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Framework\Laravel; diff --git a/src/Debug/Framework/Laravel/LogViews.php b/src/Debug/Framework/Laravel/LogViews.php index e4e116cd..2d038548 100644 --- a/src/Debug/Framework/Laravel/LogViews.php +++ b/src/Debug/Framework/Laravel/LogViews.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Framework\Laravel; diff --git a/src/Debug/Framework/Laravel/Middleware.php b/src/Debug/Framework/Laravel/Middleware.php index abdbfe61..cea42149 100644 --- a/src/Debug/Framework/Laravel/Middleware.php +++ b/src/Debug/Framework/Laravel/Middleware.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Laravel; @@ -100,12 +100,14 @@ public function handle(Request $request, Closure $next) /** * Get displayed user information * - * @param User $user user interface + * @param User|null $user user interface * * @return array */ - protected function getUserInformation(User $user = null) + protected function getUserInformation($user = null) { + \bdk\Debug\Utility\Php::assertType($user, 'Illuminate\Foundation\Auth\User'); + // Defaults if ($user === null) { return array( diff --git a/src/Debug/Framework/Laravel/ServiceProvider.php b/src/Debug/Framework/Laravel/ServiceProvider.php index 1e5a06a2..f5e5317f 100644 --- a/src/Debug/Framework/Laravel/ServiceProvider.php +++ b/src/Debug/Framework/Laravel/ServiceProvider.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Laravel; diff --git a/src/Debug/Framework/Slim2.php b/src/Debug/Framework/Slim2.php index 90c7a647..5b5e11c6 100644 --- a/src/Debug/Framework/Slim2.php +++ b/src/Debug/Framework/Slim2.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Framework; @@ -31,15 +31,18 @@ class Slim2 /** * Constructor * - * @param Debug $debug (optional) Specify PHPDebugConsole instance - * if not passed, will create Slim channel on singleton instance - * if root channel is specified, will create a Slim channel - * @param object $prevWriter (optional) previous slim logWriter if desired to continue writing to existing writer + * @param Debug|null $debug (optional) Specify PHPDebugConsole instance + * if not passed, will create Slim channel on singleton instance + * if root channel is specified, will create a Slim channel + * @param object $prevWriter (optional) previous slim logWriter if desired to continue writing to existing writer * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null, $prevWriter = null) + public function __construct($debug = null, $prevWriter = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + \bdk\Debug\Utility\Php::assertType($prevWriter, 'object'); // object not avail as type-hint until php 7.2 + if (!$debug) { $debug = Debug::getChannel('Slim'); } elseif ($debug === $debug->rootInstance) { diff --git a/src/Debug/Framework/Symfony/DebugBundle/BdkDebugBundle.php b/src/Debug/Framework/Symfony/DebugBundle/BdkDebugBundle.php index a5dcb674..a803493e 100644 --- a/src/Debug/Framework/Symfony/DebugBundle/BdkDebugBundle.php +++ b/src/Debug/Framework/Symfony/DebugBundle/BdkDebugBundle.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Symfony\DebugBundle; diff --git a/src/Debug/Framework/Symfony/DebugBundle/DependencyInjection/BdkDebugExtension.php b/src/Debug/Framework/Symfony/DebugBundle/DependencyInjection/BdkDebugExtension.php index d5bbba10..9726f58d 100644 --- a/src/Debug/Framework/Symfony/DebugBundle/DependencyInjection/BdkDebugExtension.php +++ b/src/Debug/Framework/Symfony/DebugBundle/DependencyInjection/BdkDebugExtension.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Symfony\DebugBundle\DependencyInjection; diff --git a/src/Debug/Framework/Symfony/DebugBundle/EventListener/BdkDebugBundleListener.php b/src/Debug/Framework/Symfony/DebugBundle/EventListener/BdkDebugBundleListener.php index a1e1d538..c1f6deaa 100644 --- a/src/Debug/Framework/Symfony/DebugBundle/EventListener/BdkDebugBundleListener.php +++ b/src/Debug/Framework/Symfony/DebugBundle/EventListener/BdkDebugBundleListener.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Symfony\DebugBundle\EventListener; diff --git a/src/Debug/Framework/Yii1_1/Component.php b/src/Debug/Framework/Yii1_1/Component.php index 30c913ea..1fc52e3f 100644 --- a/src/Debug/Framework/Yii1_1/Component.php +++ b/src/Debug/Framework/Yii1_1/Component.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Framework\Yii1_1; diff --git a/src/Debug/Framework/Yii1_1/ErrorLogger.php b/src/Debug/Framework/Yii1_1/ErrorLogger.php index 35325364..033b0fb2 100644 --- a/src/Debug/Framework/Yii1_1/ErrorLogger.php +++ b/src/Debug/Framework/Yii1_1/ErrorLogger.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Yii1_1; diff --git a/src/Debug/Framework/Yii1_1/EventSubscribers.php b/src/Debug/Framework/Yii1_1/EventSubscribers.php index 7f516d9a..3a8e45d0 100644 --- a/src/Debug/Framework/Yii1_1/EventSubscribers.php +++ b/src/Debug/Framework/Yii1_1/EventSubscribers.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.3 */ namespace bdk\Debug\Framework\Yii1_1; diff --git a/src/Debug/Framework/Yii1_1/LogRoute.php b/src/Debug/Framework/Yii1_1/LogRoute.php index a28ba4c1..0583d6da 100644 --- a/src/Debug/Framework/Yii1_1/LogRoute.php +++ b/src/Debug/Framework/Yii1_1/LogRoute.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Framework\Yii1_1; @@ -57,13 +57,15 @@ class LogRoute extends CLogRoute /** * Constructor * - * @param Debug $debug Debug instance - * @param array $opts Route options + * @param Debug|null $debug Debug instance + * @param array $opts Route options * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null, $opts = array()) + public function __construct($debug = null, $opts = array()) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('Yii'); } elseif ($debug === $debug->rootInstance) { diff --git a/src/Debug/Framework/Yii1_1/LogRouteMeta.php b/src/Debug/Framework/Yii1_1/LogRouteMeta.php index 0826f498..302e1361 100644 --- a/src/Debug/Framework/Yii1_1/LogRouteMeta.php +++ b/src/Debug/Framework/Yii1_1/LogRouteMeta.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Framework\Yii1_1; diff --git a/src/Debug/Framework/Yii1_1/PdoCollector.php b/src/Debug/Framework/Yii1_1/PdoCollector.php index 8dc3292b..87990021 100644 --- a/src/Debug/Framework/Yii1_1/PdoCollector.php +++ b/src/Debug/Framework/Yii1_1/PdoCollector.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.3 */ namespace bdk\Debug\Framework\Yii1_1; @@ -40,12 +40,14 @@ public function __construct(CApplicationComponent $component) * Setup up PDO collector * Log to PDO channel * - * @param CDbConnection $dbConnection CDbConnection instance + * @param CDbConnection|null $dbConnection CDbConnection instance * * @return void */ - public function collect(CDbConnection $dbConnection = null) + public function collect($dbConnection = null) { + \bdk\Debug\Utility\Php::assertType($dbConnection, 'CDbConnection'); + if ($this->component->shouldCollect('pdo') === false) { return; } @@ -84,7 +86,7 @@ private function pdoGetChannel(CDbConnection $dbConnection) } /** - * Attache PDO Collector to db connection + * Attach PDO Collector to db connection * * @param CDbConnection $dbConnection CDbConnection instance * @param Pdo $pdoCollector PDO collector instance diff --git a/src/Debug/Framework/Yii1_1/UserInfo.php b/src/Debug/Framework/Yii1_1/UserInfo.php index 7caa14f4..723794f5 100644 --- a/src/Debug/Framework/Yii1_1/UserInfo.php +++ b/src/Debug/Framework/Yii1_1/UserInfo.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.3 */ namespace bdk\Debug\Framework\Yii1_1; diff --git a/src/Debug/Framework/Yii2/CollectEvents.php b/src/Debug/Framework/Yii2/CollectEvents.php index e9c93a7a..524a6722 100644 --- a/src/Debug/Framework/Yii2/CollectEvents.php +++ b/src/Debug/Framework/Yii2/CollectEvents.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Framework\Yii2; diff --git a/src/Debug/Framework/Yii2/EventSubscribers.php b/src/Debug/Framework/Yii2/EventSubscribers.php index 9390cd32..dc27f2c2 100644 --- a/src/Debug/Framework/Yii2/EventSubscribers.php +++ b/src/Debug/Framework/Yii2/EventSubscribers.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Framework\Yii2; diff --git a/src/Debug/Framework/Yii2/LogTarget.php b/src/Debug/Framework/Yii2/LogTarget.php index fc3c2722..739f0135 100644 --- a/src/Debug/Framework/Yii2/LogTarget.php +++ b/src/Debug/Framework/Yii2/LogTarget.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Yii2; @@ -44,13 +44,15 @@ class LogTarget extends Target /** * Constructor * - * @param Debug $debug Debug instance - * @param array $config Configuration + * @param Debug|null $debug Debug instance + * @param array $config Configuration * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null, $config = array()) + public function __construct($debug = null, $config = array()) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getChannel('Yii'); } elseif ($debug === $debug->rootInstance) { diff --git a/src/Debug/Framework/Yii2/LogUser.php b/src/Debug/Framework/Yii2/LogUser.php index ffb4ffb4..74d2bcc7 100644 --- a/src/Debug/Framework/Yii2/LogUser.php +++ b/src/Debug/Framework/Yii2/LogUser.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Framework\Yii2; diff --git a/src/Debug/Framework/Yii2/Module.php b/src/Debug/Framework/Yii2/Module.php index b154698c..eadb7e27 100644 --- a/src/Debug/Framework/Yii2/Module.php +++ b/src/Debug/Framework/Yii2/Module.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Framework\Yii2; diff --git a/src/Debug/LogEntry.php b/src/Debug/LogEntry.php index d862b082..efc582b3 100644 --- a/src/Debug/LogEntry.php +++ b/src/Debug/LogEntry.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug; diff --git a/src/Debug/Plugin/AbstractLogReqRes.php b/src/Debug/Plugin/AbstractLogReqRes.php index 5efa5c68..aeba901b 100644 --- a/src/Debug/Plugin/AbstractLogReqRes.php +++ b/src/Debug/Plugin/AbstractLogReqRes.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.1 */ namespace bdk\Debug\Plugin; @@ -77,27 +77,26 @@ protected function assertCorrectContentType($contentTypeDetected, $contentTypeUs /** * Inspect content to determine mime-type * - * @param StreamInterface|string $content Request/response body - * @param string $contentTypeUser Content-Type provided with request or being sent with response + * @param StreamInterface|string $content Request/response body + * @param string $mediaTypeUser Media-Type provided with request or being sent with response * * @return string|null The detected content-type. may contain the supplied character encoding / boundary */ - protected function detectContentType($content, $contentTypeUser) + protected function detectContentType($content, $mediaTypeUser) { - $ctuTrimmed = \preg_replace('/\s*[;,].*$/', '', (string) $contentTypeUser); - $contentTypeDetected = $this->debug->stringUtil->contentType($content); + $mediaTypeDetected = $this->debug->stringUtil->contentType($content); $xmlTypes = array(ContentType::XML, 'application/xml'); - $userIsXml = \in_array($ctuTrimmed, $xmlTypes, true) - || \preg_match('/application\\/\S+\+xml/', $ctuTrimmed); + $userIsXml = \in_array($mediaTypeUser, $xmlTypes, true) + || \preg_match('/application\\/\S+\+xml/', $mediaTypeUser); if ( \array_filter(array( - \in_array($contentTypeDetected, $xmlTypes, true) && $userIsXml, - $contentTypeDetected === ContentType::TXT && \in_array($ctuTrimmed, array(ContentType::FORM, ContentType::FORM_MULTIPART), true), - $contentTypeDetected === 'application/x-empty', + \in_array($mediaTypeDetected, $xmlTypes, true) && $userIsXml, + $mediaTypeDetected === ContentType::TXT && \in_array($mediaTypeUser, array(ContentType::FORM, ContentType::FORM_MULTIPART), true), + $mediaTypeDetected === 'application/x-empty', )) ) { - $contentTypeDetected = $contentTypeUser; + $mediaTypeDetected = $mediaTypeUser; } - return $contentTypeDetected; + return $mediaTypeDetected; } } diff --git a/src/Debug/Plugin/AssertSettingTrait.php b/src/Debug/Plugin/AssertSettingTrait.php index 7db07844..7241908e 100644 --- a/src/Debug/Plugin/AssertSettingTrait.php +++ b/src/Debug/Plugin/AssertSettingTrait.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2025 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Channel.php b/src/Debug/Plugin/Channel.php index 012860ca..f3524823 100644 --- a/src/Debug/Plugin/Channel.php +++ b/src/Debug/Plugin/Channel.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/ConfigEvents.php b/src/Debug/Plugin/ConfigEvents.php index c1364dbf..d60eba69 100644 --- a/src/Debug/Plugin/ConfigEvents.php +++ b/src/Debug/Plugin/ConfigEvents.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/CustomMethodTrait.php b/src/Debug/Plugin/CustomMethodTrait.php index dd65bcee..0e41e6f9 100644 --- a/src/Debug/Plugin/CustomMethodTrait.php +++ b/src/Debug/Plugin/CustomMethodTrait.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Highlight.php b/src/Debug/Plugin/Highlight.php index 1108ae91..ea826078 100644 --- a/src/Debug/Plugin/Highlight.php +++ b/src/Debug/Plugin/Highlight.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/InternalEvents.php b/src/Debug/Plugin/InternalEvents.php index 1ed71abf..55130ab1 100644 --- a/src/Debug/Plugin/InternalEvents.php +++ b/src/Debug/Plugin/InternalEvents.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/LogEnv.php b/src/Debug/Plugin/LogEnv.php index 3aeb00bd..309e1b45 100644 --- a/src/Debug/Plugin/LogEnv.php +++ b/src/Debug/Plugin/LogEnv.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/LogFiles.php b/src/Debug/Plugin/LogFiles.php index 39e66c4b..c73d8260 100644 --- a/src/Debug/Plugin/LogFiles.php +++ b/src/Debug/Plugin/LogFiles.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/LogPhp.php b/src/Debug/Plugin/LogPhp.php index 8cb21b52..b03d7b41 100644 --- a/src/Debug/Plugin/LogPhp.php +++ b/src/Debug/Plugin/LogPhp.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/LogRequest.php b/src/Debug/Plugin/LogRequest.php index 3aa8338f..ab9528bf 100644 --- a/src/Debug/Plugin/LogRequest.php +++ b/src/Debug/Plugin/LogRequest.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3.1 */ namespace bdk\Debug\Plugin; @@ -168,23 +168,22 @@ private function logPostOrInput() } $request = $this->debug->serverRequest; $method = $request->getMethod(); - $contentTypeUser = $request->getHeaderLine('Content-Type'); - $contentType = $this->detectContentType( + $mediaTypeUser = (string) $request->getMediaType(); + $mediaType = $this->detectContentType( $this->debug->utility->getStreamContents($request->getBody()), - $contentTypeUser + $mediaTypeUser ); - $contentTypeTrimmed = \preg_replace('/\s*[;,].*$/', '', (string) $contentType); $parsedBody = $request->getParsedBody(); - $this->assertCorrectContentType($contentType, $contentTypeUser, $method); + $this->assertCorrectContentType($mediaType, $mediaTypeUser, $method); if ( $method === 'POST' - && \in_array($contentTypeTrimmed, array(ContentType::FORM, ContentType::FORM_MULTIPART), true) + && \in_array($mediaType, array(ContentType::FORM, ContentType::FORM_MULTIPART), true) && $parsedBody ) { $this->debug->log('$_POST', $parsedBody, $this->debug->meta('redact')); return; } - $this->logInput($method, $contentType); + $this->logInput($method, $mediaType); } /** diff --git a/src/Debug/Plugin/LogResponse.php b/src/Debug/Plugin/LogResponse.php index fd6a0db5..2e166f2c 100644 --- a/src/Debug/Plugin/LogResponse.php +++ b/src/Debug/Plugin/LogResponse.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Manager.php b/src/Debug/Plugin/Manager.php index 477f250e..176f9e4c 100644 --- a/src/Debug/Plugin/Manager.php +++ b/src/Debug/Plugin/Manager.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Method/Alert.php b/src/Debug/Plugin/Method/Alert.php index ce8d0346..ab91c066 100644 --- a/src/Debug/Plugin/Method/Alert.php +++ b/src/Debug/Plugin/Method/Alert.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Basic.php b/src/Debug/Plugin/Method/Basic.php index 036d5261..bbbb550c 100644 --- a/src/Debug/Plugin/Method/Basic.php +++ b/src/Debug/Plugin/Method/Basic.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Clear.php b/src/Debug/Plugin/Method/Clear.php index 477aec7e..5fdace4b 100644 --- a/src/Debug/Plugin/Method/Clear.php +++ b/src/Debug/Plugin/Method/Clear.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.2 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Count.php b/src/Debug/Plugin/Method/Count.php index d31e71cc..68e5e585 100644 --- a/src/Debug/Plugin/Method/Count.php +++ b/src/Debug/Plugin/Method/Count.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/General.php b/src/Debug/Plugin/Method/General.php index 5fd9710e..8becf7f8 100644 --- a/src/Debug/Plugin/Method/General.php +++ b/src/Debug/Plugin/Method/General.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Group.php b/src/Debug/Plugin/Method/Group.php index f80ca3e1..d80d0575 100644 --- a/src/Debug/Plugin/Method/Group.php +++ b/src/Debug/Plugin/Method/Group.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/GroupCleanup.php b/src/Debug/Plugin/Method/GroupCleanup.php index 81d334ee..faa43276 100644 --- a/src/Debug/Plugin/Method/GroupCleanup.php +++ b/src/Debug/Plugin/Method/GroupCleanup.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/GroupStack.php b/src/Debug/Plugin/Method/GroupStack.php index e32df089..97f3b2c5 100644 --- a/src/Debug/Plugin/Method/GroupStack.php +++ b/src/Debug/Plugin/Method/GroupStack.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Output.php b/src/Debug/Plugin/Method/Output.php index 2bca5f62..84c7c62c 100644 --- a/src/Debug/Plugin/Method/Output.php +++ b/src/Debug/Plugin/Method/Output.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Profile.php b/src/Debug/Plugin/Method/Profile.php index 7ee7a6ef..b903f5b0 100644 --- a/src/Debug/Plugin/Method/Profile.php +++ b/src/Debug/Plugin/Method/Profile.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/ReqRes.php b/src/Debug/Plugin/Method/ReqRes.php index 0746e182..8979886e 100644 --- a/src/Debug/Plugin/Method/ReqRes.php +++ b/src/Debug/Plugin/Method/ReqRes.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; @@ -16,7 +16,6 @@ use bdk\Debug\Plugin\CustomMethodTrait; use bdk\HttpMessage\Utility\HttpFoundationBridge; use bdk\HttpMessage\Utility\Response as ResponseUtil; -use bdk\PubSub\Event; use bdk\PubSub\SubscriberInterface; use InvalidArgumentException; use Psr\Http\Message\ResponseInterface; // PSR-7 @@ -29,9 +28,6 @@ class ReqRes implements SubscriberInterface { use CustomMethodTrait; - /** @var array */ - private $serverParams = array(); - /** @var string[] */ protected $methods = array( 'getHeaders', @@ -51,7 +47,6 @@ class ReqRes implements SubscriberInterface public function getSubscriptions() { return array( - Debug::EVENT_CONFIG => array('onConfig', PHP_INT_MAX), Debug::EVENT_CUSTOM_METHOD => 'onCustomMethod', ); } @@ -187,7 +182,8 @@ public function getResponseHeaders($asString = false) /** * Get $_SERVER param/value - * Gets serverParams from serverRequest interface + * + * Gets server param from serverRequest interface * * @param string $name $_SERVER key/name * @param mixed $default default value @@ -196,12 +192,7 @@ public function getResponseHeaders($asString = false) */ public function getServerParam($name, $default = null) { - if (!$this->serverParams) { - $this->serverParams = $this->debug->serverRequest->getServerParams(); - } - return \array_key_exists($name, $this->serverParams) - ? $this->serverParams[$name] - : $default; + return $this->debug->serverRequest->getServerParam($name, $default); } /** @@ -216,21 +207,6 @@ public function isCli($usePsr7 = true) return \strpos($this->getInterface($usePsr7), 'cli') === 0; } - /** - * Debug::EVENT_CONFIG subscriber - * - * @param Event $event Event instance - * - * @return void - */ - public function onConfig(Event $event) - { - $configs = $event->getValues(); - if (isset($configs['debug']['serviceProvider'])) { - $this->serverParams = array(); - } - } - /** * Generate a unique request id * diff --git a/src/Debug/Plugin/Method/Table.php b/src/Debug/Plugin/Method/Table.php index 75446f1d..fe1bfa8e 100644 --- a/src/Debug/Plugin/Method/Table.php +++ b/src/Debug/Plugin/Method/Table.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Time.php b/src/Debug/Plugin/Method/Time.php index 591f8a57..c41b5af7 100644 --- a/src/Debug/Plugin/Method/Time.php +++ b/src/Debug/Plugin/Method/Time.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Method/Trace.php b/src/Debug/Plugin/Method/Trace.php index 9be26c17..f34ea76c 100644 --- a/src/Debug/Plugin/Method/Trace.php +++ b/src/Debug/Plugin/Method/Trace.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Plugin\Method; diff --git a/src/Debug/Plugin/Prettify.php b/src/Debug/Plugin/Prettify.php index 0d0c5786..3948d341 100644 --- a/src/Debug/Plugin/Prettify.php +++ b/src/Debug/Plugin/Prettify.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Redaction.php b/src/Debug/Plugin/Redaction.php index f3a46210..c85173cb 100644 --- a/src/Debug/Plugin/Redaction.php +++ b/src/Debug/Plugin/Redaction.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0b1 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Route.php b/src/Debug/Plugin/Route.php index 54603b61..fc38eaf4 100644 --- a/src/Debug/Plugin/Route.php +++ b/src/Debug/Plugin/Route.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/Plugin/Runtime.php b/src/Debug/Plugin/Runtime.php index 2a427b21..5a22f88a 100644 --- a/src/Debug/Plugin/Runtime.php +++ b/src/Debug/Plugin/Runtime.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.5 */ namespace bdk\Debug\Plugin; diff --git a/src/Debug/PluginInterface.php b/src/Debug/PluginInterface.php index 96f29251..bd882802 100644 --- a/src/Debug/PluginInterface.php +++ b/src/Debug/PluginInterface.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3 */ namespace bdk\Debug; diff --git a/src/Debug/Psr15/Middleware.php b/src/Debug/Psr15/Middleware.php index d3865776..46699ec7 100644 --- a/src/Debug/Psr15/Middleware.php +++ b/src/Debug/Psr15/Middleware.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Psr15; @@ -33,13 +33,15 @@ class Middleware extends AbstractComponent implements MiddlewareInterface /** * Constructor * - * @param Debug $debug (optional) Debug instance (will use singleton if not provided) - * @param array $cfg config/options + * @param Debug|null $debug (optional) Debug instance (will use singleton if not provided) + * @param array $cfg config/options * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null, $cfg = array()) + public function __construct($debug = null, $cfg = array()) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->debug = $debug ?: Debug::getInstance(); $this->cfg = \array_merge(array( 'catchException' => false, diff --git a/src/Debug/Psr3/MethodSignatureCompatTrait.php b/src/Debug/Psr3/CompatTrait.php similarity index 83% rename from src/Debug/Psr3/MethodSignatureCompatTrait.php rename to src/Debug/Psr3/CompatTrait.php index e768c8a8..1cb21887 100644 --- a/src/Debug/Psr3/MethodSignatureCompatTrait.php +++ b/src/Debug/Psr3/CompatTrait.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0.1 */ namespace bdk\Debug\Psr3; @@ -22,17 +22,17 @@ if (\method_exists($refMethod, 'hasReturnType') && $refMethod->hasReturnType()) { // psr/log 3.0 - require __DIR__ . '/MethodSignatureCompatTrait_3.php'; + require __DIR__ . '/CompatTrait_3.php'; } elseif (\method_exists($refParameters[1], 'hasType') && $refParameters[1]->hasType()) { // psr/log 2.0 - require __DIR__ . '/MethodSignatureCompatTrait_2.php'; -} elseif (\trait_exists(__NAMESPACE__ . '\\MethodSignatureCompatTrait', false) === false) { + require __DIR__ . '/CompatTrait_2.php'; +} elseif (\trait_exists(__NAMESPACE__ . '\\CompatTrait', false) === false) { /** * psr/log 1.0 * * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ - trait MethodSignatureCompatTrait + trait CompatTrait { /** * Logs with an arbitrary level. diff --git a/src/Debug/Psr3/MethodSignatureCompatTrait_2.php b/src/Debug/Psr3/CompatTrait_2.php similarity index 87% rename from src/Debug/Psr3/MethodSignatureCompatTrait_2.php rename to src/Debug/Psr3/CompatTrait_2.php index e266f8e5..5ae2d186 100644 --- a/src/Debug/Psr3/MethodSignatureCompatTrait_2.php +++ b/src/Debug/Psr3/CompatTrait_2.php @@ -6,13 +6,13 @@ Wrap in condition. PHPUnit code coverage scans all files and will conflict */ -if (\trait_exists(__NAMESPACE__ . '\\MethodSignatureCompatTrait', false) === false) { +if (\trait_exists(__NAMESPACE__ . '\\CompatTrait', false) === false) { /** * Provide log method with signature compatible with psr/log v2 * * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ - trait MethodSignatureCompatTrait + trait CompatTrait { /** * Logs with an arbitrary level. diff --git a/src/Debug/Psr3/MethodSignatureCompatTrait_3.php b/src/Debug/Psr3/CompatTrait_3.php similarity index 87% rename from src/Debug/Psr3/MethodSignatureCompatTrait_3.php rename to src/Debug/Psr3/CompatTrait_3.php index 9930c7e7..e560ef33 100644 --- a/src/Debug/Psr3/MethodSignatureCompatTrait_3.php +++ b/src/Debug/Psr3/CompatTrait_3.php @@ -6,13 +6,13 @@ Wrap in condition. PHPUnit code coverage scans all files and will conflict */ -if (\trait_exists(__NAMESPACE__ . '\\MethodSignatureCompatTrait', false) === false) { +if (\trait_exists(__NAMESPACE__ . '\\CompatTrait', false) === false) { /** * Provide log method with signature compatible with psr/log v3 * * @phpcs:disable Generic.Classes.DuplicateClassName.Found */ - trait MethodSignatureCompatTrait + trait CompatTrait { /** * Logs with an arbitrary level. diff --git a/src/Debug/Psr3/Logger.php b/src/Debug/Psr3/Logger.php index 7706ce8f..a172c2d2 100644 --- a/src/Debug/Psr3/Logger.php +++ b/src/Debug/Psr3/Logger.php @@ -7,14 +7,14 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Psr3; use bdk\Debug; use bdk\Debug\LogEntry; -use bdk\Debug\Psr3\MethodSignatureCompatTrait; +use bdk\Debug\Psr3\CompatTrait; use Psr\Log\AbstractLogger; use Psr\Log\InvalidArgumentException; use Psr\Log\LogLevel; @@ -25,7 +25,7 @@ class Logger extends AbstractLogger { // define the log method with the appropriate method signature - use MethodSignatureCompatTrait; + use CompatTrait; /** @var Debug */ public $debug; @@ -48,12 +48,14 @@ class Logger extends AbstractLogger /** * Constructor * - * @param Debug $debug Debug instance + * @param Debug|null $debug Debug instance * * @SuppressWarnings(PHPMD.StaticAccess) */ - public function __construct(Debug $debug = null) + public function __construct($debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = Debug::getInstance(); } diff --git a/src/Debug/Route/AbstractErrorRoute.php b/src/Debug/Route/AbstractErrorRoute.php index 38a8fd82..e6ab43e2 100644 --- a/src/Debug/Route/AbstractErrorRoute.php +++ b/src/Debug/Route/AbstractErrorRoute.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.0.4 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/AbstractRoute.php b/src/Debug/Route/AbstractRoute.php index 2666ce29..aad19695 100644 --- a/src/Debug/Route/AbstractRoute.php +++ b/src/Debug/Route/AbstractRoute.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/ChromeLogger.php b/src/Debug/Route/ChromeLogger.php index 89b3d858..b273a904 100644 --- a/src/Debug/Route/ChromeLogger.php +++ b/src/Debug/Route/ChromeLogger.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 * * @see https://craig.is/writing/chrome-logger/techspecs */ diff --git a/src/Debug/Route/Discord.php b/src/Debug/Route/Discord.php index 97635b64..37505efe 100644 --- a/src/Debug/Route/Discord.php +++ b/src/Debug/Route/Discord.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.4 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Email.php b/src/Debug/Route/Email.php index 4ad529d4..7e9e175e 100644 --- a/src/Debug/Route/Email.php +++ b/src/Debug/Route/Email.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Firephp.php b/src/Debug/Route/Firephp.php index 82aa9930..7db10d39 100644 --- a/src/Debug/Route/Firephp.php +++ b/src/Debug/Route/Firephp.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 1.3b */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Html.php b/src/Debug/Route/Html.php index 477b0ca9..b13a22ee 100644 --- a/src/Debug/Route/Html.php +++ b/src/Debug/Route/Html.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Html/ErrorSummary.php b/src/Debug/Route/Html/ErrorSummary.php index 345cbb2f..0bf8e769 100644 --- a/src/Debug/Route/Html/ErrorSummary.php +++ b/src/Debug/Route/Html/ErrorSummary.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Route\Html; diff --git a/src/Debug/Route/Html/FatalError.php b/src/Debug/Route/Html/FatalError.php index 51d74f35..c30096c5 100644 --- a/src/Debug/Route/Html/FatalError.php +++ b/src/Debug/Route/Html/FatalError.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Route\Html; diff --git a/src/Debug/Route/Html/Tabs.php b/src/Debug/Route/Html/Tabs.php index 2fc6d96b..4c93a6af 100644 --- a/src/Debug/Route/Html/Tabs.php +++ b/src/Debug/Route/Html/Tabs.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Route\Html; diff --git a/src/Debug/Route/RouteInterface.php b/src/Debug/Route/RouteInterface.php index 6974526a..037555f7 100644 --- a/src/Debug/Route/RouteInterface.php +++ b/src/Debug/Route/RouteInterface.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.1 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Script.php b/src/Debug/Route/Script.php index 26580180..09ae3d9d 100644 --- a/src/Debug/Route/Script.php +++ b/src/Debug/Route/Script.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/ServerLog.php b/src/Debug/Route/ServerLog.php index bee0a984..bac95649 100644 --- a/src/Debug/Route/ServerLog.php +++ b/src/Debug/Route/ServerLog.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 * * @see https://craig.is/writing/chrome-logger/techspecs */ diff --git a/src/Debug/Route/Slack.php b/src/Debug/Route/Slack.php index 3089184a..bcfda8ea 100644 --- a/src/Debug/Route/Slack.php +++ b/src/Debug/Route/Slack.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.4 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Stream.php b/src/Debug/Route/Stream.php index 4db3a6f7..a1dd1339 100644 --- a/src/Debug/Route/Stream.php +++ b/src/Debug/Route/Stream.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Teams.php b/src/Debug/Route/Teams.php index 471ede58..ed115d98 100644 --- a/src/Debug/Route/Teams.php +++ b/src/Debug/Route/Teams.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.0.4 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Text.php b/src/Debug/Route/Text.php index 09cd47e0..a79f4f93 100644 --- a/src/Debug/Route/Text.php +++ b/src/Debug/Route/Text.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/Wamp.php b/src/Debug/Route/Wamp.php index bce35516..79b8df4e 100644 --- a/src/Debug/Route/Wamp.php +++ b/src/Debug/Route/Wamp.php @@ -10,7 +10,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Route; @@ -243,12 +243,14 @@ public function onShutdown() * * We use this interface method to process pre-existing log data * - * @param Event $event debug event + * @param Event|null $event debug event * * @return void */ - public function processLogEntries(Event $event = null) // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter + public function processLogEntries($event = null) // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter { + \bdk\Debug\Utility\Php::assertType($event, 'bdk\PubSub\Event'); + $data = $this->debug->data->get(); foreach ($data['alerts'] as $logEntry) { $this->processLogEntryViaEvent($logEntry); diff --git a/src/Debug/Route/WampCrate.php b/src/Debug/Route/WampCrate.php index df78eea3..49f6cd0c 100644 --- a/src/Debug/Route/WampCrate.php +++ b/src/Debug/Route/WampCrate.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Route; diff --git a/src/Debug/Route/WampHelper.php b/src/Debug/Route/WampHelper.php index 1c1efa93..1917216b 100644 --- a/src/Debug/Route/WampHelper.php +++ b/src/Debug/Route/WampHelper.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Route; diff --git a/src/Debug/ServiceProvider.php b/src/Debug/ServiceProvider.php index 1a8a9b75..60edb697 100644 --- a/src/Debug/ServiceProvider.php +++ b/src/Debug/ServiceProvider.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug; @@ -15,6 +15,9 @@ use bdk\Container; use bdk\Container\ServiceProviderInterface; use bdk\Debug; +use bdk\HttpMessage\ServerRequestExtended; +use Psr\Http\Message\ServerRequestInterface; +use RuntimeException; /** * Register service @@ -24,12 +27,17 @@ class ServiceProvider implements ServiceProviderInterface /** * Register services and factories * - * @param Container $container Container instances + * @param Container $container Container instance * * @return void */ - public function register(Container $container) // phpcs:ignore SlevomatCodingStandard.Functions.FunctionLength + public function register(Container $container) { + $this->registerCoreServices($container); + $this->registerRoutes($container); + $this->registerUtilities($container); + $this->registerMisc($container); + /* These "services" are reused between channels each debug "rootInstance" gets at most one instance of the following @@ -50,13 +58,25 @@ public function register(Container $container) // phpcs:ignore SlevomatCodingSta 'utility', ); + // ensure that PHPDebugConsole receives ServerRequestExtended + $container->extend('serverRequest', static function (ServerRequestInterface $serverRequest) { + return ServerRequestExtended::fromServerRequest($serverRequest); + }); + } + + /** + * Register "core" services + * + * @param Container $container Container instance + * + * @return void + */ + protected function registerCoreServices(Container $container) // phpcs:ignore SlevomatCodingStandard.Functions.FunctionLength + { $container['abstracter'] = static function (Container $container) { $debug = $container['debug']; return new \bdk\Debug\Abstraction\Abstracter($debug, $debug->getCfg('abstracter', Debug::CONFIG_INIT)); }; - $container['arrayUtil'] = static function () { - return new \bdk\Debug\Utility\ArrayUtil(); - }; $container['backtrace'] = static function (Container $container) { $debug = $container['debug']; $backtrace = $debug->errorHandler->backtrace; @@ -73,9 +93,6 @@ public function register(Container $container) // phpcs:ignore SlevomatCodingSta $debug = $container['debug']; return new \bdk\Debug\Data($debug); }; - $container['errorLevel'] = static function () { - return new \bdk\Debug\Utility\ErrorLevel(); - }; $container['errorHandler'] = static function (Container $container) { $debug = $container['debug']; $existingInstance = \bdk\ErrorHandler::getInstance(); @@ -107,12 +124,20 @@ public function register(Container $container) // phpcs:ignore SlevomatCodingSta $container['eventManager'] = static function () { return new \bdk\PubSub\Manager(); }; - $container['findExit'] = static function () { - return new \bdk\Debug\Utility\FindExit(); - }; - $container['html'] = static function () { - return new \bdk\Debug\Utility\Html(); + $container['pluginManager'] = static function () { + return new \bdk\Debug\Plugin\Manager(); }; + } + + /** + * Register miscellaneous services + * + * @param Container $container Container instance + * + * @return void + */ + protected function registerMisc(Container $container) + { $container['logger'] = static function (Container $container) { $debug = $container['debug']; return new \bdk\Debug\Psr3\Logger($debug); @@ -121,35 +146,83 @@ public function register(Container $container) // phpcs:ignore SlevomatCodingSta $debug = $container['debug']; return new \bdk\Debug\Psr15\Middleware($debug); }; - $container['php'] = static function () { - return new \bdk\Debug\Utility\Php(); - }; - $container['phpDoc'] = static function () { - return new \bdk\Debug\Utility\PhpDoc(); - }; $container['pluginHighlight'] = static function () { return new \bdk\Debug\Plugin\Highlight(); }; - $container['pluginManager'] = static function () { - return new \bdk\Debug\Plugin\Manager(); + $container['response'] = null; // app may provide \Psr\Http\Message\ServerRequestInterface + $container['serverRequest'] = static function () { + // should return instance of either + // \Psr\Http\Message\ServerRequestInterface + // or + // \bdk\HttpMessage\ServerRequestExtendedInterface + return \bdk\HttpMessage\Utility\ServerRequest::fromGlobals(); }; - $container['response'] = null; + } + + /** + * Register route services + * + * @param Container $container Container instance + * + * @return void + */ + protected function registerRoutes(Container $container) + { $container['routeWamp'] = static function (Container $container) { try { $wampPublisher = $container['wampPublisher']; // @codeCoverageIgnoreStart - } catch (\RuntimeException $e) { - throw new \RuntimeException('Wamp route requires \bdk\WampPublisher, which must be installed separately'); + } catch (RuntimeException $e) { + throw new RuntimeException('Wamp route requires \bdk\WampPublisher, which must be installed separately'); // @codeCoverageIgnoreEnd } $debug = $container['debug']; return new \bdk\Debug\Route\Wamp($debug, $wampPublisher); }; - $container['serverRequest'] = static function () { - // Psr\Http\Message\ServerRequestInterface - return \bdk\HttpMessage\ServerRequest::fromGlobals(); + $container['wampPublisher'] = static function (Container $container) { + // @codeCoverageIgnoreStart + if (\class_exists('bdk\\WampPublisher') === false) { + throw new RuntimeException('PHPDebugConsole does not include WampPublisher. Install separately'); + } + $debug = $container['debug']; + return new \bdk\WampPublisher( + $debug->getCfg('wampPublisher', Debug::CONFIG_INIT) + ); + // @codeCoverageIgnoreEnd + }; + } + + /** + * Register utility services + * + * @param Container $container Container instance + * + * @return void + */ + protected function registerUtilities(Container $container) // phpcs:ignore SlevomatCodingStandard.Functions.FunctionLength + { + $container['arrayUtil'] = static function () { + return new \bdk\Debug\Utility\ArrayUtil(); + }; + $container['errorLevel'] = static function () { + return new \bdk\Debug\Utility\ErrorLevel(); + }; + $container['findExit'] = static function () { + return new \bdk\Debug\Utility\FindExit(); + }; + $container['html'] = static function () { + return new \bdk\Debug\Utility\Html(); + }; + $container['php'] = static function () { + return new \bdk\Debug\Utility\Php(); }; - $container['sql'] = static function (Container $container) { + $container['phpDoc'] = static function () { + return new \bdk\Debug\Utility\PhpDoc(); + }; + $container['reflection'] = static function () { + return new \bdk\Debug\Utility\Reflection(); + }; + $container['sql'] = static function () { return new \bdk\Debug\Utility\Sql(); }; $container['sqlQueryAnalysis'] = static function (Container $container) { @@ -170,16 +243,5 @@ public function register(Container $container) // phpcs:ignore SlevomatCodingSta $container['utility'] = static function () { return new \bdk\Debug\Utility(); }; - $container['wampPublisher'] = static function (Container $container) { - // @codeCoverageIgnoreStart - if (\class_exists('\\bdk\\WampPublisher') === false) { - throw new \RuntimeException('PHPDebugConsole does not include WampPublisher. Install separately'); - } - $debug = $container['debug']; - return new \bdk\WampPublisher( - $debug->getCfg('wampPublisher', Debug::CONFIG_INIT) - ); - // @codeCoverageIgnoreEnd - }; } } diff --git a/src/Debug/Utility/ArrayUtil.php b/src/Debug/Utility/ArrayUtil.php index e7a82f3e..4d19f63b 100644 --- a/src/Debug/Utility/ArrayUtil.php +++ b/src/Debug/Utility/ArrayUtil.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/ArrayUtilHelperTrait.php b/src/Debug/Utility/ArrayUtilHelperTrait.php index 4cc28775..4df771b6 100644 --- a/src/Debug/Utility/ArrayUtilHelperTrait.php +++ b/src/Debug/Utility/ArrayUtilHelperTrait.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/ErrorLevel.php b/src/Debug/Utility/ErrorLevel.php index b402af27..dedf1127 100644 --- a/src/Debug/Utility/ErrorLevel.php +++ b/src/Debug/Utility/ErrorLevel.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v2.3 + * @since 2.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/FileStreamWrapper.php b/src/Debug/Utility/FileStreamWrapper.php index ad6398a8..14683e40 100644 --- a/src/Debug/Utility/FileStreamWrapper.php +++ b/src/Debug/Utility/FileStreamWrapper.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/FileStreamWrapperBase.php b/src/Debug/Utility/FileStreamWrapperBase.php index 2aa06e65..69da6bde 100644 --- a/src/Debug/Utility/FileStreamWrapperBase.php +++ b/src/Debug/Utility/FileStreamWrapperBase.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/FileTree.php b/src/Debug/Utility/FileTree.php index 871afcbb..b8211ab1 100644 --- a/src/Debug/Utility/FileTree.php +++ b/src/Debug/Utility/FileTree.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Utility; @@ -141,7 +141,7 @@ private function condenseTree($tree) /** * Condense a tree frame * - * @param array $cur current stack frame] + * @param array $cur current stack frame] * @param array{out:array,src:array}[] $stack remaining stack] * * @return void diff --git a/src/Debug/Utility/Html.php b/src/Debug/Utility/Html.php index 5b1d81bc..17ab9b00 100644 --- a/src/Debug/Utility/Html.php +++ b/src/Debug/Utility/Html.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3.1 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/HtmlBuild.php b/src/Debug/Utility/HtmlBuild.php index 9b2c95dc..c80e8272 100644 --- a/src/Debug/Utility/HtmlBuild.php +++ b/src/Debug/Utility/HtmlBuild.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/HtmlParse.php b/src/Debug/Utility/HtmlParse.php index 8bd49ad3..2428549c 100644 --- a/src/Debug/Utility/HtmlParse.php +++ b/src/Debug/Utility/HtmlParse.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/HtmlSanitize.php b/src/Debug/Utility/HtmlSanitize.php index e5ee0482..7e1a6772 100644 --- a/src/Debug/Utility/HtmlSanitize.php +++ b/src/Debug/Utility/HtmlSanitize.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/Php.php b/src/Debug/Utility/Php.php index 721716ec..e77b66ba 100644 --- a/src/Debug/Utility/Php.php +++ b/src/Debug/Utility/Php.php @@ -7,13 +7,14 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Utility; use bdk\Debug\Utility\Reflection; use Exception; +use InvalidArgumentException; use UnitEnum; /** @@ -29,6 +30,53 @@ class Php /** @var string[] list of allowed-to-be-unserialized classes passed to unserializeSafe */ protected static $allowedClasses = array(); + /** + * Assert that a value is of a certain type + * + * PHPDebugConsole supports an extreme range of PHP versions : 5.4 - 8.4 (and beyond) + * `MyObj $obj = null` has been deprecated in PHP 8.4 + * must now be `?MyObj $obj = null` (which is a php 7.1 feature) + * Workaround - remove type-hint when we allow null (not ideal) and call assertType + * When we drop support for php < 7.1, we can remove this method and do proper type-hinting + * + * @param mixed $value Value to test + * @param string $type "array", "callable", "object", or className + * @param bool $allowNull (true) allow null? + * + * @return void + * + * @throws InvalidArgumentException + */ + public static function assertType($value, $type, $allowNull = true) + { + if ($allowNull && $value === null) { + return; + } + $isType = false; + switch ($type) { + case 'array': + $isType = \is_array($value); + break; + case 'callable': + $isType = self::isCallable($value); + break; + case 'object': + $isType = \is_object($value); + break; + default: + $isType = \is_a($value, $type); + } + if ($isType) { + return; + } + throw new InvalidArgumentException(\sprintf( + 'Expected %s%s, got %s', + $type, + $allowNull ? ' (or null)' : '', + self::getDebugType($value) + )); + } + /** * Get friendly classname for given classname or object * This is primarily useful for anonymous classes diff --git a/src/Debug/Utility/PhpDoc.php b/src/Debug/Utility/PhpDoc.php index 3637a69e..8216bf81 100644 --- a/src/Debug/Utility/PhpDoc.php +++ b/src/Debug/Utility/PhpDoc.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 2.0 */ namespace bdk\Debug\Utility; @@ -163,17 +163,19 @@ public static function hash($what) * * Comment has already been stripped of comment "*"s * - * @param string $comment comment content - * @param Reflector $reflector Reflector instance - * @param int $fullyQualifyType Whether to fully qualify type(s) - * @param bool $sanitize Whether to sanitize comment + * @param string $comment comment content + * @param Reflector|null $reflector Reflector instance + * @param int $fullyQualifyType Whether to fully qualify type(s) + * @param bool $sanitize Whether to sanitize comment * * @return array * * @psalm-return Parsed */ - private function parse($comment, Reflector $reflector = null, $fullyQualifyType = 0, $sanitize = true) + private function parse($comment, $reflector = null, $fullyQualifyType = 0, $sanitize = true) { + \bdk\Debug\Utility\Php::assertType($reflector, 'Reflector'); + $this->reflector = $reflector; $this->fullyQualifyType = $fullyQualifyType; $this->className = $reflector diff --git a/src/Debug/Utility/PhpDoc/Helper.php b/src/Debug/Utility/PhpDoc/Helper.php index 9400c3d6..ade5cb39 100644 --- a/src/Debug/Utility/PhpDoc/Helper.php +++ b/src/Debug/Utility/PhpDoc/Helper.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility\PhpDoc; diff --git a/src/Debug/Utility/PhpDoc/ParseMethod.php b/src/Debug/Utility/PhpDoc/ParseMethod.php index e733daa3..b9208197 100644 --- a/src/Debug/Utility/PhpDoc/ParseMethod.php +++ b/src/Debug/Utility/PhpDoc/ParseMethod.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility\PhpDoc; diff --git a/src/Debug/Utility/PhpDoc/ParseParam.php b/src/Debug/Utility/PhpDoc/ParseParam.php index 72912028..30ca351d 100644 --- a/src/Debug/Utility/PhpDoc/ParseParam.php +++ b/src/Debug/Utility/PhpDoc/ParseParam.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility\PhpDoc; diff --git a/src/Debug/Utility/PhpDoc/Parsers.php b/src/Debug/Utility/PhpDoc/Parsers.php index 8c71d760..0e2ac926 100644 --- a/src/Debug/Utility/PhpDoc/Parsers.php +++ b/src/Debug/Utility/PhpDoc/Parsers.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility\PhpDoc; @@ -179,6 +179,7 @@ protected function setParsers() // phpcs:ignore SlevomatCodingStandard.Functions $this->parserAuthor(), $this->parserLink(), $this->parserSee(), + $this->parserVersion(), $this->parserDefault(), ); } @@ -296,4 +297,22 @@ private function parserSee() 'tags' => array('see'), ); } + + /** + * Parser "definition" for @deprecated, @since, & @version tags + * + * @return ParserInfo + */ + private function parserVersion() + { + return array( + 'parts' => array('version', 'desc'), + 'regex' => '/^' + . '(?P\d+(?:\.\d+){0,2})?' + . '\s*' + . '(?P.*)' + . '$/s', + 'tags' => array('deprecated', 'since', 'version'), + ); + } } diff --git a/src/Debug/Utility/PhpDoc/Type.php b/src/Debug/Utility/PhpDoc/Type.php index 62546c9c..2179fc4a 100644 --- a/src/Debug/Utility/PhpDoc/Type.php +++ b/src/Debug/Utility/PhpDoc/Type.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility\PhpDoc; diff --git a/src/Debug/Utility/Profile.php b/src/Debug/Utility/Profile.php index b5ea049d..c4433afd 100644 --- a/src/Debug/Utility/Profile.php +++ b/src/Debug/Utility/Profile.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/Reflection.php b/src/Debug/Utility/Reflection.php index d9b5369a..9bd65934 100644 --- a/src/Debug/Utility/Reflection.php +++ b/src/Debug/Utility/Reflection.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0.5 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/SerializeLog.php b/src/Debug/Utility/SerializeLog.php index dacf7433..56747405 100644 --- a/src/Debug/Utility/SerializeLog.php +++ b/src/Debug/Utility/SerializeLog.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.3 */ namespace bdk\Debug\Utility; @@ -37,13 +37,15 @@ class SerializeLog /** * Import the config and data into the debug instance * - * @param array $data Unpacked / Unserialized log data - * @param Debug $debug (optional) Debug instance + * @param array $data Unpacked / Unserialized log data + * @param Debug|null $debug (optional) Debug instance * * @return Debug */ - public static function import($data, Debug $debug = null) + public static function import(array $data, $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + if (!$debug) { $debug = new Debug(); } diff --git a/src/Debug/Utility/Sql.php b/src/Debug/Utility/Sql.php index 18878912..1f882abb 100644 --- a/src/Debug/Utility/Sql.php +++ b/src/Debug/Utility/Sql.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/SqlQueryAnalysis.php b/src/Debug/Utility/SqlQueryAnalysis.php index 7b080769..71c542e5 100644 --- a/src/Debug/Utility/SqlQueryAnalysis.php +++ b/src/Debug/Utility/SqlQueryAnalysis.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.3 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/StopWatch.php b/src/Debug/Utility/StopWatch.php index 1379d387..d86a9e3f 100644 --- a/src/Debug/Utility/StopWatch.php +++ b/src/Debug/Utility/StopWatch.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/StringUtil.php b/src/Debug/Utility/StringUtil.php index e3ddf4f3..79e43ad9 100644 --- a/src/Debug/Utility/StringUtil.php +++ b/src/Debug/Utility/StringUtil.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 1.2 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/StringUtilHelperTrait.php b/src/Debug/Utility/StringUtilHelperTrait.php index 776cfdef..24e375e4 100644 --- a/src/Debug/Utility/StringUtilHelperTrait.php +++ b/src/Debug/Utility/StringUtilHelperTrait.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 3.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/Table.php b/src/Debug/Utility/Table.php index 0cf42070..9044af4a 100644 --- a/src/Debug/Utility/Table.php +++ b/src/Debug/Utility/Table.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.1 + * @since 2.1 */ namespace bdk\Debug\Utility; @@ -83,10 +83,12 @@ class * * @param mixed $rows Table data * @param array $meta Meta info / options - * @param Debug $debug Debug instance + * @param Debug|null $debug Debug instance */ - public function __construct($rows = array(), array $meta = array(), Debug $debug = null) + public function __construct($rows = array(), array $meta = array(), $debug = null) { + \bdk\Debug\Utility\Php::assertType($debug, 'bdk\Debug'); + $this->debug = $debug ?: Debug::getInstance(); $this->initMeta($meta); $this->processRows($rows); diff --git a/src/Debug/Utility/TableRow.php b/src/Debug/Utility/TableRow.php index 95f11054..c5c34b74 100644 --- a/src/Debug/Utility/TableRow.php +++ b/src/Debug/Utility/TableRow.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/UseStatements.php b/src/Debug/Utility/UseStatements.php index e319f310..60eb22d0 100644 --- a/src/Debug/Utility/UseStatements.php +++ b/src/Debug/Utility/UseStatements.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.3 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/Utf8.php b/src/Debug/Utility/Utf8.php index bcfba101..529c50fc 100644 --- a/src/Debug/Utility/Utf8.php +++ b/src/Debug/Utility/Utf8.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 2.0 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/Utf8Buffer.php b/src/Debug/Utility/Utf8Buffer.php index 7abdf30b..887233ce 100644 --- a/src/Debug/Utility/Utf8Buffer.php +++ b/src/Debug/Utility/Utf8Buffer.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 3.0b1 */ namespace bdk\Debug\Utility; diff --git a/src/Debug/Utility/Utility.php b/src/Debug/Utility/Utility.php index 64b5bb81..9b03a8a0 100644 --- a/src/Debug/Utility/Utility.php +++ b/src/Debug/Utility/Utility.php @@ -7,7 +7,7 @@ * @author Brad Kent * @license http://opensource.org/licenses/MIT MIT * @copyright 2014-2024 Brad Kent - * @version v3.0 + * @since 1.2 */ namespace bdk\Debug; diff --git a/src/Debug/css/Debug.css b/src/Debug/css/Debug.css index c842c663..714087fa 100644 --- a/src/Debug/css/Debug.css +++ b/src/Debug/css/Debug.css @@ -1 +1 @@ -.debug{font-size:13px}.debug{position:relative;clear:both;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;line-height:normal;text-align:left;text-shadow:none;color:#111}.debug *{font-size:inherit;line-height:normal;text-indent:0;color:inherit;margin:0}.debug *:not(i[class^=fa]){font-family:inherit}.debug a{text-decoration:none;color:#00e}.debug a:visited{color:#551a8b}.debug a:focus,.debug a:hover{border-bottom:1px dotted blue}.debug a:active,.debug a:hover{outline:0;color:#e00}.debug a.file-link{color:inherit}.debug button{color:inherit;cursor:pointer;background-color:#f0f0f0;border-color:#afafaf;font-weight:inherit;height:auto;letter-spacing:initial;line-height:initial;outline:none;padding:1px 7px 2px;text-align:center;text-transform:none;vertical-align:baseline;white-space:initial}.debug button:hover{background-color:#dde6f0}.debug code{padding:2px 4px;background-color:transparent;font-family:Menlo, Monaco, Consolas, "Courier New", monospace !important}.debug pre code{display:block}.debug,.debug div{margin:0;width:auto;height:auto;padding:0;background-color:transparent;border-radius:0}.debug dl{margin-top:0;margin-bottom:0}.debug dl dt{font-weight:bold}.debug dl.dl-horizontal{display:grid;grid-template-columns:max-content auto}.debug dl.dl-horizontal>dt{grid-column:1;text-align:right;width:auto}.debug dl.dl-horizontal>dd{grid-column:2;margin-left:0.75em}.debug dl:not(.dl-horizontal)>dd{margin-left:20px;padding-left:10px;text-indent:-10px}.debug dl:not(.dl-horizontal)>dd>ul{margin-left:-10px}.debug li.no-indent{padding-left:0;text-indent:0}.debug h3{margin-top:0.66em;margin-bottom:0.5em;font-size:1.15em;font-weight:bold}.debug h3:first-child{margin-top:0}.debug hr{color:#111;background-color:#111;border:0;height:1px}.debug img{border:0}.debug input{border-width:1px}.debug input[type=checkbox]{margin:0 0.33em 0 0;cursor:pointer}.debug label{display:block;margin:0;cursor:pointer;font-weight:bold;max-width:none}.debug label.disabled{cursor:default;pointer-events:none}.debug legend{padding:0;float:left;margin-bottom:0.5em;border:0;width:100%;font-size:144%;font-weight:bold}.debug p{margin-top:0.25em;margin-bottom:0}.debug p:first-child{margin-top:0}.debug pre{padding:0;border:0;margin:0;white-space:pre;-moz-tab-size:3;-o-tag-size:3;-tab-size:3}.debug ul{margin-top:0;margin-bottom:0}.debug ul.list-unstyled{list-style:none outside none;padding-left:0}.debug ul.list-unstyled>li{text-indent:-1em;padding-left:1em}.debug ul.list-unstyled>ul{margin-left:10px}.debug ul.no-indent>li{padding-left:0;text-indent:0}.debug fieldset{padding:0.66em;margin:0 0 10px 0;min-width:0;border:1px solid black;border-radius:4px}.debug fieldset>ul{font-size:125%}.debug .close{opacity:1;float:none}.debug ul.debug-log-summary+hr{border-top:1px dotted;background-color:transparent;margin:.5em 0}.debug .tab-pane>*>.group-body,.debug .m_groupSummary>ul{list-style:none;margin-left:0;border-left:0;padding-left:0}.debug li.php-shutdown{display:block;border-bottom:#31708f solid 1px}.debug .fa{line-height:1}.debug .alert,.debug .m_alert{padding:0.66em;margin-bottom:10px;border-radius:4px;border:1px solid transparent}.debug .m_alert{font-size:125%}.debug .m_alert h3{margin-bottom:4px}.debug .m_alert h3:last-child{margin-bottom:0}.debug .m_alert.error-summary .filter-hidden+h3{margin-top:0}.debug .m_alert.alert-dismissible{padding-right:35px}.debug .m_alert.alert-dismissible .close{float:right;position:relative;top:-7px;right:-21px;border:0;padding:0;font-size:21px;font-weight:700;line-height:1;background:none;color:#000;text-shadow:0 1px 0 #fff;opacity:0.2;cursor:pointer}.debug .m_alert.alert-dismissible .close:hover{text-decoration:none;opacity:0.5}.debug .m_alert .alert-link{font-weight:bold}.debug .alert-error{background-color:#ffbaba;border-color:#d8000c;color:#d8000c}.debug .alert-error .alert-link{color:#843534}.debug .alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}.debug .alert-info .alert-link{color:#245269}.debug .alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.debug .alert-success .alert-link{color:#2b542c}.debug .alert-warn{background-color:#fefbe5;border-color:#faebcc;color:#8a6d3b}.debug .alert-warn .alert-link{color:#66512c}.debug nav[role=tablist]{display:inline-block;font-size:0;line-height:20px;vertical-align:top}.debug nav[role=tablist] .fa{margin-right:0.5em}.debug nav[role=tablist] a{display:inline-block;padding:0 13px;font-size:13px;line-height:20px;vertical-align:top;color:#111;cursor:pointer}.debug nav[role=tablist] a:hover{text-decoration:none}.debug nav[role=tablist] a:hover:not(.active){background:#e6e6e6}.debug nav[role=tablist] a.active{line-height:19px;border-bottom:#4071e1 solid 2px}.debug .tab-panes{overflow:auto}.debug .tab-panes .tab-pane{position:static;display:none}.debug .tab-panes .tab-pane.active{display:block}.debug .tab-panes .tab-pane .tab-body{padding:10px 12px 5px;background-color:#fff;overflow:auto}.debug .namespace{opacity:0.5}.debug .array-inner,.debug .object-inner{display:block;margin-left:1em}.debug .classname{font-weight:bold;color:color-mix(in lch, currentColor, #8d0c4c)}.debug .attribute .t_punct{color:inherit;font-weight:bold}.debug .t_parameter-name{color:#263}.debug .t_array>.t_array-collapse,.debug .t_array>.array-inner,.debug .t_array>.t_punct{display:none}.debug .t_array.expanded>.t_array-expand{display:none}.debug .t_array.expanded>.t_array-collapse,.debug .t_array.expanded>.t_punct{display:inline}.debug .t_array.expanded>.array-inner{display:block}.debug .t_array.array-file-tree .array-inner{margin-left:0.25em}.debug .t_array.array-file-tree .exclude-count{background:#d9edf7;color:#31708f}.debug .t_array.array-file-tree .t_key{color:#000040;font-weight:bold}.debug .t_array.array-file-tree .t_string::before,.debug .t_array.array-file-tree .t_string::after,.debug .t_array.array-file-tree .t_key::before,.debug .t_array.array-file-tree .t_key::after{display:none}.debug .array-inner>li>.t_operator{margin:0 0.25em}.debug li[class*=m_]>.t_array.array-file-tree>.array-inner{margin-left:-10px}.debug .t_object{display:inline}.debug .t_object h3{margin:0;font-size:inherit;font-style:italic;color:purple}.debug .t_object .t_modifier_abstract{font-weight:bold;color:#9d2d2d}.debug .t_object .t_modifier_debug{color:rgba(0,11,155,0.933333)}.debug .t_object .t_modifier_final{color:rgba(255,0,0,0.933333);font-weight:bold}.debug .t_object .t_modifier_private{color:rgba(0,0,0,0.509804)}.debug .t_object .t_modifier_protected{color:rgba(0,0,0,0.776471)}.debug .t_object .t_modifier_public{color:inherit}.debug .t_object .t_modifier_static{font-style:italic;color:rgba(218,13,135,0.933333)}.debug .t_object>.object-inner>.modifiers{display:none}.debug .t_object>.object-inner>dd[class*=t_modifier_]{display:inline-block;margin-left:0;margin-right:0.5em;border-style:solid;border-width:1px;border-radius:4px;padding:0 .75em;height:1.75em;text-indent:0;line-height:1.5;font-weight:bold}.debug .t_object>.object-inner>.t_modifier_abstract{color:#333;background-color:#e6e6e6;border-color:#666}.debug .t_object>.object-inner>.t_modifier_final{color:#d8000c;background-color:#ffeded;border-color:#d8000c}.debug .t_object>.object-inner>.t_modifier_interface{color:#31708f;background-color:#d9edf7;border-color:#31708f}.debug .t_object>.object-inner>.t_modifier_readonly{color:#8a6d3b;background-color:#fefbe5;border-color:#8a6d3b}.debug .t_object>.object-inner>.t_modifier_readonly .fa-stack{font-size:0.8em;margin-right:0.33em}.debug .t_object>.object-inner>.t_modifier_readonly .fa-stack .fa-ban{opacity:0.75}.debug .t_object>.object-inner .heading{color:#4f16b0;text-decoration:underline;font-weight:bold}.debug .t_object .vis-toggles *[data-toggle]{padding:0.15em 0.5em;display:inline-block}.debug .t_object dd+.vis-toggles{margin-top:.25em}.debug .t_object .method .parameter .t_parameter-name[title],.debug .t_object .t_identifier[title],.debug .t_object .t_type[title]{border-bottom:1px dashed blue}.debug .t_object .method ul{margin-left:15px}.debug .t_object .method.deprecated{opacity:0.66}.debug .t_object .method.deprecated i{opacity:0.66;color:#d8000c;border-bottom:0}.debug .t_object .method>.t_punct:not(.t_colon){opacity:1;font-weight:bold;color:inherit}.debug .t_object .method i.fa-clone{color:#999}.debug .t_object .private-ancestor:not(:hover)>*{opacity:0.5}.debug .t_object .private-ancestor:not(:hover)>.fa-lock,.debug .t_object .private-ancestor:not(:hover)>.t_modifier_private{opacity:1}.debug .t_object i.fa-flag,.debug .t_object i.fa-warning{color:red}.debug .t_object i.fa-eye{color:rgba(0,11,155,0.933333);font-size:1.1em;border-bottom:0}.debug .t_object i.fa-magic,.debug .t_object .t_modifier_magic,.debug .t_object .t_modifier_magic-read,.debug .t_object .t_modifier_magic-write{color:rgba(255,136,0,0.933333)}.debug .t_object .debugInfo-excluded>i.fa-eye-slash{color:#999}.debug .t_object .info{display:inline-block;background-color:#d9edf7;color:#31708f}.debug td.t_object{display:table-cell}.debug .m_assert,.debug .m_clear,.debug .m_count,.debug .m_error,.debug .m_groupEndValue,.debug .m_info,.debug .m_log,.debug .m_warn{position:relative;display:table;padding-left:10px;text-indent:-10px;padding-right:0.33em;word-break:break-word}.debug .m_table td,.debug .m_trace td{word-break:break-word}.debug .m_table td.t_string,.debug .m_trace td.t_string{padding-left:1em;text-indent:-0.75em}.debug .m_assert{background-color:rgba(255,204,204,0.75)}.debug .m_assert>i{margin-right:0.33em;margin-bottom:-0.2em;display:inline-block;line-height:0.6em;vertical-align:text-bottom}.debug .m_group .group-header{display:table;white-space:nowrap}.debug .m_group .group-header i.fa-warning{color:#cdcb06;margin-left:0.33em}.debug .m_group .group-header i.fa-times-circle{color:#d8000c;margin-left:0.33em}.debug .m_group .group-body{display:none}.debug .m_group>ul{list-style:none;margin-left:1em;border-left:1px solid rgba(0,0,0,0.25);padding-left:0.25rem}.debug .m_group.expanded>.group-body{display:block}.debug .m_error,.debug .m_group.level-error>.group-body,.debug .m_group.level-error:not(.expanded)>.group-header>.level-error{background-color:#ffbaba;color:#d8000c}.debug .m_info,.debug .m_group.level-info>.group-body,.debug .m_group.level-info:not(.expanded)>.group-header>.level-info{background-color:#d9edf7;color:#31708f}.debug .m_trace .classname{color:#146314}.debug .m_warn,.debug .m_group.level-warn>.group-body,.debug .m_group.level-warn:not(.expanded)>.group-header>.level-warn{background-color:#fefbe5;color:#8a6d3b}.debug li[data-channel="general.phpError"]>i+.t_string:nth-child(2){font-weight:bold}.debug li[data-channel="general.phpError"]>.t_string:nth-child(4){opacity:0.7}.debug li[data-channel="general.phpError"]>.t_string:nth-child(4)::before{content:"\A"}.debug li[data-channel="general.phpError"]>.t_string:nth-child(4)::after{content:none}.debug li[data-channel="general.phpError"].error-fatal{padding:10px 10px 10px 20px;border-left:solid 2px #d8000c}.debug li[data-channel="general.phpError"].error-fatal>.t_string:nth-child(2){display:inline-block;margin-bottom:5px;vertical-align:top;font-size:1.2em}.debug li[data-channel="general.phpError"].error-fatal>.t_string:nth-child(3)::before{content:"\A"}.debug table{width:auto;border-collapse:collapse}.debug table caption{caption-side:top;font-weight:bold;font-style:italic;padding-bottom:0;padding-top:2px;text-align:left}.debug table th,.debug table td{padding:0 0.25em;vertical-align:top}.debug table th.t_key{white-space:nowrap}.debug table th.t_key::before,.debug table th.t_key::after{content:none}.debug table td.classname{font-weight:bold}.debug table td.t_undefined{background-color:rgba(0,0,0,0.1)}.debug table td.t_undefined::after{content:none}.debug table th,.debug table tfoot td{font-weight:bold;background-color:rgba(0,0,0,0.1)}.debug table thead th{text-align:center}.debug table thead th .classname{opacity:0.5;font-style:italic}.debug table thead th .classname::before{content:"("}.debug table thead th .classname::after{content:")"}.debug table tr[data-toggle]{cursor:default}.debug table tr[data-toggle]:hover{color:#212529;background-color:rgba(0,0,0,0.075)}.debug table tbody th.t_int,.debug table td[data-type-more=numeric],.debug table td.timestamp,.debug table td.t_int{text-align:right;white-space:nowrap}.debug table.table-bordered th,.debug table.table-bordered td{border:1px solid #7f7f7f;padding:1px 0.25em}.debug table.table-hover tbody tr{cursor:default}.debug table.table-hover tbody tr:hover{color:#212529;background-color:rgba(0,0,0,0.075)}.debug table.table-sort>thead th{cursor:default}.debug table.table-sort>thead th:hover{background-color:rgba(0,0,0,0.25)}.debug table.table-sort .sort-arrows{text-align:center;height:1.5em;width:1.2em;margin-left:0;margin-right:1px}.debug table.table-sort .sort-arrows .fa{position:absolute;opacity:0.33}.debug table.table-sort .sort-arrows .fa-caret-down{bottom:0}.debug table.table-sort .sort-arrows .fa-caret-up{top:-1px}.debug table.table-sort .sort-asc .fa-caret-down{opacity:1}.debug table.table-sort .sort-desc .fa-caret-up{opacity:1}.debug table.trace-context{width:100%}.debug table.trace-context tr.context{display:none}.debug table.trace-context tr.context td{color:#111;max-width:1px;background-color:#f5f2f0;padding:0.75em}.debug table.trace-context tr.context td hr{margin:1em 0}.debug .t_identifier{font-weight:bold;white-space:nowrap}.debug .t_type{color:#693}.debug .t_bool[data-type-more=true]{color:#993;text-shadow:1px 1px 2px rgba(153,153,51,0.5)}.debug .t_bool[data-type-more=false]{color:#c33;text-shadow:1px 1px 2px rgba(204,51,51,0.5)}.debug .t_callable{font-weight:bold}.debug .t_callable .t_type,.debug .t_callable .namespace{font-weight:normal}.debug .t_const{color:#039;font-family:monospace}.debug .t_const .t_identifier{color:inherit}.debug .t_int,.debug .t_float,.debug .t_string[data-type-more=numeric],.debug .t_string[data-type-more=timestamp]{font-family:Courier New,monospace,Ariel !important;color:#009;font-size:1.15em;line-height:1.15em}.debug .t_int::before,.debug .t_int::after,.debug .t_float::before,.debug .t_float::after,.debug .t_string[data-type-more=numeric]::before,.debug .t_string[data-type-more=numeric]::after,.debug .t_string[data-type-more=timestamp]::before,.debug .t_string[data-type-more=timestamp]::after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:0.8695em}.debug .t_key{opacity:0.75}.debug .t_key[data-file]{opacity:1}.debug .t_key::before,.debug .t_key::after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;color:#999}.debug .t_key::before{content:'[';margin-right:1px}.debug .t_key::after{content:']';margin-left:1px}.debug .t_key.t_int{white-space:nowrap}.debug .t_keyword{color:#07a}.debug .t_null{opacity:0.3}.debug .t_operator{color:#a67f59;white-space:nowrap !important}.debug .t_punct{color:#999}.debug .excluded,.debug .t_maxDepth,.debug .t_notInspected,.debug .t_recursion,.debug .t_unknown{font-weight:bold;color:red}.debug .t_resource{font-style:italic}.debug .t_string{white-space:pre-wrap;word-break:break-all}.debug .t_string::before,.debug .t_string::after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;opacity:0.33;color:#333}.debug .t_string::before{content:open-quote}.debug .t_string::after{content:close-quote}.debug .t_string.classname::before{content:none}.debug .t_string.classname::after{content:none}.debug .t_string>*{white-space:normal;word-break:break-word}.debug .t_string pre{white-space:pre}.debug .t_stringified{text-shadow:0 0 2px rgba(0,200,200,0.6)}.debug .t_undefined::after{content:"undefined";opacity:0.3}.debug.debug-drawer{position:fixed;bottom:0;left:0;width:100%;background-color:#fff;z-index:1049;height:100px;transform:translateY(100px);transition:all 0.5s}.debug.debug-drawer>*{box-sizing:border-box}.debug.debug-drawer .debug-pull-tab{display:inline-block;opacity:1;position:absolute;height:25px;top:-25px;margin-left:20px;border:1px solid #000;border-bottom-width:0;border-radius:5px 5px 0 0;padding:4px 14px;font-size:16px;background:#f3f3f3;cursor:pointer;transition:all 0.5s}.debug.debug-drawer .debug-pull-tab:hover{background:#dadada}.debug.debug-drawer .debug-pull-tab .debug-error-counts{margin-left:0.5em}.debug.debug-drawer .debug-pull-tab .badge{display:none}.debug.debug-drawer .debug-pull-tab .fa-spinner{display:none}.debug.debug-drawer .debug-resize-handle{display:block;position:absolute;top:-3px;height:4px;width:100%;opacity:0;border-top:1px solid #d0d0d0;border-bottom:1px solid #d0d0d0;background:#dadada;transition:all 0.25s ease-out}.debug.debug-drawer.debug-drawer-open{transform:translateY(0);height:auto}.debug.debug-drawer.debug-drawer-open .debug-pull-tab{opacity:0;transform:translateY(25px)}.debug.debug-drawer.debug-drawer-open .debug-pull-tab .fa-spinner{display:inline-block}.debug.debug-drawer.debug-drawer-open .debug-resize-handle{cursor:ns-resize}.debug.debug-drawer.debug-drawer-open .debug-resize-handle:hover{opacity:1}html.debug-resizing{cursor:ns-resize !important}html.debug-resizing .debug-drawer{transition:none}html.debug-resizing .debug-drawer .debug-resize-handle{opacity:1}.debug .debug-bar{position:relative;padding:5px;font-size:115%;background-color:rgba(0,0,0,0.2);margin-bottom:10px}.debug .debug-bar a{color:#6e6e6e}.debug .debug-bar button{border-radius:0;border-top-width:0;border-bottom-width:0}.debug .debug-bar button.close{font-size:21px;font-weight:300}.debug .debug-bar .float-right{position:absolute;top:0;right:6px;line-height:23px}.debug .debug-bar .float-right button{height:18px;border:0;padding:0;line-height:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent}.debug .debug-error-counts{position:relative;top:-2px;font-size:0.78em}.debug .debug-error-counts .badge{padding:0 0.4em 0 0.25em;color:inherit;background:inherit;font-size:inherit;vertical-align:unset}.debug .debug-bar{border-top:1px solid #d0d0d0;border-bottom:1px solid #d0d0d0;color:#6e6e6e;padding:0 34px 0 6px;background:#f3f3f3;font-size:16px;margin-bottom:0}.debug .debug-bar a:focus,.debug .debug-bar a:hover,.debug .debug-bar button:focus,.debug .debug-bar button:hover,.debug .debug-bar label:focus,.debug .debug-bar label:hover{color:#333;text-decoration:none}.debug .debug-bar nav{margin-left:20px;line-height:23px}.debug .debug-bar nav a{line-height:23px}.debug .debug-bar nav a.has-assert{line-height:22px;border-bottom:#da8585 solid 2px}.debug .debug-bar nav a.has-warn{line-height:22px;border-bottom:#e4cb0f solid 2px}.debug .debug-bar nav a.has-error{line-height:22px;border-bottom:red solid 2px}.debug .debug-bar nav a.active{line-height:22px;border-bottom:#4071e1 solid 2px}.debug .debug-bar>span{display:inline-block;line-height:23px}.debug .debug-options-toggle{position:relative;top:-1px}.debug .debug-options{position:absolute;top:100%;right:0;max-height:0;box-sizing:border-box;z-index:1000;float:right;min-width:12em;background:#f3f3f3;box-shadow:0 4px 8px rgba(0,0,0,0.25);transition:all 0.25s ease-out;overflow:hidden;font-size:13px}.debug .debug-options .debug-options-body{background-clip:padding-box;border:1px solid #d0d0d0;padding:0.5em 5px 0.5em 15px}.debug .debug-options.show{max-height:150px}.debug .debug-options label{font-weight:normal;padding:0.25em 0}.debug .debug-options label.disabled{color:#999}.debug .debug-options hr.dropdown-divider{margin:0.5em -5px 0.5em -15px;background:#d0d0d0;height:1px;border:none}.debug .debug-options .form-group{margin:0}.debug{transform:scale(1)}.debug .debug-sidebar{position:absolute;box-sizing:border-box;width:126px;background:#f3f3f3;height:100%;transform:translateX(-119px);transition:transform .33s}.debug .debug-sidebar button{width:100%}.debug .debug-sidebar input[type=checkbox]{display:none}.debug .debug-sidebar label{font-weight:normal}.debug .debug-sidebar+.tab-body{margin-left:6px;padding-left:10px;transition:margin-left .33s}.debug .debug-sidebar.no-transition+.tab-body{transition:none}.debug .debug-sidebar .collapse{display:none}.debug .debug-sidebar .sidebar-content{padding:0 11px 0 4px;opacity:0;overflow:hidden}.debug .debug-sidebar.show{transform:translateX(0)}.debug .debug-sidebar.show .expand{display:none}.debug .debug-sidebar.show .collapse{display:block}.debug .debug-sidebar.show+.tab-body{margin-left:126px}.debug .debug-sidebar.show .sidebar-content{opacity:1;transition:opacity 0.33s}.debug .debug-sidebar .sidebar-toggle{position:absolute;box-sizing:border-box;right:0;top:0;height:100%;width:7px;background:#f3f3f3;border-left:1px solid #d0d0d0;border-right:1px solid #d0d0d0;cursor:pointer;display:flex;color:#d0d0d0;text-align:center;z-index:1}.debug .debug-sidebar .sidebar-toggle:hover{color:#6e6e6e;background:#dadada}.debug .debug-sidebar .sidebar-toggle>div{margin:auto;padding-left:1px}.debug .debug-sidebar .debug-filters{position:relative;margin:0 -4px 10px -4px}.debug .debug-sidebar .debug-filters ul{margin-left:0}.debug .debug-sidebar .debug-filters li{text-indent:0;padding-left:10px}.debug .debug-sidebar .debug-filters>li{padding-left:4px}.debug .debug-sidebar .debug-filters>li>*:first-child{padding-top:3px;padding-bottom:3px}.debug .debug-sidebar .debug-filters>li>ul{margin-left:-10px}.debug .debug-sidebar .debug-filters>li>ul>li{padding-left:32px}.debug .debug-sidebar .debug-filters label{padding:2px 0 2px 100%;white-space:nowrap}.debug .debug-sidebar .debug-filters label.disabled span{opacity:0.5}.debug .debug-sidebar .debug-filters label,.debug .debug-sidebar .debug-filters ul ul{margin-left:-100%;padding-left:100%}.debug .debug-sidebar .fa-times-circle{color:#d8000c}.debug .debug-sidebar .fa-warning{color:#8a6d3b}.debug .debug-sidebar .fa-info-circle{color:#31708f}.debug .debug-sidebar .toggle{cursor:pointer}.debug .debug-sidebar .toggle.active{background:#dadada}.debug .debug-sidebar .toggle.active:hover{background:#bacce0}.debug .debug-sidebar .toggle:hover,.debug .debug-sidebar .toggle:hover+ul{background:#dde6f0}.debug .debug-sidebar .toggle:hover .toggle.active,.debug .debug-sidebar .toggle:hover+ul .toggle.active{background:#bacce0}.debug i.fa{margin-right:0.33em}.debug i.fa-lg{font-size:1.33em}.debug i.fa-plus-circle{opacity:0.42}.debug i.fa-calendar{font-size:1.1em}.debug .filter-hidden{display:none}.debug .filter-hidden.m_group{display:list-item}.debug .filter-hidden.m_group>.group-header{display:none}.debug .filter-hidden.m_group>.group-body{display:block !important;margin-left:0;border-left:0;padding-left:0}.debug .filter-hidden.m_group.filter-hidden-body>.group-body{display:none !important}.debug .empty.hide-if-empty{display:none}.debug .empty.m_group .group-header{cursor:auto}.debug .vis-toggles span:hover,.debug [data-toggle=interface]:hover{background-color:rgba(0,0,0,0.1)}.debug .vis-toggles .toggle-off.toggle-off,.debug .interface.toggle-off{opacity:0.5}.debug ul.list-unstyled>li:has(.show-more-container){text-indent:0;padding-left:0}.debug .show-more-container{display:inline}.debug .show-more-wrapper{display:block;position:relative;height:70px;overflow:hidden}.debug .show-more-fade{position:absolute;bottom:-1px;width:100%;height:55px;background-image:linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.75));pointer-events:none}.debug .level-error .show-more-fade,.debug .m_error .show-more-fade{background-image:linear-gradient(to bottom, rgba(255,186,186,0), #ffbaba)}.debug .level-info .show-more-fade,.debug .m_info .show-more-fade{background-image:linear-gradient(to bottom, rgba(217,237,247,0), #d9edf7)}.debug .level-warn .show-more-fade,.debug .m_warn .show-more-fade{background-image:linear-gradient(to bottom, rgba(254,251,229,0), #fefbe5)}.debug [title]:hover .show-more-fade{background-image:linear-gradient(to bottom, rgba(201,201,201,0), #c9c9c9)}.debug .show-more,.debug .show-less{display:table;box-shadow:1px 1px 0 0 rgba(0,0,0,0.2);border:1px solid rgba(0,0,0,0.2);border-radius:2px;background-color:#eee}.debug-noti-wrap{position:fixed;display:none;top:0;width:100%;height:100%;pointer-events:none;z-index:1050}.debug-noti-wrap .debug-noti{display:table-cell;text-align:center;vertical-align:bottom;font-size:30px;transform-origin:50% 100%}.debug-noti-wrap .debug-noti.animate{animation-duration:1s;animation-name:expandAndFade;animation-timing-function:ease-in}.debug-noti-table{display:table;width:100%;height:100%}@keyframes expandAndFade{from{opacity:0.9;transform:scale(0.9, 0.94)}to{opacity:0;transform:scale(1, 1)}}.debug .badge{display:inline-block;padding:0.25em 0.4em 0.16em;font-size:82%;font-weight:500;line-height:1;text-align:center;white-space:nowrap;vertical-align:bottom;border-radius:0.25rem;color:#fff;background-color:#666}.debug .expand-all{margin-bottom:0.5em}.debug .file-link.lpad{margin-left:0.33em}.debug .file-link i{margin-right:0;vertical-align:baseline}.debug .hasTooltip:not(a),.debug *[title]:not(a){cursor:help}.debug .hasTooltip:not(a):hover,.debug *[title]:not(a):hover{background-color:rgba(0,0,0,0.05)}.debug *[data-toggle]{cursor:pointer !important}.debug .string-encoded.tabs-container>i{line-height:20px;margin-right:0}.debug .string-encoded[data-type=base64]>.string-raw .t_string{font-family:monospace}.debug .prettified{color:rgba(0,11,155,0.933333)}.debug .timestamp{color:#009}.debug .binary{padding:0 0.3em}.debug .char-ws,.debug .maxlen,.debug .unicode{padding:0 0.3em;cursor:pointer}.debug .char-ws:hover,.debug .maxlen:hover,.debug .unicode:hover{outline:0;color:#e00}.debug .binary,.debug .char-control{background-color:silver;color:#003;font-family:monospace !important;font-weight:bold}.debug .char-control{display:inline-block;vertical-align:baseline;clip-path:inset(30% 0);transform:scale(2);margin-left:0.33em}.debug .maxlen{background-color:#fc7}.debug .char-ws,.debug .unicode{background-color:#c0c0ff;font-weight:normal}.debug ul[data-type-more=binary]>li.t_string{text-indent:0;padding:0}.debug ul[data-type-more=binary]>li.t_string::before{content:""}.debug ul[data-type-more=binary]>li.t_string::after{content:""}.debug ul[data-type-more=binary]>li.t_string>.binary{padding:0;margin:0;word-spacing:-0.25em;font-size:0.8em}.debug .ws_s,.debug .ws_t,.debug .ws_r,.debug .ws_n,.debug .ws_p{opacity:0.33}.debug .ws_t::before{display:inline-block;content:"\203A";width:1em}.debug .ws_r::before{content:"\\r"}.debug .ws_n::before{content:"\\n"}.debug .tippy-box{background-color:#fff;background-clip:padding-box;border:2px solid rgba(0,8,16,0.3);border-radius:4px;outline:0;transition-property:transform, visibility, opacity;color:#333;box-shadow:0 4px 14px -2px rgba(0,8,16,0.08)}.debug .tippy-box .tippy-content{padding:5px 9px;z-index:1}.debug .tippy-box>.tippy-backdrop{background-color:#fff}.debug .tippy-box>.tippy-arrow{width:16px;height:16px;color:#333}.debug .tippy-box>.tippy-arrow::before{content:"";position:absolute;border-color:transparent;border-style:solid}.debug .tippy-box>.tippy-arrow::after,.debug .tippy-box>.tippy-svg-arrow::after{content:'';position:absolute;z-index:-1}.debug .tippy-box>.tippy-arrow::after{border-color:transparent;border-style:solid}.debug .tippy-box[data-placement^='top']>.tippy-arrow{bottom:1px}.debug .tippy-box[data-placement^='top']>.tippy-arrow::before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:#fff;transform-origin:center top}.debug .tippy-box[data-placement^='top']>.tippy-arrow::after{border-top-color:rgba(0,8,16,0.5);border-width:7px 7px 0;top:17px;left:1px}.debug .tippy-box[data-placement^='top']>.tippy-svg-arrow>svg{top:16px}.debug .tippy-box[data-placement^='top']>.tippy-svg-arrow::after{top:17px}.debug .tippy-box[data-placement^='bottom']>.tippy-arrow{top:0}.debug .tippy-box[data-placement^='bottom']>.tippy-arrow::before{top:-6px;left:0;border-width:0 8px 8px;border-bottom-color:#fff;transform-origin:center bottom}.debug .tippy-box[data-placement^='bottom']>.tippy-arrow::after{border-bottom-color:rgba(0,8,16,0.5);border-width:0 7px 7px;bottom:17px;left:1px}.debug .tippy-box[data-placement^='bottom']>.tippy-svg-arrow>svg{bottom:16px}.debug .tippy-box[data-placement^='bottom']>.tippy-svg-arrow::after{bottom:17px}.debug .tippy-box[data-placement^='left']>.tippy-arrow::before{border-left-color:#fff}.debug .tippy-box[data-placement^='left']>.tippy-arrow::after{border-left-color:rgba(0,8,16,0.5);border-width:7px 0 7px 7px;left:17px;top:1px}.debug .tippy-box[data-placement^='left']>.tippy-svg-arrow>svg{left:11px}.debug .tippy-box[data-placement^='left']>.tippy-svg-arrow::after{left:12px}.debug .tippy-box[data-placement^='right']>.tippy-arrow::before{border-right-color:#fff;right:16px}.debug .tippy-box[data-placement^='right']>.tippy-arrow::after{border-width:7px 7px 7px 0;right:17px;top:1px;border-right-color:rgba(0,8,16,0.5)}.debug .tippy-box[data-placement^='right']>.tippy-svg-arrow>svg{right:11px}.debug .tippy-box[data-placement^='right']>.tippy-svg-arrow::after{right:12px}.debug .tippy-box>.tippy-svg-arrow{fill:white}.debug .tippy-box>.tippy-svg-arrow::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCA2czEuNzk2LS4wMTMgNC42Ny0zLjYxNUM1Ljg1MS45IDYuOTMuMDA2IDggMGMxLjA3LS4wMDYgMi4xNDguODg3IDMuMzQzIDIuMzg1QzE0LjIzMyA2LjAwNSAxNiA2IDE2IDZIMHoiIGZpbGw9InJnYmEoMCwgOCwgMTYsIDAuMikiIC8+PC9zdmc+);background-size:16px 6px;width:16px;height:6px}.debug .indent{padding-left:10px !important}.debug .p0{padding:0 !important}.debug .fa-inverse{color:#fff}.debug .fa-stack{line-height:2em}.debug .fa-stack-1x{line-height:inherit}.debug .fa-stack-2x{font-size:2em}.debug .float-left{float:left !important}.debug .float-right{float:right !important}.debug .font-weight-bold{font-weight:bold}.debug .no-quotes::before{content:none}.debug .no-quotes::after{content:none}.debug .bg-secondary{background-color:#666 !important;color:#fff !important}.debug .bg-success{background-color:#dff0d8 !important;color:#3c763d !important}.debug .bg-error{background-color:#ffbaba !important;color:#d8000c !important}.debug .bg-warn{background-color:#fefbe5 !important;color:#8a6d3b !important}.debug .bg-info{background-color:#d9edf7 !important;color:#31708f !important}.debug .fw-bold{font-weight:700}.debug .logentry-muted{opacity:0.5}.debug .logentry-muted.m_group.expanded{opacity:1}.debug .text-center{text-align:center}.debug .text-left{text-align:left !important}.debug .text-right{text-align:right !important}.debug .text-muted{opacity:.5}.debug .text-success{color:#3c763d}.debug .text-error{color:#d8000c}.debug .text-info{color:#31708f}.debug .text-warn{color:#8a6d3b} +.debug{font-size:13px}.debug{position:relative;clear:both;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;line-height:normal;text-align:left;text-shadow:none;color:#111}.debug *{font-size:inherit;line-height:normal;text-indent:0;color:inherit;margin:0}.debug *:not(i[class^=fa]){font-family:inherit}.debug a{text-decoration:none;color:#00e}.debug a:visited{color:#551a8b}.debug a:focus,.debug a:hover{border-bottom:1px dotted blue}.debug a:active,.debug a:hover{outline:0;color:#e00}.debug a.file-link{color:inherit}.debug button{color:inherit;cursor:pointer;background-color:#f0f0f0;border-color:#afafaf;font-weight:inherit;height:auto;letter-spacing:initial;line-height:initial;outline:none;padding:1px 7px 2px;text-align:center;text-transform:none;vertical-align:baseline;white-space:initial}.debug button:hover{background-color:#dde6f0}.debug code{padding:2px 4px;background-color:transparent;font-family:Menlo, Monaco, Consolas, "Courier New", monospace !important}.debug pre code{display:block}.debug,.debug div{margin:0;width:auto;height:auto;padding:0;background-color:transparent;border-radius:0}.debug dl{margin-top:0;margin-bottom:0}.debug dl dt{font-weight:bold}.debug dl.dl-horizontal{display:grid;grid-template-columns:max-content auto}.debug dl.dl-horizontal>dt{grid-column:1;text-align:right;width:auto}.debug dl.dl-horizontal>dd{grid-column:2;margin-left:0.75em}.debug dl:not(.dl-horizontal)>dd{margin-left:20px;padding-left:10px;text-indent:-10px}.debug dl:not(.dl-horizontal)>dd>ul{margin-left:-10px}.debug li.no-indent{padding-left:0;text-indent:0}.debug h3{margin-top:0.66em;margin-bottom:0.5em;font-size:1.15em;font-weight:bold}.debug h3:first-child{margin-top:0}.debug hr{color:#111;background-color:#111;border:0;height:1px}.debug img{border:0}.debug input{border-width:1px}.debug input[type=checkbox]{margin:0 0.33em 0 0;cursor:pointer}.debug label{display:block;margin:0;cursor:pointer;font-weight:bold;max-width:none}.debug label.disabled{cursor:default;pointer-events:none}.debug legend{padding:0;float:left;margin-bottom:0.5em;border:0;width:100%;font-size:144%;font-weight:bold}.debug p{margin-top:0.25em;margin-bottom:0}.debug p:first-child{margin-top:0}.debug pre{padding:0;border:0;margin:0;white-space:pre;-moz-tab-size:3;-o-tag-size:3;-tab-size:3}.debug ul{margin-top:0;margin-bottom:0}.debug ul.list-unstyled{list-style:none outside none;padding-left:0}.debug ul.list-unstyled>li{text-indent:-1em;padding-left:1em}.debug ul.list-unstyled>ul{margin-left:10px}.debug ul.no-indent>li{padding-left:0;text-indent:0}.debug fieldset{padding:0.66em;margin:0 0 10px 0;min-width:0;border:1px solid black;border-radius:4px}.debug fieldset>ul{font-size:125%}.debug .close{opacity:1;float:none}.debug ul.debug-log-summary+hr{border-top:1px dotted;background-color:transparent;margin:.5em 0}.debug .tab-pane>*>.group-body,.debug .m_groupSummary>ul{list-style:none;margin-left:0;border-left:0;padding-left:0}.debug li.php-shutdown{display:block;border-bottom:#31708f solid 1px}.debug .fa{line-height:1}.debug .alert,.debug .m_alert{padding:0.66em;margin-bottom:10px;border-radius:4px;border:1px solid transparent}.debug .m_alert{font-size:125%}.debug .m_alert h3{margin-bottom:4px}.debug .m_alert h3:last-child{margin-bottom:0}.debug .m_alert.error-summary .filter-hidden+h3{margin-top:0}.debug .m_alert.alert-dismissible{padding-right:35px}.debug .m_alert.alert-dismissible .close{float:right;position:relative;top:-7px;right:-21px;border:0;padding:0;font-size:21px;font-weight:700;line-height:1;background:none;color:#000;text-shadow:0 1px 0 #fff;opacity:0.2;cursor:pointer}.debug .m_alert.alert-dismissible .close:hover{text-decoration:none;opacity:0.5}.debug .m_alert .alert-link{font-weight:bold}.debug .alert-error{background-color:#ffbaba;border-color:#d8000c;color:#d8000c}.debug .alert-error .alert-link{color:#843534}.debug .alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}.debug .alert-info .alert-link{color:#245269}.debug .alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.debug .alert-success .alert-link{color:#2b542c}.debug .alert-warn{background-color:#fefbe5;border-color:#faebcc;color:#8a6d3b}.debug .alert-warn .alert-link{color:#66512c}.debug nav[role=tablist]{display:inline-block;font-size:0;line-height:20px;vertical-align:top}.debug nav[role=tablist] .fa{margin-right:0.5em}.debug nav[role=tablist] a{display:inline-block;padding:0 13px;font-size:13px;line-height:20px;vertical-align:top;color:#111;cursor:pointer}.debug nav[role=tablist] a:hover{text-decoration:none}.debug nav[role=tablist] a:hover:not(.active){background:#e6e6e6}.debug nav[role=tablist] a.active{line-height:19px;border-bottom:#4071e1 solid 2px}.debug .tab-panes{overflow:auto}.debug .tab-panes .tab-pane{position:static;display:none}.debug .tab-panes .tab-pane.active{display:block}.debug .tab-panes .tab-pane .tab-body{padding:10px 12px 5px;background-color:#fff;overflow:auto}.debug .namespace{opacity:0.5}.debug .array-inner,.debug .object-inner{display:block;margin-left:1em}.debug .classname{font-weight:bold;color:color-mix(in lch, currentColor, #8d0c4c)}.debug .attribute .t_punct{color:inherit;font-weight:bold}.debug .t_parameter-name{color:#263}.debug .t_array>.t_array-collapse,.debug .t_array>.array-inner,.debug .t_array>.t_punct{display:none}.debug .t_array.expanded>.t_array-expand{display:none}.debug .t_array.expanded>.t_array-collapse,.debug .t_array.expanded>.t_punct{display:inline}.debug .t_array.expanded>.array-inner{display:block}.debug .t_array.array-file-tree .array-inner{margin-left:0.25em}.debug .t_array.array-file-tree .exclude-count{background:#d9edf7;color:#31708f}.debug .t_array.array-file-tree .t_key{color:#000040;font-weight:bold}.debug .t_array.array-file-tree .t_string::before,.debug .t_array.array-file-tree .t_string::after,.debug .t_array.array-file-tree .t_key::before,.debug .t_array.array-file-tree .t_key::after{display:none}.debug .array-inner>li>.t_operator{margin:0 0.25em}.debug li[class*=m_]>.t_array.array-file-tree>.array-inner{margin-left:-10px}.debug .t_object{display:inline}.debug .t_object h3{margin:0;font-size:inherit;font-style:italic;color:purple}.debug .t_object .t_modifier_abstract,.debug .t_object i.fa-circle-o{font-weight:bold;color:#9d2d2d}.debug .t_object .t_modifier_debug{color:rgba(0,11,155,0.933333)}.debug .t_object .t_modifier_final{color:rgba(255,0,0,0.933333);font-weight:bold}.debug .t_object .t_modifier_private{color:rgba(0,0,0,0.509804)}.debug .t_object .t_modifier_protected{color:rgba(0,0,0,0.776471)}.debug .t_object .t_modifier_public{color:inherit}.debug .t_object .t_modifier_static{font-style:italic;color:rgba(218,13,135,0.933333)}.debug .t_object>.object-inner>.modifiers{display:none}.debug .t_object>.object-inner>dd[class*=t_modifier_]{display:inline-block;margin-left:0;margin-right:0.5em;border-style:solid;border-width:1px;border-radius:4px;padding:0 .75em;height:1.75em;text-indent:0;line-height:1.5;font-weight:bold}.debug .t_object>.object-inner>.t_modifier_abstract{color:#333;background-color:#e6e6e6;border-color:#666}.debug .t_object>.object-inner>.t_modifier_final{color:#d8000c;background-color:#ffeded;border-color:#d8000c}.debug .t_object>.object-inner>.t_modifier_interface{color:#31708f;background-color:#d9edf7;border-color:#31708f}.debug .t_object>.object-inner>.t_modifier_readonly{color:#8a6d3b;background-color:#fefbe5;border-color:#8a6d3b}.debug .t_object>.object-inner>.t_modifier_readonly .fa-stack{font-size:0.8em;margin-right:0.33em}.debug .t_object>.object-inner>.t_modifier_readonly .fa-stack .fa-ban{opacity:0.75}.debug .t_object>.object-inner .heading{color:#4f16b0;text-decoration:underline;font-weight:bold}.debug .t_object .vis-toggles *[data-toggle]{padding:0.15em 0.5em;display:inline-block}.debug .t_object dd+.vis-toggles{margin-top:.25em}.debug .t_object .method .parameter .t_parameter-name[title],.debug .t_object .t_identifier[title],.debug .t_object .t_type[title]{border-bottom:1px dashed blue}.debug .t_object .method ul{margin-left:15px}.debug .t_object .method.deprecated{opacity:0.66}.debug .t_object .method.deprecated i{opacity:0.66;color:#d8000c;border-bottom:0}.debug .t_object .method>.t_punct:not(.t_colon){opacity:1;font-weight:bold;color:inherit}.debug .t_object .method i.fa-clone{color:#999}.debug .t_object .private-ancestor:not(:hover)>*{opacity:0.5}.debug .t_object .private-ancestor:not(:hover)>.fa-lock,.debug .t_object .private-ancestor:not(:hover)>.t_modifier_private{opacity:1}.debug .t_object i.fa-flag,.debug .t_object i.fa-warning{color:red}.debug .t_object i.fa-eye{color:rgba(0,11,155,0.933333);font-size:1.1em;border-bottom:0}.debug .t_object i.fa-magic,.debug .t_object .t_modifier_magic,.debug .t_object .t_modifier_magic-read,.debug .t_object .t_modifier_magic-write{color:rgba(255,136,0,0.933333)}.debug .t_object .debugInfo-excluded>i.fa-eye-slash{color:#999}.debug .t_object .info{display:inline-block;background-color:#d9edf7;color:#31708f}.debug td.t_object{display:table-cell}.debug .m_assert,.debug .m_clear,.debug .m_count,.debug .m_error,.debug .m_groupEndValue,.debug .m_info,.debug .m_log,.debug .m_warn{position:relative;display:table;padding-left:10px;text-indent:-10px;padding-right:0.33em;word-break:break-word}.debug .m_table td,.debug .m_trace td{word-break:break-word}.debug .m_table td.t_string,.debug .m_trace td.t_string{padding-left:1em;text-indent:-0.75em}.debug .m_assert{background-color:rgba(255,204,204,0.75)}.debug .m_assert>i{margin-right:0.33em;margin-bottom:-0.2em;display:inline-block;line-height:0.6em;vertical-align:text-bottom}.debug .m_group .group-header{display:table;white-space:nowrap}.debug .m_group .group-header i.fa-warning{color:#cdcb06;margin-left:0.33em}.debug .m_group .group-header i.fa-times-circle{color:#d8000c;margin-left:0.33em}.debug .m_group .group-body{display:none}.debug .m_group>ul{list-style:none;margin-left:1em;border-left:1px solid rgba(0,0,0,0.25);padding-left:0.25rem}.debug .m_group.expanded>.group-body{display:block}.debug .m_error,.debug .m_group.level-error>.group-body,.debug .m_group.level-error:not(.expanded)>.group-header>.level-error{background-color:#ffbaba;color:#d8000c}.debug .m_info,.debug .m_group.level-info>.group-body,.debug .m_group.level-info:not(.expanded)>.group-header>.level-info{background-color:#d9edf7;color:#31708f}.debug .m_trace .classname{color:#146314}.debug .m_warn,.debug .m_group.level-warn>.group-body,.debug .m_group.level-warn:not(.expanded)>.group-header>.level-warn{background-color:#fefbe5;color:#8a6d3b}.debug li[data-channel="general.phpError"]>i+.t_string:nth-child(2){font-weight:bold}.debug li[data-channel="general.phpError"]>.t_string:nth-child(4){opacity:0.7}.debug li[data-channel="general.phpError"]>.t_string:nth-child(4)::before{content:"\A"}.debug li[data-channel="general.phpError"]>.t_string:nth-child(4)::after{content:none}.debug li[data-channel="general.phpError"].error-fatal{padding:10px 10px 10px 20px;border-left:solid 2px #d8000c}.debug li[data-channel="general.phpError"].error-fatal>.t_string:nth-child(2){display:inline-block;margin-bottom:5px;vertical-align:top;font-size:1.2em}.debug li[data-channel="general.phpError"].error-fatal>.t_string:nth-child(3)::before{content:"\A"}.debug table{width:auto;border-collapse:collapse}.debug table caption{caption-side:top;font-weight:bold;font-style:italic;padding-bottom:0;padding-top:2px;text-align:left}.debug table th,.debug table td{padding:0 0.25em;vertical-align:top}.debug table th.t_key{white-space:nowrap}.debug table th.t_key::before,.debug table th.t_key::after{content:none}.debug table td.classname{font-weight:bold}.debug table td.t_undefined{background-color:rgba(0,0,0,0.1)}.debug table td.t_undefined::after{content:none}.debug table th,.debug table tfoot td{font-weight:bold;background-color:rgba(0,0,0,0.1)}.debug table thead th{text-align:center}.debug table thead th .classname{opacity:0.5;font-style:italic}.debug table thead th .classname::before{content:"("}.debug table thead th .classname::after{content:")"}.debug table tr[data-toggle]{cursor:default}.debug table tr[data-toggle]:hover{color:#212529;background-color:rgba(0,0,0,0.075)}.debug table tbody th.t_int,.debug table td[data-type-more=numeric],.debug table td.timestamp,.debug table td.t_int{text-align:right;white-space:nowrap}.debug table.table-bordered th,.debug table.table-bordered td{border:1px solid #7f7f7f;padding:1px 0.25em}.debug table.table-hover tbody tr{cursor:default}.debug table.table-hover tbody tr:hover{color:#212529;background-color:rgba(0,0,0,0.075)}.debug table.table-sort>thead th{cursor:default}.debug table.table-sort>thead th:hover{background-color:rgba(0,0,0,0.25)}.debug table.table-sort .sort-arrows{text-align:center;height:1.5em;width:1.2em;margin-left:0;margin-right:1px}.debug table.table-sort .sort-arrows .fa{position:absolute;opacity:0.33}.debug table.table-sort .sort-arrows .fa-caret-down{bottom:0}.debug table.table-sort .sort-arrows .fa-caret-up{top:-1px}.debug table.table-sort .sort-asc .fa-caret-down{opacity:1}.debug table.table-sort .sort-desc .fa-caret-up{opacity:1}.debug table.trace-context{width:100%}.debug table.trace-context tr.context{display:none}.debug table.trace-context tr.context td{color:#111;max-width:1px;background-color:#f5f2f0;padding:0.75em}.debug table.trace-context tr.context td hr{margin:1em 0}.debug .t_identifier{font-weight:bold;white-space:nowrap}.debug .t_type{color:#693}.debug .t_bool[data-type-more=true]{color:#993;text-shadow:1px 1px 2px rgba(153,153,51,0.5)}.debug .t_bool[data-type-more=false]{color:#c33;text-shadow:1px 1px 2px rgba(204,51,51,0.5)}.debug .t_callable{font-weight:bold}.debug .t_callable .t_type,.debug .t_callable .namespace{font-weight:normal}.debug .t_const{color:#039;font-family:monospace}.debug .t_const .t_identifier{color:inherit}.debug .t_int,.debug .t_float,.debug .t_string[data-type-more=numeric],.debug .t_string[data-type-more=timestamp]{font-family:Courier New,monospace,Ariel !important;color:#009;font-size:1.15em;line-height:1.15em}.debug .t_int::before,.debug .t_int::after,.debug .t_float::before,.debug .t_float::after,.debug .t_string[data-type-more=numeric]::before,.debug .t_string[data-type-more=numeric]::after,.debug .t_string[data-type-more=timestamp]::before,.debug .t_string[data-type-more=timestamp]::after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:0.8695em}.debug .t_key{opacity:0.75}.debug .t_key[data-file]{opacity:1}.debug .t_key::before,.debug .t_key::after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;color:#999}.debug .t_key::before{content:'[';margin-right:1px}.debug .t_key::after{content:']';margin-left:1px}.debug .t_key.t_int{white-space:nowrap}.debug .t_keyword{color:#07a}.debug .t_null{opacity:0.3}.debug .t_operator{color:#a67f59;white-space:nowrap !important}.debug .t_punct{color:#999}.debug .excluded,.debug .t_maxDepth,.debug .t_notInspected,.debug .t_recursion,.debug .t_unknown{font-weight:bold;color:red}.debug .t_resource{font-style:italic}.debug .t_string{white-space:pre-wrap;word-break:break-all}.debug .t_string::before,.debug .t_string::after{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;opacity:0.33;color:#333}.debug .t_string::before{content:open-quote}.debug .t_string::after{content:close-quote}.debug .t_string.classname::before{content:none}.debug .t_string.classname::after{content:none}.debug .t_string>*{white-space:normal;word-break:break-word}.debug .t_string pre{white-space:pre}.debug .t_stringified{text-shadow:0 0 2px rgba(0,200,200,0.6)}.debug .t_undefined::after{content:"undefined";opacity:0.3}.debug.debug-drawer{position:fixed;bottom:0;left:0;width:100%;background-color:#fff;z-index:1049;height:100px;transform:translateY(100px);transition:all 0.5s}.debug.debug-drawer>*{box-sizing:border-box}.debug.debug-drawer .debug-pull-tab{display:inline-block;opacity:1;position:absolute;height:25px;top:-25px;margin-left:20px;border:1px solid #000;border-bottom-width:0;border-radius:5px 5px 0 0;padding:4px 14px;font-size:16px;background:#f3f3f3;cursor:pointer;transition:all 0.5s}.debug.debug-drawer .debug-pull-tab:hover{background:#dadada}.debug.debug-drawer .debug-pull-tab .debug-error-counts{margin-left:0.5em}.debug.debug-drawer .debug-pull-tab .badge{display:none}.debug.debug-drawer .debug-pull-tab .fa-spinner{display:none}.debug.debug-drawer .debug-resize-handle{display:block;position:absolute;top:-3px;height:4px;width:100%;opacity:0;border-top:1px solid #d0d0d0;border-bottom:1px solid #d0d0d0;background:#dadada;transition:all 0.25s ease-out}.debug.debug-drawer.debug-drawer-open{transform:translateY(0);height:auto}.debug.debug-drawer.debug-drawer-open .debug-pull-tab{opacity:0;transform:translateY(25px)}.debug.debug-drawer.debug-drawer-open .debug-pull-tab .fa-spinner{display:inline-block}.debug.debug-drawer.debug-drawer-open .debug-resize-handle{cursor:ns-resize}.debug.debug-drawer.debug-drawer-open .debug-resize-handle:hover{opacity:1}html.debug-resizing{cursor:ns-resize !important}html.debug-resizing .debug-drawer{transition:none}html.debug-resizing .debug-drawer .debug-resize-handle{opacity:1}.debug .debug-bar{position:relative;padding:5px;font-size:115%;background-color:rgba(0,0,0,0.2);margin-bottom:10px}.debug .debug-bar a{color:#6e6e6e}.debug .debug-bar button{border-radius:0;border-top-width:0;border-bottom-width:0}.debug .debug-bar button.close{font-size:21px;font-weight:300}.debug .debug-bar .float-right{position:absolute;top:0;right:6px;line-height:23px}.debug .debug-bar .float-right button{height:18px;border:0;padding:0;line-height:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent}.debug .debug-error-counts{position:relative;top:-2px;font-size:0.78em}.debug .debug-error-counts .badge{padding:0 0.4em 0 0.25em;color:inherit;background:inherit;font-size:inherit;vertical-align:unset}.debug .debug-bar{border-top:1px solid #d0d0d0;border-bottom:1px solid #d0d0d0;color:#6e6e6e;padding:0 34px 0 6px;background:#f3f3f3;font-size:16px;margin-bottom:0}.debug .debug-bar a:focus,.debug .debug-bar a:hover,.debug .debug-bar button:focus,.debug .debug-bar button:hover,.debug .debug-bar label:focus,.debug .debug-bar label:hover{color:#333;text-decoration:none}.debug .debug-bar nav{margin-left:20px;line-height:23px}.debug .debug-bar nav a{line-height:23px}.debug .debug-bar nav a.has-assert{line-height:22px;border-bottom:#da8585 solid 2px}.debug .debug-bar nav a.has-warn{line-height:22px;border-bottom:#e4cb0f solid 2px}.debug .debug-bar nav a.has-error{line-height:22px;border-bottom:red solid 2px}.debug .debug-bar nav a.active{line-height:22px;border-bottom:#4071e1 solid 2px}.debug .debug-bar>span{display:inline-block;line-height:23px}.debug .debug-options-toggle{position:relative;top:-1px}.debug .debug-options{position:absolute;top:100%;right:0;max-height:0;box-sizing:border-box;z-index:1000;float:right;min-width:12em;background:#f3f3f3;box-shadow:0 4px 8px rgba(0,0,0,0.25);transition:all 0.25s ease-out;overflow:hidden;font-size:13px}.debug .debug-options .debug-options-body{background-clip:padding-box;border:1px solid #d0d0d0;padding:0.5em 5px 0.5em 15px}.debug .debug-options.show{max-height:150px}.debug .debug-options label{font-weight:normal;padding:0.25em 0}.debug .debug-options label.disabled{color:#999}.debug .debug-options hr.dropdown-divider{margin:0.5em -5px 0.5em -15px;background:#d0d0d0;height:1px;border:none}.debug .debug-options .form-group{margin:0}.debug{transform:scale(1)}.debug .debug-sidebar{position:absolute;box-sizing:border-box;width:126px;background:#f3f3f3;height:100%;transform:translateX(-119px);transition:transform .33s}.debug .debug-sidebar button{width:100%}.debug .debug-sidebar input[type=checkbox]{display:none}.debug .debug-sidebar label{font-weight:normal}.debug .debug-sidebar+.tab-body{margin-left:6px;padding-left:10px;transition:margin-left .33s}.debug .debug-sidebar.no-transition+.tab-body{transition:none}.debug .debug-sidebar .collapse{display:none}.debug .debug-sidebar .sidebar-content{padding:0 11px 0 4px;opacity:0;overflow:hidden}.debug .debug-sidebar.show{transform:translateX(0)}.debug .debug-sidebar.show .expand{display:none}.debug .debug-sidebar.show .collapse{display:block}.debug .debug-sidebar.show+.tab-body{margin-left:126px}.debug .debug-sidebar.show .sidebar-content{opacity:1;transition:opacity 0.33s}.debug .debug-sidebar .sidebar-toggle{position:absolute;box-sizing:border-box;right:0;top:0;height:100%;width:7px;background:#f3f3f3;border-left:1px solid #d0d0d0;border-right:1px solid #d0d0d0;cursor:pointer;display:flex;color:#d0d0d0;text-align:center;z-index:1}.debug .debug-sidebar .sidebar-toggle:hover{color:#6e6e6e;background:#dadada}.debug .debug-sidebar .sidebar-toggle>div{margin:auto;padding-left:1px}.debug .debug-sidebar .debug-filters{position:relative;margin:0 -4px 10px -4px}.debug .debug-sidebar .debug-filters ul{margin-left:0}.debug .debug-sidebar .debug-filters li{text-indent:0;padding-left:10px}.debug .debug-sidebar .debug-filters>li{padding-left:4px}.debug .debug-sidebar .debug-filters>li>*:first-child{padding-top:3px;padding-bottom:3px}.debug .debug-sidebar .debug-filters>li>ul{margin-left:-10px}.debug .debug-sidebar .debug-filters>li>ul>li{padding-left:32px}.debug .debug-sidebar .debug-filters label{padding:2px 0 2px 100%;white-space:nowrap}.debug .debug-sidebar .debug-filters label.disabled span{opacity:0.5}.debug .debug-sidebar .debug-filters label,.debug .debug-sidebar .debug-filters ul ul{margin-left:-100%;padding-left:100%}.debug .debug-sidebar .fa-times-circle{color:#d8000c}.debug .debug-sidebar .fa-warning{color:#8a6d3b}.debug .debug-sidebar .fa-info-circle{color:#31708f}.debug .debug-sidebar .toggle{cursor:pointer}.debug .debug-sidebar .toggle.active{background:#dadada}.debug .debug-sidebar .toggle.active:hover{background:#bacce0}.debug .debug-sidebar .toggle:hover,.debug .debug-sidebar .toggle:hover+ul{background:#dde6f0}.debug .debug-sidebar .toggle:hover .toggle.active,.debug .debug-sidebar .toggle:hover+ul .toggle.active{background:#bacce0}.debug i.fa{margin-right:0.33em}.debug i.fa-lg{font-size:1.33em}.debug i.fa-plus-circle{opacity:0.42}.debug i.fa-calendar{font-size:1.1em}.debug .filter-hidden{display:none}.debug .filter-hidden.m_group{display:list-item}.debug .filter-hidden.m_group>.group-header{display:none}.debug .filter-hidden.m_group>.group-body{display:block !important;margin-left:0;border-left:0;padding-left:0}.debug .filter-hidden.m_group.filter-hidden-body>.group-body{display:none !important}.debug .empty.hide-if-empty{display:none}.debug .empty.m_group .group-header{cursor:auto}.debug .vis-toggles span:hover,.debug [data-toggle=interface]:hover{background-color:rgba(0,0,0,0.1)}.debug .vis-toggles .toggle-off.toggle-off,.debug .interface.toggle-off{opacity:0.5}.debug ul.list-unstyled>li:has(.show-more-container){text-indent:0;padding-left:0}.debug .show-more-container{display:inline}.debug .show-more-wrapper{display:block;position:relative;height:70px;overflow:hidden}.debug .show-more-fade{position:absolute;bottom:-1px;width:100%;height:55px;background-image:linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.75));pointer-events:none}.debug .level-error .show-more-fade,.debug .m_error .show-more-fade{background-image:linear-gradient(to bottom, rgba(255,186,186,0), #ffbaba)}.debug .level-info .show-more-fade,.debug .m_info .show-more-fade{background-image:linear-gradient(to bottom, rgba(217,237,247,0), #d9edf7)}.debug .level-warn .show-more-fade,.debug .m_warn .show-more-fade{background-image:linear-gradient(to bottom, rgba(254,251,229,0), #fefbe5)}.debug [title]:hover .show-more-fade{background-image:linear-gradient(to bottom, rgba(201,201,201,0), #c9c9c9)}.debug .show-more,.debug .show-less{display:table;box-shadow:1px 1px 0 0 rgba(0,0,0,0.2);border:1px solid rgba(0,0,0,0.2);border-radius:2px;background-color:#eee}.debug-noti-wrap{position:fixed;display:none;top:0;width:100%;height:100%;pointer-events:none;z-index:1050}.debug-noti-wrap .debug-noti{display:table-cell;text-align:center;vertical-align:bottom;font-size:30px;transform-origin:50% 100%}.debug-noti-wrap .debug-noti.animate{animation-duration:1s;animation-name:expandAndFade;animation-timing-function:ease-in}.debug-noti-table{display:table;width:100%;height:100%}@keyframes expandAndFade{from{opacity:0.9;transform:scale(0.9, 0.94)}to{opacity:0;transform:scale(1, 1)}}.debug .badge{display:inline-block;padding:0.25em 0.4em 0.16em;font-size:82%;font-weight:500;line-height:1;text-align:center;white-space:nowrap;vertical-align:bottom;border-radius:0.25rem;color:#fff;background-color:#666}.debug .expand-all{margin-bottom:0.5em}.debug .file-link.lpad{margin-left:0.33em}.debug .file-link i{margin-right:0;vertical-align:baseline}.debug .hasTooltip:not(a),.debug *[title]:not(a){cursor:help}.debug .hasTooltip:not(a):hover,.debug *[title]:not(a):hover{background-color:rgba(0,0,0,0.05)}.debug *[data-toggle]{cursor:pointer !important}.debug .string-encoded.tabs-container>i{line-height:20px;margin-right:0}.debug .string-encoded[data-type=base64]>.string-raw .t_string{font-family:monospace}.debug .prettified{color:rgba(0,11,155,0.933333)}.debug .timestamp{color:#009}.debug .binary{padding:0 0.3em}.debug .char-ws,.debug .maxlen,.debug .unicode{padding:0 0.3em;cursor:pointer}.debug .char-ws:hover,.debug .maxlen:hover,.debug .unicode:hover{outline:0;color:#e00}.debug .binary,.debug .char-control{background-color:silver;color:#003;font-family:monospace !important;font-weight:bold}.debug .char-control{display:inline-block;vertical-align:baseline;clip-path:inset(30% 0);transform:scale(2);margin-left:0.33em}.debug .maxlen{background-color:#fc7}.debug .char-ws,.debug .unicode{background-color:#c0c0ff;font-weight:normal}.debug ul[data-type-more=binary]>li.t_string{text-indent:0;padding:0}.debug ul[data-type-more=binary]>li.t_string::before{content:""}.debug ul[data-type-more=binary]>li.t_string::after{content:""}.debug ul[data-type-more=binary]>li.t_string>.binary{padding:0;margin:0;word-spacing:-0.25em;font-size:0.8em}.debug .ws_s,.debug .ws_t,.debug .ws_r,.debug .ws_n,.debug .ws_p{opacity:0.33}.debug .ws_t::before{display:inline-block;content:"\203A";width:1em}.debug .ws_r::before{content:"\\r"}.debug .ws_n::before{content:"\\n"}.debug .tippy-box{background-color:#fff;background-clip:padding-box;border:2px solid rgba(0,8,16,0.3);border-radius:4px;outline:0;transition-property:transform, visibility, opacity;color:#333;box-shadow:0 4px 14px -2px rgba(0,8,16,0.08)}.debug .tippy-box .tippy-content{padding:5px 9px;z-index:1}.debug .tippy-box>.tippy-backdrop{background-color:#fff}.debug .tippy-box>.tippy-arrow{width:16px;height:16px;color:#333}.debug .tippy-box>.tippy-arrow::before{content:"";position:absolute;border-color:transparent;border-style:solid}.debug .tippy-box>.tippy-arrow::after,.debug .tippy-box>.tippy-svg-arrow::after{content:'';position:absolute;z-index:-1}.debug .tippy-box>.tippy-arrow::after{border-color:transparent;border-style:solid}.debug .tippy-box[data-placement^='top']>.tippy-arrow{bottom:1px}.debug .tippy-box[data-placement^='top']>.tippy-arrow::before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:#fff;transform-origin:center top}.debug .tippy-box[data-placement^='top']>.tippy-arrow::after{border-top-color:rgba(0,8,16,0.5);border-width:7px 7px 0;top:17px;left:1px}.debug .tippy-box[data-placement^='top']>.tippy-svg-arrow>svg{top:16px}.debug .tippy-box[data-placement^='top']>.tippy-svg-arrow::after{top:17px}.debug .tippy-box[data-placement^='bottom']>.tippy-arrow{top:0}.debug .tippy-box[data-placement^='bottom']>.tippy-arrow::before{top:-6px;left:0;border-width:0 8px 8px;border-bottom-color:#fff;transform-origin:center bottom}.debug .tippy-box[data-placement^='bottom']>.tippy-arrow::after{border-bottom-color:rgba(0,8,16,0.5);border-width:0 7px 7px;bottom:17px;left:1px}.debug .tippy-box[data-placement^='bottom']>.tippy-svg-arrow>svg{bottom:16px}.debug .tippy-box[data-placement^='bottom']>.tippy-svg-arrow::after{bottom:17px}.debug .tippy-box[data-placement^='left']>.tippy-arrow::before{border-left-color:#fff}.debug .tippy-box[data-placement^='left']>.tippy-arrow::after{border-left-color:rgba(0,8,16,0.5);border-width:7px 0 7px 7px;left:17px;top:1px}.debug .tippy-box[data-placement^='left']>.tippy-svg-arrow>svg{left:11px}.debug .tippy-box[data-placement^='left']>.tippy-svg-arrow::after{left:12px}.debug .tippy-box[data-placement^='right']>.tippy-arrow::before{border-right-color:#fff;right:16px}.debug .tippy-box[data-placement^='right']>.tippy-arrow::after{border-width:7px 7px 7px 0;right:17px;top:1px;border-right-color:rgba(0,8,16,0.5)}.debug .tippy-box[data-placement^='right']>.tippy-svg-arrow>svg{right:11px}.debug .tippy-box[data-placement^='right']>.tippy-svg-arrow::after{right:12px}.debug .tippy-box>.tippy-svg-arrow{fill:white}.debug .tippy-box>.tippy-svg-arrow::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMCA2czEuNzk2LS4wMTMgNC42Ny0zLjYxNUM1Ljg1MS45IDYuOTMuMDA2IDggMGMxLjA3LS4wMDYgMi4xNDguODg3IDMuMzQzIDIuMzg1QzE0LjIzMyA2LjAwNSAxNiA2IDE2IDZIMHoiIGZpbGw9InJnYmEoMCwgOCwgMTYsIDAuMikiIC8+PC9zdmc+);background-size:16px 6px;width:16px;height:6px}.debug .indent{padding-left:10px !important}.debug .p0{padding:0 !important}.debug .fa-inverse{color:#fff}.debug .fa-stack{line-height:2em}.debug .fa-stack-1x{line-height:inherit}.debug .fa-stack-2x{font-size:2em}.debug .float-left{float:left !important}.debug .float-right{float:right !important}.debug .font-weight-bold{font-weight:bold}.debug .no-quotes::before{content:none}.debug .no-quotes::after{content:none}.debug .bg-secondary{background-color:#666 !important;color:#fff !important}.debug .bg-success{background-color:#dff0d8 !important;color:#3c763d !important}.debug .bg-error{background-color:#ffbaba !important;color:#d8000c !important}.debug .bg-warn{background-color:#fefbe5 !important;color:#8a6d3b !important}.debug .bg-info{background-color:#d9edf7 !important;color:#31708f !important}.debug .fw-bold{font-weight:700}.debug .logentry-muted{opacity:0.5}.debug .logentry-muted.m_group.expanded{opacity:1}.debug .text-center{text-align:center}.debug .text-left{text-align:left !important}.debug .text-right{text-align:right !important}.debug .text-muted{opacity:.5}.debug .text-success{color:#3c763d}.debug .text-error{color:#d8000c}.debug .text-info{color:#31708f}.debug .text-warn{color:#8a6d3b} diff --git a/src/Debug/js/Debug.jquery.js b/src/Debug/js/Debug.jquery.js index 1c46890c..436a67a2 100644 --- a/src/Debug/js/Debug.jquery.js +++ b/src/Debug/js/Debug.jquery.js @@ -110,12 +110,12 @@ } function addIcons ($node) { - // console.warn('addIcons', $node) $.each(config$1.iconsObject, function (selector, v) { var prepend = true; var sMatches = selector.match(/(?:parent(\S+)\s)?(?:context(\S+)\s)?(.*)$/); var vMatches = v.match(/^([ap])\s*:(.+)$/); var $found; + var $existingIcon; if (sMatches) { if (sMatches[1] && $node.parent().filter(sMatches[1]).length === 0) { return @@ -130,9 +130,12 @@ v = vMatches[2]; } $found = $node.find(selector); - prepend - ? $found.prepend(v) - : $found.append(v); + if (prepend === false) { + $found.append(v); + } + $existingIcon = $found.find('> i:first-child'); + $existingIcon.after(v); + $found.not($existingIcon.parent()).prepend(v); }); } @@ -540,35 +543,33 @@ return function sortFunction (trA, trB) { var a = trA.cells[colIndex].textContent.trim(); var b = trB.cells[colIndex].textContent.trim(); - var afloat = a.match(floatRe); - var bfloat = b.match(floatRe); - if (afloat) { - a = toFixed(a, afloat); - } - if (bfloat) { - b = toFixed(b, bfloat); - } - return dir * compare(a, b, collator) + var aFloatMatches = a.match(floatRe); + var bFloatMatches = b.match(floatRe); + return aFloatMatches && bFloatMatches + ? dir * compareFloat(toFixed(aFloatMatches), toFixed(bFloatMatches)) + : dir * compare(a, b, collator) } } function compare (a, b, collator) { - var comp = 0; - if (afloat && bfloat) { - if (a < b) { - comp = -1; - } else if (a > b) { - comp = 1; - } - return comp - } return collator ? collator.compare(a, b) : a.localeCompare(b) // not a natural sort } - function toFixed (str, matches) { - var num = Number.parseFloat(str); + function compareFloat(a, b) + { + if (a < b) { + return -1 + } + if (a > b) { + return 1 + } + return 0 + } + + function toFixed (matches) { + var num = Number.parseFloat(matches[0]); if (matches[2]) { // sci notation num = num.toFixed(6); @@ -6072,60 +6073,42 @@ } function tippyContentBuildTitle($ref, title) { + title = refTitle($ref, title); + if ($ref.parent().hasClass('hasTooltip')) { + title = title + '

' + tippyContent($ref.parent()[0]); + } + return title.replace(/\n/g, '
') + } + + function refTitle($ref, title) { switch (title) { case 'Deprecated': - title = tippyContentDeprecated($ref, title); - break + return refTitleDeprecated($ref, title) case 'Implements': - title = tippyContentImplements($ref, title); - break + return refTitleImplements($ref, title) case 'Inherited': case 'Private ancestor': - title = tippyContentInherited($ref, title); - break + return refTitleInherited($ref, title) case 'Overrides': - title = tippyContentOverrides($ref, title); - break + return refTitleOverrides($ref, title) case 'Open in editor': - title = ' ' + title; - break + return ' ' + title case 'Throws': - title = tippyContentThrows($ref, title); - break - default: - if (title.match(/^\/.+: line \d+( \(eval'd line \d+\))?$/)) { - title = ' ' + title; - } + return refTitleThrows($ref, title) } - if ($ref.parent().hasClass('hasTooltip')) { - title = title + '

' + tippyContent($ref.parent()[0]); - } - return title.replace(/\n/g, '
') - } - - function tippyContentAttributes ($ref) { - var attributes = $ref.parent().data('attributes').map(function (attr) { - return buildAttribute(attr) - }); - var chars = $ref.parent().data('chars') || []; - var charRegex = new RegExp('[' + chars.join('') + ']', 'gu'); - var html = '
' + - '
attributes
' + - attributes.join('') + - '
'; - return html.replace(charRegex, function (char) { - return '' + char + '' - }) + return title.match(/^\/.+: line \d+( \(eval'd line \d+\))?$/) + ? ' ' + title + : title } - function tippyContentDeprecated ($ref, title) { + function refTitleDeprecated ($ref, title) { var titleMore = $ref.parent().data('deprecatedDesc'); return titleMore ? 'Deprecated: ' + titleMore : title } - function tippyContentImplements ($ref, title) { + function refTitleImplements ($ref, title) { var className = $ref.parent().data('implements'); var $interface = $ref.closest('.object-inner').find('> .implements span[data-interface]').filter(function ($node) { return $(this).data('interface') === className @@ -6133,7 +6116,7 @@ return title + ' ' + $interface[0].innerHTML } - function tippyContentInherited ($ref, title) { + function refTitleInherited ($ref, title) { var classname = $ref.parent().data('inheritedFrom'); if (typeof classname === 'undefined') { return title @@ -6144,14 +6127,14 @@ return title + ' ' + markupClassname(classname) } - function tippyContentOverrides ($ref, title) { + function refTitleOverrides ($ref, title) { var classname = $ref.parent().data('declaredPrev'); return classname ? title + ' ' + markupClassname(classname) : title } - function tippyContentThrows ($ref, title) { + function refTitleThrows ($ref, title) { var throws = $ref.parent().data('throws'); var i; var count; @@ -6167,6 +6150,21 @@ return title + $dl[0].outerHTML } + function tippyContentAttributes ($ref) { + var attributes = $ref.parent().data('attributes').map(function (attr) { + return buildAttribute(attr) + }); + var chars = $ref.parent().data('chars') || []; + var charRegex = new RegExp('[' + chars.join('') + ']', 'gu'); + var html = '
' + + '
attributes
' + + attributes.join('') + + '
'; + return html.replace(charRegex, function (char) { + return '' + char + '' + }) + } + function tippyOnHide (instance) { var $ref = $(instance.reference); var title = $ref.data('titleOrig'); @@ -6305,10 +6303,10 @@ 'parent:not(.groupByInheritance) > dd.private-ancestor': '', '> dd[data-attributes]': '', '> dd[data-declared-prev]': '', + '> .method.isAbstract': '', '> .method.isDeprecated': '', - '> .method > .t_modifier_abstract': '', + '> .method.isFinal': '', '> .method > .t_modifier_magic': '', - '> .method > .t_modifier_final': '', '> .method > .parameter.isPromoted': '', '> .method > .parameter[data-attributes]': '', '> .method[data-implements]': '', @@ -6557,25 +6555,31 @@ ]); $.fn.debugEnhance = function (method, arg1, arg2) { - // console.warn('debugEnhance', method, this) - if (method === 'sidebar') { - debugEnhanceSidebar(this, arg1); - } else if (method === 'buildChannelList') { - return buildChannelList(arg1, arg2, arguments[3]) - } else if (method === 'collapse') { - this.each(function () { - collapse($(this), arg1); - }); - } else if (method === 'expand') { - this.each(function () { - expand($(this)); - }); - } else if (method === 'init') { - debugEnhanceInit(this, arg1); - } else if (method === 'setConfig') { - debugEnhanceSetConfig(this, arg1); - } else { - debugEnhanceDefault(this); + switch (method) { + case 'sidebar': + debugEnhanceSidebar(this, arg1); + break + case 'buildChannelList': + return buildChannelList(arg1, arg2, arguments[3]) + case 'collapse': + this.each(function () { + collapse($(this), arg1); + }); + break + case 'expand': + this.each(function () { + expand($(this)); + }); + break + case 'init': + debugEnhanceInit(this, arg1); + break + case 'setConfig': + debugEnhanceSetConfig(this, arg1); + break + default: + debugEnhanceDefault(this); + break; } return this }; @@ -6608,6 +6612,7 @@ function debugEnhanceDefault ($node) { $node.each(function () { var $self = $(this); + var $parentLis = {}; if ($self.hasClass('debug')) { // console.warn('debugEnhance() : .debug') $self.find('.debug-menu-bar > nav, .tab-panes').show(); @@ -6628,12 +6633,10 @@ enhanceEntry($self); } else if ($self.prop('class').match(/\bt_/)) { // value - enhanceValue$1( - $self, - $self.parents('li').filter(function () { - return $(this).prop('class').match(/\bm_/) !== null - }) - ); + $parentLis = $self.parents('li').filter(function () { + return $(this).prop('class').match(/\bm_/) !== null + }); + enhanceValue$1($self, $parentLis); } // console.groupEnd() }); diff --git a/src/Debug/js/Debug.jquery.min.js b/src/Debug/js/Debug.jquery.min.js index 0d156980..ba077023 100644 --- a/src/Debug/js/Debug.jquery.min.js +++ b/src/Debug/js/Debug.jquery.min.js @@ -1 +1 @@ -!function(h){"use strict";var C,O;function P(n){var t,e=n.find("> .array-inner");0 .t_array-expand").length||(h.trim(e.html()).length<1?n.addClass("expanded").find("br").hide():(e=(t=n).find("> .array-inner"),t.closest(".array-file-tree").length?(t.find("> .t_keyword, > .t_punct").remove(),e.find("> li > .t_operator, > li > .t_key.t_int").remove(),t.prevAll(".t_key").each(function(){var e=h(this).attr("data-toggle","array");t.prepend(e),t.prepend('')})):(e=h('array( ··· )'),t.find("> .t_keyword").first().wrap('').after('( ').parent().next().remove(),t.prepend(e)),h.each(C.iconsArray,function(e,t){n.find(e).prepend(t)}),n.debugEnhance(function(e){var t=e.data("expand"),n=e.parentsUntil(".m_group",".t_object, .t_array").length,a=0===n;void 0===t&&0!==n&&(t=e.closest(".t_array[data-expand]").data("expand"));void 0===t&&(t=a);return t||e.hasClass("array-file-tree")}(n)?"expand":"collapse")))}function F(e){O=e.data("config").get(),e.on("click","[data-toggle=vis]",function(){(e=h(e=this),t=e.data("vis"),n=e.closest(".t_object"),a=n.find("> .object-inner"),i=a.find("[data-toggle=vis][data-vis="+t+"]"),t="inherited"===t?"dd[data-inherited-from], .private-ancestor":"."+t,a=a.find(t),t=e.hasClass("toggle-off"),i.html(e.html().replace(t?"show ":"hide ",t?"hide ":"show ")).addClass(t?"toggle-on":"toggle-off").removeClass(t?"toggle-off":"toggle-on"),t)?(i=a).each(function(){var n=h(this),e=n.closest(".object-inner"),a=!0;e.find("> .vis-toggles [data-toggle]").each(function(){var e=h(this),t=e.hasClass("toggle-on"),e=e.data("vis");if(!t&&1===n.filter("inherited"===e?"dd[data-inherited-from], .private-ancestor":"."+e).length)return a=!1}),a&&n.show()}):a.hide();var e,t,n,a,i;return R(n,!0),!1}),e.on("click","[data-toggle=interface]",function(){return H(this),!1})}function I(e){e.find("> .classname, > .t_const").each(function(){var e=h(this),t=e.next(),n="object"===e.data("toggle");t.is(".t_maxDepth, .t_recursion, .excluded")?e.addClass("empty"):n||0!==t.length&&(e.wrap('').after(' '),t.hide())})}function H(e){var e=h(e),n=e.closest(".t_object");(e=e.is(".toggle-off")?e.add(e.next().find(".toggle-off")):e.add(e.next().find(".toggle-on"))).each(function(){var e=h(this),t=e.data("interface"),t=N(n,t);e.is(".toggle-off")?(e.addClass("toggle-on").removeClass("toggle-off"),t.show()):(e.addClass("toggle-off").removeClass("toggle-on"),t.hide())}),R(n)}function N(e,t){t='> .object-inner > dd[data-implements="'+CSS.escape(t)+'"]';return e.find(t)}function R(e,t){var n=t?".object-inner > .heading":"> .object-inner > .heading";e.find(t?".object-inner > dt":"> .object-inner > dt").each(function(e,t){var n=h(t).nextUntil("dt"),a=n.not(".heading").filter(function(e,t){return"none"!==h(t).css("display")}),n=0 .object-inner"),i=e.data("accessible"),r=null;e.is(".enhanced")||(a.find("> .private, > .protected").filter(".magic, .magic-read, .magic-write").removeClass("private protected"),"public"===i&&(a.find(".private, .protected").hide(),r="allDesc"),(t=e).find("> .object-inner").find("> dd > ul > li > .interface, > dd > ul > li > .interface + ul .interface").each(function(){var e=h(this).text();0!==N(t,e).length&&h(this).addClass("toggle-on").prop("title","toggle interface methods").attr("data-toggle","interface").attr("data-interface",e)}).filter(".toggle-off").removeClass("toggle-off").each(function(){H(this)}),i=i,i=function(e,t){var n=h('
'),a="public"===t?"toggle-off":"toggle-on",t="public"===t?"show":"hide",i={hasProtected:''+t+" protected",hasPrivate:''+t+" private",hasExcluded:'show excluded',hasInherited:'hide inherited'};return h.each(e,function(e,t){t&&n.append(i[e])}),n}({hasProtected:0<(n=a).children(".protected").not(".magic, .magic-read, .magic-write").length,hasPrivate:0 dd[class*=t_modifier_]").length?n.find("> dd[class*=t_modifier_]").last().after(i):n.prepend(i),o=a,h.each(O.iconsObject,function(e,t){var n=!0,a=e.match(/(?:parent(\S+)\s)?(?:context(\S+)\s)?(.*)$/),i=t.match(/^([ap])\s*:(.+)$/);if(a){if(a[1]&&0===o.parent().filter(a[1]).length)return;a[2]&&(o=o.filter(a[2])),e=a[3]}i&&(n="p"===i[1],t=i[2]),a=o.find(e),n?a.prepend(t):a.append(t)}),a.find("> .property.forceShow").show().find("> .t_array").debugEnhance("expand"),r&&R(e,"allDesc"===r),e.addClass("enhanced"))}});function W(){var e=h(this).closest(".show-more-container");e.find(".show-more-wrapper").css("display","block").animate({height:"70px"}),e.find(".show-more-fade").fadeIn(),e.find(".show-more").show(),e.find(".show-less").hide()}function $(){var e=h(this).closest(".show-more-container");e.find(".show-more-wrapper").animate({height:e.find(".t_string").height()},400,"swing",function(){h(this).css("display","inline")}),e.find(".show-more-fade").fadeOut(),e.find(".show-more").hide(),e.find(".show-less").show()}function U(e){var t="https://symbl.cc/en/"+h(this).data("codePoint");e.stopPropagation(),window.open(t,"unicode").focus()}function z(e){var t=h(e.target),n=t.closest("li[class*=m_]");e.stopPropagation(),t.find("> .array-inner > li > :last-child, > .array-inner > li[class]").each(function(){q(this,n)})}function K(e){var t=h(e.target);e.stopPropagation(),t.find("> .group-body").debugEnhance()}function J(e){var t=h(e.target),n=t.closest("li[class*=m_]");e.stopPropagation(),t.is(".enhanced")||(t.find("> .object-inner").find("> .constant > :last-child,> .property > :last-child,> .method .t_string").each(function(){q(this,n)}),B.enhanceInner(t))}function Y(e){e=h(e.target),e=e.hasClass("t_array")?e.find("> .array-inner").find("> li > .t_string, > li.t_string"):e.hasClass("m_group")?e.find("> .group-body > li > .t_string"):e.hasClass("t_object")?e.find("> .object-inner").find(["> dd.constant > .t_string","> dd.property:visible > .t_string","> dd.method > ul > li > .t_string.return-value"].join(", ")):h();e.not("[data-type-more=numeric]").each(function(){var e;35<(e=h(this)).height()-70&&((e=e.wrap('
').parent()).append('
'),(e=e.wrap('
').parent()).append(''),e.append(''))})}function G(e){var s=h(e),e=s.find("> thead");s.is("table.sortable")&&(s.addClass("table-sort"),e.on("click","th",function(){var e,t=h(this),n=h(this).closest("tr").children(),a=n.index(t),i="desc"==(t.is(".sort-asc")?"asc":"desc")?"asc":"desc",n=(n.removeClass("sort-asc sort-desc"),t.addClass("sort-"+i),t.find(".sort-arrows").length||(n.find(".sort-arrows").remove(),t.append('')),s[0]),t=a,a=i,o=n.tBodies[0],r=o.rows,n="function"==typeof Intl.Collator?new Intl.Collator([],{numeric:!0,sensitivity:"base"}):null;for(a="desc"===a?-1:1,r=(r=Array.prototype.slice.call(r,0)).sort(function(i,o,r){var s=/^([+-]?(?:0|[1-9]\d*)(?:\.\d*)?)(?:[eE]([+-]?\d+))?$/;return function(e,t){var e=e.cells[i].textContent.trim(),t=t.cells[i].textContent.trim(),n=e.match(s),a=t.match(s);return n&&(e=X(e,n)),a&&(t=X(t,a)),o*function(e,t,n){var a=0;if(afloat&&bfloat)return e .object-inner > .property.debug-value > .t_identifier").filter(function(){return this.innerText.match(/^file$/)}),a=!0===e.data("detectFiles")||0 *:last-child").remove()}else a.find("table thead tr > *:last-child").after("");a.find("table tbody tr").each(function(){var e,t,n,a;e=h(this),t=o,n=e.find("> td"),a={file:e.data("file")||n.eq(0).text(),line:e.data("line")||n.eq(1).text()},a=h("",{class:"file-link",href:Z(a.file,a.line),html:'',style:"vertical-align: bottom",title:"Open in editor"}),t?e.find(".file-link").replaceWith(a):e.hasClass("context")?n.eq(0).attr("colspan",parseInt(n.eq(0).attr("colspan"),10)+1):n.last().after(h("",{class:"text-center",html:a}))})}else e.is("[data-file]")?(i=n,(a=e).find("> .file-link").remove(),i||a.append(h("",{html:'',href:Z(a.data("file"),a.data("line")),title:"Open in editor",class:"file-link lpad"})[0].outerHTML)):(a=t,l=n,d=(t=e).data("foundFiles")||[],a=(a=t.is(".m_table")?t.find("> table > tbody > tr > .t_string"):a)||[],h.each(a,function(){var e,t,n,a,i,o,r,s;t=l,n=d,o=h(e=this),e=e.attributes,r=h.trim(o.text()),n=function(e,t){var n=[],a=h.trim(e.text());if(e.data("file"))return"boolean"==typeof e.data("file")?[null,a,1]:[null,e.data("file"),e.data("line")||1];if(0===t.indexOf(a))return[null,a,1];if(e.parent(".property.debug-value").find("> .t_identifier").text().match(/^file$/))return n={line:1},e.parent().parent().find("> .property.debug-value").each(function(){var e=h(this).find("> .t_identifier")[0].innerText,t=h(this).find("> *:last-child"),t=h.trim(t[0].innerText);n[e]=t}),[null,a,n.line];return a.match(/^(\/.+\.php)(?: \(line (\d+)(, eval'd line \d+)?\))?$/)||[]}(o,n),s=!0!==t&&o.hasClass("file-link"),o.closest(".m_trace").length?c(o.closest(".m_trace")):n.length&&(n=function(e,t,n,a,i){var o;a?(o=h("",{text:n}),e.removeClass("file-link")):i?(o=e).prop("href",Z(t[1],t[2])):o=h("",{class:"file-link",href:Z(t[1],t[2]),html:n+' ',title:"Open in editor"});return o}(o,n,r,t,s),!1===s&&(a=o,i=n,s=e,h.each(s,function(){var e;void 0===this||(e=this.name,-1<["html","href","title"].indexOf(e))||("class"===e?(i.addClass(this.value),a.removeClass("t_string")):(i.attr(e,this.value),a.removeAttr(e)))}),s.style)&&i.attr("style",s.style.value),o.is("td, th, li")?o.html(t?r:n):o.replaceWith(n))}))}function Z(e,t){var n={file:e,line:t||1};return r.linkFilesTemplate.replace(/%(\w*)\b/g,function(e,t){return Object.prototype.hasOwnProperty.call(n,t)?n[t]:""})}var i,o,ie,oe,re=[],se=!1;function le(e){var t;s=e.data("config").get(),C=e.data("config").get(),F(e),q=l,B=V,(t=e).on("click",".close[data-dismiss=alert]",function(){h(this).parent().remove()}),t.on("click",".show-more-container .show-less",W),t.on("click",".show-more-container .show-more",$),t.on("click",".char-ws, .unicode",U),t.on("expand.debug.array",z),t.on("expand.debug.group",K),t.on("expand.debug.object",J),t.on("expanded.debug.next",".context",function(e){q(h(e.target).find("> td > .t_array"),h(e.target).closest("li"))}),t.on("expanded.debug.array expanded.debug.group expanded.debug.object",Y),Q(e)}function de(e){var t=e.parent(),t=!t.hasClass("m_group")||t.hasClass("expanded");if(e.hide(),e.children().each(function(){ce(h(this))}),t&&e.show().trigger("expanded.debug.group"),!se){for(se=!0;re.length;)re.shift().debugEnhance("expand");se=!1}!1===e.parent().hasClass("m_group")&&e.addClass("enhanced")}function ce(e){if(!e.hasClass("enhanced")){if(e.hasClass("m_group"))i=(a=e).find("> .group-header"),o=i.next(),fe(a),fe(i),i.attr("data-toggle","group"),i.find(".t_array, .t_object").each(function(){h(this).data("expand",!1),l(this,a)}),h.each(["level-error","level-info","level-warn"],function(e,t){var n;a.hasClass(t)&&(n=i.children("i").eq(0),i.wrapInner(''),i.prepend(n))}),a.hasClass("expanded")||o.find(".m_error, .m_warn").not(".filter-hidden").not("[data-uncollapse=false]").length?re.push(i):i.debugEnhance("collapse",!0);else{if(e.hasClass("filter-hidden"))return;var t,n;e.is(".m_table, .m_trace")?(c(t=e),fe(t),t.hasClass("m_table")&&t.find("> table > tbody > tr > td").each(function(){l(this,t)}),t.find("tbody > tr.expanded").next().trigger("expanded.debug.next"),G(t.find("> table"))):((n=e).data("file")&&(n.attr("title")||(o=n.data("file")+": line "+n.data("line"),n.data("evalline")&&(o+=" (eval'd line "+n.data("evalline")+")"),n.attr("title",o)),c(n)),fe(n),n.children().each(function(){l(this,n)}))}var a,i,o;e.addClass("enhanced"),e.trigger("enhanced.debug")}}function l(e,t){e=h(e);e.is(".t_array")?P(e):e.is(".t_object")?I(e):e.is("table")?G(e):e.is(".t_string")?c(t,e):e.is(".string-encoded.tabs-container")&&l(e.find("> .tab-pane.active > *"),t)}function fe(e){var t,n,a,i,o=function(e){var t,n,a;if(e.data("icon"))return e.data("icon").match("<")?h(e.data("icon")):h("").addClass(e.data("icon"));if(!e.hasClass("m_group"))for(a in n=e.hasClass("group-header")?e.parent():e,s.iconsMethods)if(n.is(a)){t=h(s.iconsMethods[a]);break}return t}(e),r=e;for(i in s.iconsMisc)0!==(a=r.find(i)).length&&(n=h(s.iconsMisc[i]),n=(a.find("> i:first-child").hasClass(n.attr("class"))||a.prepend(n),null));o&&(e.hasClass("m_group")?e=e.find("> .group-header .group-label").eq(0):e.find("> table").length&&((t=e.find("> table > caption")).length||(t=h(""),e.find("> table").prepend(t)),e=t),e.find("> i:first-child").hasClass(o.attr("class"))||e.prepend(o))}function pe(e){(o=(i=e).data("config")).get("drawer")&&(i.addClass("debug-drawer debug-enhanced-ui"),(e=i.find(".debug-menu-bar")).before('
PHP
'),e.find(".float-right").append(''),i.find(".tab-panes").scrollLock(),i.find(".debug-resize-handle").on("mousedown",me),i.find(".debug-pull-tab").on("click",ue),i.find(".debug-menu-bar .close").on("click",ge),o.get("persistDrawer"))&&o.get("openDrawer")&&ue()}function ue(){i.addClass("debug-drawer-open"),i.debugEnhance(),ve(),h("body").css("marginBottom",i.height()+8+"px"),h(window).on("resize",ve),o.get("persistDrawer")&&o.set("openDrawer",!0)}function ge(){i.removeClass("debug-drawer-open"),h("body").css("marginBottom",""),h(window).off("resize",ve),o.get("persistDrawer")&&o.set("openDrawer",!1)}function he(e){ve(ie+(oe-e.pageY),!0)}function me(e){h(e.target).closest(".debug-drawer").is(".debug-drawer-open")&&(ie=i.find(".tab-panes").height(),oe=e.pageY,h("html").addClass("debug-resizing"),i.parents().on("mousemove",he).on("mouseup",be),e.preventDefault())}function be(){h("html").removeClass("debug-resizing"),i.parents().off("mousemove",he).off("mouseup",be),h("body").css("marginBottom",i.height()+8+"px")}function ve(e,t){var n=i.find(".tab-panes"),a=i.find(".debug-menu-bar").outerHeight(),a=window.innerHeight-a-50;e=function(e){var t=i.find(".tab-panes");if(e&&"object"!=typeof e)return e;!(e=parseInt(t[0].style.height,10))&&o.get("persistDrawer")&&(e=o.get("height"));return e||100}(e),e=Math.min(e,a),e=Math.max(e,20),n.css("height",e),t&&o.get("persistDrawer")&&o.set("height",e)}h.fn.scrollLock=function(e){return(e=void 0===e||e)?void h(this).on("DOMMouseScroll mousewheel wheel",function(e){function t(){return e.stopPropagation(),e.preventDefault(),e.returnValue=!1}var n=h(this),a=this.scrollTop,i=this.scrollHeight,o=n.innerHeight(),r=e.originalEvent.wheelDelta,s=0 .tab-body > hr").toggleClass("filter-hidden",0 .tab-body").find(" > .debug-log-summary, > .debug-log").filter(function(){return h(this).height()<1}).length)}function ke(){var e=h(this),t=e.is(":checked"),n=e.closest("label").next("ul").find("input"),a=e.closest(".debug");0 .tab-panes > .tab-primary > .tab-body").find(".m_alert, .group-body > *:not(.m_groupSummary)").each(function(){s.push({depth:h(this).parentsUntil(".tab_body").length,node:h(this)})}),s.sort(function(e,t){return e.depth .group-body").debugEnhance()}(l),o)&&l.hasClass("m_group")&&l.trigger("collapsed.debug.group")}_e(e.find("> .tab-panes > .tab-pane.active")),Ee(e)}function Ee(e){var t=0'),a.get("drawer")||e.find("input[name=persistDrawer]").closest("label").remove(),n.find(".debug-options-toggle").on("click",Ie),h("input[name=debugCookie]").on("change",Fe).prop("checked",a.get("debugKey")&&Te("debug")===a.get("debugKey")),a.get("debugKey")||h("input[name=debugCookie]").prop("disabled",!0).closest("label").addClass("disabled"),h("input[name=persistDrawer]").on("change",Re).prop("checked",a.get("persistDrawer")),n.find("input[name=linkFiles]").on("change",He).prop("checked",a.get("linkFiles")).trigger("change"),n.find("input[name=linkFilesTemplate]").on("change",Ne).val(a.get("linkFilesTemplate"))}function Me(e){0===n.find(".debug-options").find(e.target).length&&Be()}function Pe(e){e.keyCode===Le&&Be()}function Fe(){h(this).is(":checked")?je("debug",a.get("debugKey"),7):je("debug","",-1)}function Ie(e){var t=h(this).closest(".debug-bar").find(".debug-options").is(".show");n=h(this).closest(".debug"),t?Be():(n.find(".debug-options").addClass("show"),h("body").on("click",Me),h("body").on("keyup",Pe)),e.stopPropagation()}function He(){var e=h(this).prop("checked"),t=h(this).closest(".debug-options").find("input[name=linkFilesTemplate]").closest(".form-group");e?t.slideDown():t.slideUp(),a.set("linkFiles",e),h("input[name=linkFilesTemplate]").trigger("change")}function Ne(){var e=h(this).val();a.set("linkFilesTemplate",e),n.trigger("config.debug.updated","linkFilesTemplate")}function Re(){var e=h(this).is(":checked");a.set({persistDrawer:e,openDrawer:e,openSidebar:!0})}function Be(){n.find(".debug-options").removeClass("show"),h("body").off("click",Me),h("body").off("keyup",Pe)}var qe,f,p,Ve=!1,We={alert:'Alerts',error:'Error',warn:'Warning',info:'Info',other:'Other'},$e='
';function Ue(e){t=e.data("config")||h("body").data("config"),(De=e.find("> .tab-panes > .tab-primary").data("options")||{}).sidebar&&Xe(e),t.get("persistDrawer")&&!t.get("openSidebar")&&Qe(e),e.on("click",".close[data-dismiss=alert]",Ke),e.on("click",".sidebar-toggle",Je),e.on("change",".debug-sidebar input[type=checkbox]",ze),Ve||(xe.push(Ge),we.push(Ye),Ve=!0)}function ze(e){var t=h(this),n=t.closest(".toggle"),a=n.next("ul").find(".toggle"),i=t.is(":checked"),o=h(".m_alert.error-summary.have-fatal");n.toggleClass("active",i),a.toggleClass("active",i),"fatal"===t.val()&&(o.find(".error-fatal").toggleClass("filter-hidden",!i),o.toggleClass("filter-hidden",0===o.children().not(".filter-hidden").length))}function Ke(e){var t=h(e.delegateTarget);setTimeout(function(){0===t.find(".tab-primary > .tab-body > .m_alert").length&&t.find(".debug-sidebar input[data-toggle=method][value=alert]").parent().addClass("disabled")})}function Je(){var e=h(this).closest(".debug");(e.find(".debug-sidebar").is(".show")?Qe:Ze)(e)}function Ye(e){var t=e[0].className.match(/\bm_(\S+)\b/),t=t?t[1]:null;return!De.sidebar||("group"===t&&e.find("> .group-body")[0].className.match(/level-(error|info|warn)/)&&(t=e.find("> .group-body")[0].className.match(/level-(error|info|warn)/)[1],e.toggleClass("filter-hidden-body",d.indexOf(t)<0)),-1<["alert","error","warn","info"].indexOf(t)?-1 .tab-primary > .tab-body > .expand-all"),s=(e.find(".tab-panes > .tab-primary > .tab-body").before(o),l=(l=e).closest(".debug").find(".m_alert.error-summary"),(s=l.find(".in-console")).prev().remove(),s.remove(),0===l.children().length&&l.remove(),i=(a=e).find(".debug-sidebar .php-errors ul"),h.each(["fatal","error","warning","deprecated","notice","strict"],function(e,t){var n=("fatal"===t?a.find(".m_alert.error-summary.have-fatal"):a.find(".error-"+t).filter(".m_error,.m_warn")).length;0!==n&&i.append(h("
  • ").append(h('