/**
  * @inheritdoc
  * @see \Aop\JoinPoint\Support\ClassSupportInterface::getClassName()
  */
 public function getClassName()
 {
     return Stack\topCalledClass();
 }
Ejemplo n.º 2
0
 private function superclassMatches()
 {
     return $this->superclass === null || Stack\topCalledClass() === $this->superclass || is_subclass_of(Stack\topCalledClass(), $this->superclass);
 }
Ejemplo n.º 3
0
function callOriginal(array $args = null)
{
    list($class, $method, $offset) = end(State::$patchStack);
    $patch =& State::$patches[$class][$method][$offset];
    $backup = $patch;
    $patch = array('Patchwork\\fallBack', new PatchHandle());
    $top = Stack\top();
    if ($args === null) {
        $args = $top["args"];
    }
    try {
        if (isset($top["class"])) {
            $reflection = new \ReflectionMethod(Stack\topCalledClass(), $top["function"]);
            $reflection->setAccessible(true);
            $result = $reflection->invokeArgs(Stack\top("object"), $args);
        } else {
            $result = call_user_func_array($top["function"], $args);
        }
    } catch (\Exception $e) {
        $exception = $e;
    }
    $patch = $backup;
    if (isset($exception)) {
        throw $exception;
    }
    return $result;
}
Ejemplo n.º 4
0
function relay(array $args = null)
{
    list($class, $method, $offset) = end(State::$routeStack);
    $route =& State::$routes[$class][$method][$offset];
    $backup = $route;
    $route = ['Patchwork\\fallBack', new Handle()];
    $top = Stack\top();
    if ($args === null) {
        $args = $top['args'];
    }
    try {
        if (isset($top['class'])) {
            $reflection = new \ReflectionMethod(Stack\topCalledClass(), $top['function']);
            $reflection->setAccessible(true);
            $result = $reflection->invokeArgs(Stack\top('object'), $args);
        } else {
            $result = call_user_func_array($top['function'], $args);
        }
    } catch (\Exception $e) {
        $exception = $e;
    }
    $route = $backup;
    if (isset($exception)) {
        throw $exception;
    }
    return $result;
}