* @return $debugInstance An instance of this middleware class
* @throws InvalidArgumentException If a parameter has an invalid value
*/
- public static final function createDebugMiddleware (string $outputClass, string $className) {
+ public static final function createDebugMiddleware (string $outputClass, string $className): Logger {
// Check parameter
//* NOISY-DEBUG: */ printf('[%s:%d]: outputClass=%s,className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $outputClass, $className);
if (empty($outputClass)) {
// Is there a valid output instance provided?
//* NOISY-DEBUG: */ printf('[%s:%d]: outputClass=%s' . PHP_EOL, __METHOD__, __LINE__, $outputClass);
- if (class_exists($outputClass) && is_null(self::$selfInstance->getOutputInstance())) {
+ if (class_exists($outputClass) && !self::$selfInstance->isOutputInstanceSet()) {
// A name for a debug output class has been provided so we try to get it
//* NOISY-DEBUG: */ printf('[%s:%d]: Initializing outputClass=%s ...' . PHP_EOL, __METHOD__, __LINE__, $outputClass);
$outputInstance = ObjectFactory::createObjectByName($outputClass);
}
// Is the output class loadable and an output instance is set?
- if (class_exists($outputClass) && !is_null(self::$selfInstance->getOutputInstance())) {
+ if (class_exists($outputClass) && self::$selfInstance->isOutputInstanceSet()) {
// Then set class name
//* NOISY-DEBUG: */ printf('[%s:%d]: Setting className=%s as logger class ...' . PHP_EOL, __METHOD__, __LINE__, $className);
self::$selfInstance->getOutputInstance()->setLoggerClassName($className);
* @return void
* @throws NullPointerException If this->outputInstance is NULL
*/
- private function outputMessage (string $logLevel, string $message, bool $stripTags = false) {
+ private function outputMessage (string $logLevel, string $message, bool $stripTags = false): void {
// Get backtrace
//* NOISY-DEBUG: */ printf('[%s:%d]: logLevel=%s,message=%s,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $logLevel, $message, intval($stripTags));
$backtrace = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT);
*
* @return $selfInstance An instance of this class
*/
- public static final function getSelfInstance() {
+ public static final function getSelfInstance(): Logger {
return self::$selfInstance;
}
* @throws NullPointerException If this->outputInstance is NULL
* @todo Remove $doPrint parameter
*/
- public function traceMessage (string $message, bool $doPrint = true, bool $stripTags = false) {
+ public function traceMessage (string $message, bool $doPrint = true, bool $stripTags = false): void {
// Check parameter
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
if (empty($message)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (is_null($this->getOutputInstance())) {
+ } elseif (!$this->isOutputInstanceSet()) {
// Should not be NULL
throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
}
* @throws NullPointerException If this->outputInstance is NULL
* @todo Remove $doPrint parameter
*/
- public function debugMessage (string $message, bool $doPrint = true, bool $stripTags = false) {
+ public function debugMessage (string $message, bool $doPrint = true, bool $stripTags = false): void {
// Check parameter
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
if (empty($message)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (is_null($this->getOutputInstance())) {
+ } elseif (!$this->isOutputInstanceSet()) {
// Should not be NULL
throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
}
* @throws NullPointerException If this->outputInstance is NULL
* @todo Remove $doPrint parameter
*/
- public function infoMessage (string $message, bool $doPrint = true, bool $stripTags = false) {
+ public function infoMessage (string $message, bool $doPrint = true, bool $stripTags = false): void {
// Check parameter
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
if (empty($message)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (is_null($this->getOutputInstance())) {
+ } elseif (!$this->isOutputInstanceSet()) {
// Should not be NULL
throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
}
* @throws NullPointerException If this->outputInstance is NULL
* @todo Remove $doPrint parameter
*/
- public function warningMessage (string $message, bool $doPrint = true, bool $stripTags = false) {
+ public function warningMessage (string $message, bool $doPrint = true, bool $stripTags = false): void {
// Check parameter
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
if (empty($message)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (is_null($this->getOutputInstance())) {
+ } elseif (!$this->isOutputInstanceSet()) {
// Should not be NULL
throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
}
* @param $message An optional message to display
* @return void
*/
- public function partialStub (string $message = '') {
+ public function partialStub (string $message = ''): void {
// Init variable
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message);
$stubMessage = 'Partial stub!';
* @todo Remove $doPrint parameter
* @todo When all old method invocations are fixed, renamed this do deprecatedMessage
*/
- public function debugOutput (string $message, bool $doPrint = true, bool $stripTags = false) {
+ public function debugOutput (string $message, bool $doPrint = true, bool $stripTags = false): void {
// Check parameter
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,doPrint=%d,stripTags=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, intval($doPrint), intval($stripTags));
if (empty($message)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "message" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (is_null($this->getOutputInstance())) {
+ } elseif (!$this->isOutputInstanceSet()) {
// Should not be NULL
throw new NullPointerException($this, FrameworkInterface::EXCEPTION_IS_NULL_POINTER);
}