PhpSpec\Event\MethodCallEvent::getSubject PHP Method

getSubject() public method

public getSubject ( ) : mixed
return mixed
    public function getSubject()
    {
        return $this->subject;
    }

Usage Example

 public function afterExample(ExampleEvent $exampleEvent)
 {
     $exception = $exampleEvent->getException();
     if (!$exception instanceof NotEqualException) {
         return;
     }
     if ($exception->getActual() !== null) {
         return;
     }
     if (is_object($exception->getExpected()) || is_array($exception->getExpected()) || is_resource($exception->getExpected())) {
         return;
     }
     if (!$this->lastMethodCallEvent) {
         return;
     }
     $class = get_class($this->lastMethodCallEvent->getSubject());
     $method = $this->lastMethodCallEvent->getMethod();
     if (!$this->methodAnalyser->methodIsEmpty($class, $method)) {
         return;
     }
     $key = $class . '::' . $method;
     if (!array_key_exists($key, $this->nullMethods)) {
         $this->nullMethods[$key] = array('class' => $class, 'method' => $method, 'expected' => array());
     }
     $this->nullMethods[$key]['expected'][] = $exception->getExpected();
 }
All Usage Examples Of PhpSpec\Event\MethodCallEvent::getSubject