for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the puli/repository package.
*
* (c) Bernhard Schussek <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Puli\Repository\Resource;
use Puli\Repository\Api\Resource\BodyResource;
use Puli\Repository\Api\ResourceNotFoundException;
use Puli\Repository\Resource\Collection\ArrayResourceCollection;
use Webmozart\Assert\Assert;
/**
* Represents a file on the file system.
* @since 1.0
* @author Bernhard Schussek <[email protected]>
class FileResource extends AbstractFilesystemResource implements BodyResource
{
* {@inheritdoc}
public function __construct($filesystemPath, $path = null)
Assert::file($filesystemPath);
parent::__construct($filesystemPath, $path);
}
public function getBody()
return file_get_contents($this->getFilesystemPath());
public function getChild($relPath)
throw ResourceNotFoundException::forPath($this->getPath().'/'.$relPath);
public function hasChild($relPath)
return false;
public function hasChildren()
public function listChildren()
return new ArrayResourceCollection();