Puli\Repository\InMemoryRepository::find PHP Method

find() public method

public find ( $query, $language = 'glob' )
    public function find($query, $language = 'glob')
    {
        $this->failUnlessGlob($language);
        $query = $this->sanitizePath($query);
        $resources = array();
        if (Glob::isDynamic($query)) {
            $resources = $this->getGlobIterator($query);
        } elseif (isset($this->resources[$query])) {
            $resources = array($this->resources[$query]);
        }
        return new ArrayResourceCollection($resources);
    }

Usage Example

 /**
  * @expectedException \Puli\Repository\Api\UnsupportedLanguageException
  * @expectedExceptionMessage foobar
  */
 public function testFindFailsIfLanguageNotGlob()
 {
     $repo = new InMemoryRepository();
     $repo->find('/*', 'foobar');
 }