PHPSpec2\Mocker\MockeryMocker::getExpectation PHP Method

getExpectation() public method

public getExpectation ( $mock, $method, array $arguments = null, $offset = null )
$arguments array
    public function getExpectation($mock, $method, array $arguments = null, $offset = null)
    {
        if (null === ($director = $mock->mockery_getExpectationsFor($method))) {
            return;
        }
        $expectations = $director->getExpectations();
        if (null !== $arguments) {
            $expectations = array_filter($expectations, function ($expectation) use($arguments) {
                return $expectation->matchArgs($arguments);
            });
            $expectations = array_values($expectations);
        }
        if (0 == ($count = count($expectations))) {
            return;
        }
        if (null !== $offset) {
            if ($offset >= 0 && isset($expectations[$offset])) {
                return $expectations[$offset];
            }
            if ($offset < 0 && isset($expectations[$count + $offset])) {
                return $expectations[$count + $offset];
            }
            return;
        }
        return end($expectations);
    }