PHPSpec2\Prophet\ObjectProphet::callOnProphetSubject PHP Method

callOnProphetSubject() public method

public callOnProphetSubject ( $method, array $arguments = [] )
$arguments array
    public function callOnProphetSubject($method, array $arguments = array())
    {
        if (null === $this->getWrappedSubject()) {
            throw new BehaviorException(sprintf('Call to a member function <value>%s()</value> on a non-object.', $method));
        }
        // resolve arguments
        $subject = $this->unwrapper->unwrapOne($this);
        $arguments = $this->unwrapper->unwrapAll($arguments);
        // if subject is an instance with provided method - call it and stub the result
        if ($this->isSubjectMethodAccessible($method)) {
            $returnValue = call_user_func_array(array($subject, $method), $arguments);
            return new static($returnValue, $this->matchers, $this->unwrapper);
        }
        throw new MethodNotFoundException($subject, $method);
    }