Advertisement
fruffl

::aspectable()

Jan 19th, 2013
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.76 KB | None | 0 0
  1.  
  2.         protected static function aspectable($__function, array $__parameters = [], $__prototype = NULL)
  3.         {
  4.             $__class = get_called_class();
  5.            
  6.             if(isset($__parameters['this']))
  7.                 unset($__parameters['this']);
  8.            
  9.             if(TRUE === static::Core_StaticObject_tAdapter_exists($__function))
  10.                 return static::Core_StaticObject_tAdapter_emit($__function, $__parameters);
  11.            
  12.             $__parameters = static::Core_StaticObject_tFilter_emit($__function, 'PARAMS', $__parameters, ['return' => $__parameters]);
  13.            
  14.             static::Core_StaticObject_tSignal_emit($__function, 'PRE_EVENT', [$__parameters], ['return' => $__parameters]);
  15.            
  16.             $__result = static::Core_StaticObject_tMethodFacade_emit($__function, $__parameters, function(array $__params) use ($__class, $__function, $__prototype)
  17.             {
  18.                 $result = NULL;
  19.                
  20.                 if(TRUE === static::Core_StaticObject_tMethodProto_exists($__function))
  21.                     return static::Core_StaticObject_tMethodProto_emit($__function, $__params);
  22.                
  23.                 if(NULL !== $__prototype)
  24.                 {
  25.                     $proto = Invoke::normalize($__prototype, $__class);
  26.                    
  27.                     if($proto[0] === $__class
  28.                     && isset($proto[1])
  29.                     && is_string($proto[1]))
  30.                         return static::Core_StaticObject_tInvoke_method($proto[1], $__params);
  31.                    
  32.                     return isset($proto[1])
  33.                         ? Invoke::emit($proto[0], $proto[1], $__params)
  34.                         : Invoke::emit($proto[0], $__params);
  35.                 }
  36.                
  37.                 return NULL;
  38.             });
  39.            
  40.             $__result = static::Core_StaticObject_tFilter_emit($__function, 'RETURN', $__result, ['return' => $__result]);
  41.            
  42.             static::Core_StaticObject_tObserver_emit($__function, [$__result, $__parameters]);
  43.             static::Core_StaticObject_tSignal_emit($__function, 'POST_EVENT',  [$__result, $__parameters], ['return' => $__result]);
  44.            
  45.             return $__result;
  46.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement