eloquent/pathogen API
Class

Eloquent\Pathogen\FileSystem\Factory\PlatformFileSystemPathFactory

class PlatformFileSystemPathFactory extends AbstractFileSystemPathFactory

A path factory that produces file system paths whose type correlates to the platform on which the code is running.

Methods

__construct(PathFactoryInterface $unixFactory = null, PathFactoryInterface $windowsFactory = null, Isolator $isolator = null)

Construct a new file system path factory.

from AbstractFileSystemPathFactory
PathFactoryInterface unixFactory()

Get the path factory used for Unix paths.

from AbstractFileSystemPathFactory
PathFactoryInterface windowsFactory()

Get the path factory used for Windows paths.

from AbstractFileSystemPathFactory
AbsoluteFileSystemPathInterface createWorkingDirectoryPath()

Create a path representing the current working directory.

from AbstractFileSystemPathFactory
AbsoluteFileSystemPathInterface createTemporaryDirectoryPath()

Create a path representing the system temporary directory.

from AbstractFileSystemPathFactory
AbsoluteFileSystemPathInterface createTemporaryPath(string|null $prefix = null)

Create a path representing a suitable for use as the location for a new temporary file or directory.

from AbstractFileSystemPathFactory
static FileSystemPathFactoryInterface instance()

Get a static instance of this path factory.

PathInterface create(string $path)

Creates a new path instance from its string representation.

PathInterface createFromAtoms(mixed<string> $atoms, boolean|null $isAbsolute = null, boolean|null $hasTrailingSeparator = null)

Creates a new path instance from a set of path atoms.

Details

public __construct(PathFactoryInterface $unixFactory = null, PathFactoryInterface $windowsFactory = null, Isolator $isolator = null)

Construct a new file system path factory.

Parameters

PathFactoryInterface $unixFactory The path factory to use for Unix paths.
PathFactoryInterface $windowsFactory The path factory to use for Windows paths.
Isolator $isolator The isolator to use.

public PathFactoryInterface unixFactory()

Get the path factory used for Unix paths.

Return Value

PathFactoryInterface The path factory used for Unix paths.

public PathFactoryInterface windowsFactory()

Get the path factory used for Windows paths.

Return Value

PathFactoryInterface The path factory used for Windows paths.

public AbsoluteFileSystemPathInterface createWorkingDirectoryPath()

Create a path representing the current working directory.

Return Value

AbsoluteFileSystemPathInterface A new path instance representing the current working directory path.

public AbsoluteFileSystemPathInterface createTemporaryDirectoryPath()

Create a path representing the system temporary directory.

Return Value

AbsoluteFileSystemPathInterface A new path instance representing the system default temporary directory path.

public AbsoluteFileSystemPathInterface createTemporaryPath(string|null $prefix = null)

Create a path representing a suitable for use as the location for a new temporary file or directory.

This path is not guaranteed to be unused, but collisions are fairly unlikely.

Parameters

string|null $prefix A string to use as a prefix for the path name.

Return Value

AbsoluteFileSystemPathInterface A new path instance representing the new temporary path.

at line 28
static public FileSystemPathFactoryInterface instance()

Get a static instance of this path factory.

Return Value

FileSystemPathFactoryInterface The static path factory.

at line 44
public PathInterface create(string $path)

Creates a new path instance from its string representation.

Parameters

string $path The string representation of the path.

Return Value

PathInterface The newly created path instance.

at line 60
public PathInterface createFromAtoms(mixed<string> $atoms, boolean|null $isAbsolute = null, boolean|null $hasTrailingSeparator = null)

Creates a new path instance from a set of path atoms.

Parameters

mixed<string> $atoms The path atoms.
boolean|null $isAbsolute True if the path is absolute.
boolean|null $hasTrailingSeparator True if the path has a trailing separator.

Return Value

PathInterface The newly created path instance.

Exceptions

InvalidPathAtomExceptionInterface If any of the supplied atoms are invalid.
InvalidPathStateException If the supplied arguments would produce an invalid path.