Add an expectation to the set

@param Expectation $e
@throws Exception\UnknownMethodException
@internal param \QuickMock\Expectation\Expectation $method
322996
public function add(Expectation $e)
    {
        if ($this->mockedMethods !== null && !in_array($e->getMethod(), $this->mockedMethods)) {
            $message = "Attempt to mock unknown method \"{$e->getMethod()}\".";

            if (count($this->mockedMethods) > 0) {
                $message .= " The mocked methods are: " . implode(", ", $this->mockedMethods);
            } else {
                $message .= " There are no methods in the mocked class!";
            }

            throw new UnknownMethodException($message);
        }
        
        $this->expectations[] = $e;
    }
1253414
public function setEvent(Event $e) : void
    {
        if ( ! $e instanceof DoctrineEvent) {
            $eventParams = $e->getParams();
            $e = new DoctrineEvent();
            $e->setParams($eventParams);
            unset($eventParams);
        }
        $this->event = $e;
    }
1051740
public function shouldReceive($method)
    {
        $builder = new MutableExpectationBuilder($method);
        $expectation = $builder->getExpectation();
        $builder->withAnyArgs()->atLeast(1);
        $this->add($expectation);
        return $builder;
    }
349008
protected function validateScenarioNameOrThrowException(
        Expectation $expectation,
        LoggerInterface $logger
    ) {
        if (!$expectation->getScenarioName()
            && ($expectation->getScenarioStateIs() || $expectation->getNewScenarioState())
        ) {
            $logger->error('Scenario name related misconfiguration');
            throw new \RuntimeException(
                'Expecting or trying to set scenario state without specifying scenario name'
            );
        }
    }
407275
private function searchForExecutionsCount(Expectation $expectation)
    {
        $count = 0;
        foreach ($this->requestsStorage->listRequests() as $request) {
            if ($this->comparator->equals($request, $expectation)) {
                ++$count;
            }
        }

        return $count;
    }
1327410
protected void addMethod(String k, ExecutableElement e, MethodModel exec) {
    ArrayList<ContractableMethod> list = methodMap.get(k);
    if (list == null) {
      list = new ArrayList<ContractableMethod>();
      methodMap.put(k, list);
    }
    list.add(new ContractableMethod(e, exec));
  }
428475
public function preBuildListener(Event $e)
    {
        if ($e->getParam('name') == 'addPurchase') {
            $item = new ItemBuilder;
            $item->setId($e->getParam('id'))
                 ->setDate($e->getParam('date'));
            $this->addBuilder($item);
        }
    }
844635
public function setMethod(string $method): void
    {
        if (!\in_array($method, $this->getAvailableMethods(), true)) {
            throw new SessionException(\sprintf('Method unknowed: %s', $method));
        }

        $this->method = $method;
    }
1250093
public function andThrow($e)
    {
        if (! $e instanceof \Exception) {
            if (is_scalar($e) && class_exists($e) && is_a($e, '\Exception', true)) {
                $e = new $e("Generic message");
            } else {
                throw new \LogicException("Can only create exceptions on-the-fly with a scalar message");
            }
        }

        $this->andReturn(function() use ($e){
            if (! $e instanceof \Exception) {
                throw new \Exception($e);
            } else {
                throw $e;
            }
        });
        
        return $this;
    }
760107
public function throw_exception($e=null)
    {
        $e = $e ?: new \Exception();

        foreach ($this->policies as $policy) {
            $policy->check_method_throws($this->className, $this->methodName, $e, true);
        }

        $this->will(function () use ($e) {
            throw $e;
        });

        return $this;
    }
11675
public void add (E e) {
		// is size greater than capacity increase capacity
		if (size == data.length) {
			grow();
		}

		data[size++] = e;
	}
790046
public function shouldPrecede($first, $second) {
    $page = $this->getSession()->getPage()->getText();
    $pos1 = strpos($page, $first);
    if ($pos1 === FALSE) {
      throw new ExpectationException("Text not found: '$first'.", $this->getSession());
    }
    $pos2 = strpos($page, $second);
    if ($pos2 === FALSE) {
      throw new ExpectationException("Text not found: '$second'.", $this->getSession());
    }
    if ($pos2 < $pos1) {
      throw new \Exception("Text '$first' does not precede text '$second'.");
    }
  }
1149625
public function addThrowable($e)
    {
        if ($this->hasCollector('exceptions')) {
            /** @var \DebugBar\DataCollector\ExceptionsCollector $collector */
            $collector = $this->getCollector('exceptions');
            $collector->addThrowable($e);
        }
    }
184354
public void add(final int[] e) {
        if (size == list.length) list = Array.copyOf(list, newSize());
        list[size++] = e;
    }
573073
public static function newException(\Exception $e, $method, $path, array $params)
    {
        $self = new self(sprintf('Api method error: %s : %s', $method, $path), $e->getCode(), $e);
        $self->method = $method;
        $self->path = $path;
        $self->params = $params;

        return $self;
    }
967422
public void set(final Exception e) {
		if (this.value.compareAndSet(null, e)) {
			this.listeners.clear();
			this.cdl.countDown();
		}
	}
967739
public function yyerror( $message, $expected = null )
	{
		if ( ! is_null( $this->errorText ) && ! is_null( $expected ) && count( $expected ) > 0 )
		{
			$errorMsg = $message . ", expecting";
			for ( $n = 0; $n < count( $expected ); ++ $n )
				$errorMsg .= " " . $expected[ $n ];
			$this->errorText[] = "$errorMsg\n";
		} else
			$this->errorText[] = "$message\n";
	}