Eloquent\Phony\Stub\StubData::closeRule PHP Method

closeRule() public method

Close any existing rule.
public closeRule ( )
    public function closeRule()
    {
        if (!empty($this->secondaryRequests)) {
            call_user_func($this->defaultAnswerCallback, $this);
            $this->secondaryRequests = array();
        }
        if (!empty($this->answers)) {
            if (null !== $this->criteria) {
                $rule = new StubRule($this->criteria, $this->answers);
                $this->criteria = null;
            } else {
                $rule = new StubRule(array($this->matcherFactory->wildcard()), $this->answers);
            }
            array_unshift($this->rules, $rule);
            $this->answers = array();
        }
        if (null !== $this->criteria) {
            $criteria = $this->criteria;
            $this->criteria = null;
            throw new UnusedStubCriteriaException($criteria);
        }
    }