Exemple #1
0
 /**
  * The JIT patcher.
  *
  * @param  NodeDef $node The node to patch.
  * @param  string  $path The file path of the source code.
  * @return NodeDef       The patched node.
  */
 public function process($node, $path = null)
 {
     $args = func_get_args();
     $self = isset($this) ? $this : get_called_class();
     if ($pointcut = Pointcut::before(__METHOD__, $self, $args)) {
         return $pointcut($args, $self);
     }
     return $node;
 }
 public final function finalMethod($param1 = 'default', $param2 = null)
 {
     $__KPOINTCUT_ARGS__ = func_get_args();
     $__KPOINTCUT_SELF__ = isset($this) ? $this : get_called_class();
     if ($__KPOINTCUT__ = \kahlan\plugin\Pointcut::before(__METHOD__, $__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__)) {
         $r = $__KPOINTCUT__($__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__);
         return $r;
     }
     rand(2, 5);
 }
Exemple #3
0
 public function generatorMethod($param1, &$param2, &$param2 = [])
 {
     $__KPOINTCUT_ARGS__ = func_get_args();
     $__KPOINTCUT_SELF__ = isset($this) ? $this : get_called_class();
     if ($__KPOINTCUT__ = \Kahlan\Plugin\Pointcut::before(__METHOD__, $__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__)) {
         $r = $__KPOINTCUT__($__KPOINTCUT_ARGS__, $__KPOINTCUT_SELF__);
         (yield $r);
     }
     (yield rand(2, 5));
 }
Exemple #4
0
 public function getPrefixesCustom()
 {
     $args = func_get_args();
     $self = isset($this) ? $this : get_called_class();
     if ($pointcut = Pointcut::before(__METHOD__, $self, $args)) {
         return $pointcut($self, $args);
     }
     return [];
 }