Puli\Repository\Resource\DirectoryResource::hasChild PHP Метод

hasChild() публичный Метод

public hasChild ( $relPath )
    public function hasChild($relPath)
    {
        // Use attached repository if possible
        if ($this->getRepository()) {
            return $this->getRepository()->contains($this->getRepositoryPath() . '/' . $relPath);
        }
        return file_exists($this->getFilesystemPath() . '/' . $relPath);
    }

Usage Example

 public function testHasChildDetached()
 {
     $resource = new DirectoryResource($this->fixturesDir . '/dir1');
     $this->assertTrue($resource->hasChild('file1'));
     $this->assertTrue($resource->hasChild('file2'));
     $this->assertTrue($resource->hasChild('.'));
     $this->assertTrue($resource->hasChild('..'));
     $this->assertFalse($resource->hasChild('foobar'));
 }