protected function getMockFromMocksCollection($mockName, $collection, $andRemove = false)
    {
        if (!isset($this->expectedMocksCollections[$collection][$mockName])) {
            throw new \InvalidArgumentException(sprintf('The required mock "%s" doesn\'t exist in collection "%s".', $mockName, $collection));
        }

        if ($andRemove) {
            $this->removeMockFromMocksCollection($mockName, $collection);
        }

        return $this->expectedMocksCollections[$collection][$mockName];
    }
protected function getMockFromMocksCollection($mockName, $collection, $andRemove = false)
    {
        if (!isset($this->expectedMocksCollections[$collection][$mockName])) {
            throw new \InvalidArgumentException(sprintf('The required mock "%s" doesn\'t exist in collection "%s".', $mockName, $collection));
        }

        if ($andRemove) {
            $this->removeMockFromMocksCollection($mockName, $collection);
        }

        return $this->expectedMocksCollections[$collection][$mockName];
    }
protected function getMockFromMocksCollection ( $ mockName , $ collection , $ andRemove = false ) { if ( ! isset ( $ this -> expectedMocksCollections [ $ collection ] [ $ mockName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The required mock "%s" doesn\'t exist in collection "%s".' , $ mockName , $ collection ) ) ; } if ( $ andRemove ) { $ this -> removeMockFromMocksCollection ( $ mockName , $ collection ) ; } return $ this -> expectedMocksCollections [ $ collection ] [ $ mockName ] ; }
Get a mock from a collection.

If $removeFromCollection is set to true, it also removes the mock from the collection.
If the collection is in the expected values array, removes the mock from the expected values too.

@param $mockName
@param $collection
@param $andRemove
Get a mock from a collection .