class Environment (View source)

Abstraction methods which return system environment variables.

Properties

protected ApplicationContext $context
protected ActionRequest $request
protected string $temporaryDirectoryBase

The base path of $temporaryDirectory. This property can (and should) be set from outside.

protected string|null $temporaryDirectory

Methods

__construct(ApplicationContext $context)

Initializes the environment instance.

void
setTemporaryDirectoryBase(string $temporaryDirectoryBase)

Sets the base path of the temporary directory

string
getPathToTemporaryDirectory()

Returns the full path to Flow's temporary directory.

int
getMaximumPathLength()

Retrieves the maximum path length that is valid in the current environment.

bool
isRewriteEnabled()

Whether or not URL rewriting is enabled.

static string
composeTemporaryDirectoryName(string $temporaryDirectoryBase, ApplicationContext $context)

Compose path name for the temporary directory respecting supplied context.

string
createTemporaryDirectory(string $temporaryDirectoryBase)

Creates Flow's temporary directory - or at least asserts that it exists and is writable.

getContext()

No description

Details

__construct(ApplicationContext $context)

Initializes the environment instance.

Parameters

ApplicationContext $context

The Flow context

void setTemporaryDirectoryBase(string $temporaryDirectoryBase)

Sets the base path of the temporary directory

Parameters

string $temporaryDirectoryBase

Base path of the temporary directory, with trailing slash

Return Value

void

string getPathToTemporaryDirectory()

Returns the full path to Flow's temporary directory.

Return Value

string

Path to PHP's temporary directory

Exceptions

Exception
FilesException

int getMaximumPathLength()

Retrieves the maximum path length that is valid in the current environment.

Return Value

int

The maximum available path length

bool isRewriteEnabled()

Whether or not URL rewriting is enabled.

Return Value

bool

static string composeTemporaryDirectoryName(string $temporaryDirectoryBase, ApplicationContext $context)

Compose path name for the temporary directory respecting supplied context.

For nested contexts, the folders are prefixed with "SubContext" to avoid ambiguity, and look like: Data/Temporary/Production/SubContextLive

Parameters

string $temporaryDirectoryBase

Full path to the base for the temporary directory

ApplicationContext $context

Return Value

string

The full path to the temporary directory, with trailing slash

Exceptions

FilesException

protected string createTemporaryDirectory(string $temporaryDirectoryBase)

Creates Flow's temporary directory - or at least asserts that it exists and is writable.

For each Flow Application Context, we create an extra temporary folder.

Parameters

string $temporaryDirectoryBase

Full path to the base for the temporary directory

Return Value

string

The full path to the temporary directory

Exceptions

Exception

ApplicationContext getContext()

No description

Return Value

ApplicationContext