Kahlan\Plugin\Call\Calls::log PHP Method

log() public static method

Logs a call.
public static log ( mixed $reference, string $call )
$reference mixed An instance or a fully-namespaced class name or an array of them.
$call string The method name.
    public static function log($reference, $call)
    {
        $calls = [];
        if (is_array($reference)) {
            foreach ($reference as $value) {
                $calls[] = static::_call($value, $call);
            }
        } else {
            $calls[] = static::_call($reference, $call);
        }
        static::$_logs[] = $calls;
    }

Usage Example

Esempio n. 1
0
 /**
  * Patches the string.
  *
  * @param  string  $namespace The namespace.
  * @param  string  $ref       The fully namespaced class/function reference string.
  * @param  boolean $isFunc    Boolean indicating if $ref is a function reference.
  * @return string             A fully namespaced reference.
  */
 public static function patched($namespace, $ref, $isFunc = true, &$substitute = null)
 {
     $name = $ref;
     if ($namespace) {
         if (!$isFunc || function_exists("{$namespace}\\{$ref}")) {
             $name = "{$namespace}\\{$ref}";
         }
     }
     $method = isset(static::$_registered[$name]) ? static::$_registered[$name] : null;
     $fake = $method ? $method->substitute() : null;
     if (!$isFunc) {
         if (is_object($fake)) {
             $substitute = $fake;
         }
         return $fake ?: $name;
     }
     if (!Suite::registered($name) && !$method) {
         return $name;
     }
     return function () use($name, $method) {
         $args = func_get_args();
         if (Suite::registered($name)) {
             Calls::log(null, compact('name', 'args'));
         }
         if ($method && $method->matchArgs($args)) {
             return $method($args);
         }
         return call_user_func_array($name, $args);
     };
 }
All Usage Examples Of Kahlan\Plugin\Call\Calls::log