Go\Aop\Intercept\MethodInvocation::getMethod PHP Méthode

getMethod() public méthode

Gets the method being called.
public getMethod ( ) : ReflectionMetho\ReflectionMethod | AnnotatedReflectionMethod
Résultat ReflectionMetho\ReflectionMethod | Go\Aop\Support\AnnotatedReflectionMethod the method being called.
    public function getMethod();

Usage Example

Exemple #1
0
 /**
  * Checks if this method invocation is mockable.
  *
  * @param MethodInvocation $invocation        	
  * @return object The mock return value if this invocation is happening in test
  *         environment and it is listed in the mockable_methods array null otherwise.
  */
 private static function isMockable(MethodInvocation $invocation)
 {
     // Check for testing config, nothing is mockable if we are not testing
     if (Config::get('aopmock.testing') === false) {
         return null;
     }
     // Get the object
     $obj = $invocation->getThis();
     // Get the method name
     $methodName = $invocation->getMethod()->name;
     // Get class name
     if ($invocation->getMethod()->isStatic()) {
         $class = $obj;
         $obj = new $class();
     } else {
         $class = get_class($obj);
     }
     $types = Config::get('aopmock.mockable_methods');
     foreach ($types as $type => $val) {
         if ($obj instanceof $type) {
             if (isset($types[$type][$methodName])) {
                 return $types[$type][$methodName];
             }
         }
     }
     return null;
 }
All Usage Examples Of Go\Aop\Intercept\MethodInvocation::getMethod
MethodInvocation