original_string: 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];
      }
code: 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];
      }
code_tokens: 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 ] ; }
docstring: 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
docstring_tokens: Get a mock from a collection .