Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TestLogger.php

function TestLogger::__call

Parameters

array<int, mixed> $args:

File

vendor/colinodell/psr-testlogger/src/TestLogger.php, line 151

Class

TestLogger
Used for testing purposes.

Namespace

ColinODell\PsrTestLogger

Code

public function __call(string $method, array $args) : bool {
    if (\preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
        $genericMethod = $matches[1] . ($matches[3] !== 'Records' ? 'Record' : '') . $matches[3];
        $callable = [
            $this,
            $genericMethod,
        ];
        $level = \strtolower($matches[2]);
        if (\is_callable($callable)) {
            $args[] = $level;
            return \call_user_func_array($callable, $args);
        }
    }
    throw new \BadMethodCallException('Call to undefined method ' . self::class . '::' . $method . '()');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal