Puli\Repository\FilesystemRepository::__construct PHP Method

__construct() public method

Creates a new repository.
public __construct ( string $baseDir = '/', boolean $symlink = true, boolean $relative = true, Puli\Repository\Api\ChangeStream\ChangeStream $changeStream = null )
$baseDir string The base directory of the repository on the file system.
$symlink boolean Whether to use symbolic links for added files. If symbolic links are not supported on the current system, the repository will create hard copies instead.
$relative boolean Whether to create relative symbolic links. If relative links are not supported on the current system, the repository will create absolute links instead.
$changeStream Puli\Repository\Api\ChangeStream\ChangeStream If provided, the repository will log resources changes in this change stream.
    public function __construct($baseDir = '/', $symlink = true, $relative = true, ChangeStream $changeStream = null)
    {
        parent::__construct($changeStream);
        Assert::directory($baseDir);
        Assert::boolean($symlink);
        $this->baseDir = rtrim(Path::canonicalize($baseDir), '/');
        $this->baseDirLength = strlen($baseDir);
        $this->symlink = $symlink && self::isSymlinkSupported();
        $this->relative = $this->symlink && $relative;
        $this->filesystem = new Filesystem();
    }