Since: 1.2.0

class StackUri extends AbstractStack (View source)

This class is useful for working on stack URIs (dynamic or defined ones).

You can use almost all the operations you can use on a common stack object here as well, but also retrieve such a stack as rokka render URL for later usage in templates or similar.

Examples:

$stackUri = new StackUri('someStackName');
$stackUri->addOverridingOptions('options-dpr-2');
echo $stackUri->getStackUriString();

Properties

string|null $name from  AbstractStack
StackOperation[] $stackOperations from  AbstractStack
array $stackOptions from  AbstractStack

Methods

__construct($name = null, array $stackOperations = [], array $stackOptions = [], $baseUrl = null)

No description

null|string
getName()

Get name of stack for url.

setName(string $name)

No description

getStackOperationsByName(string $name)

Returns all operations matching name.

setStackOperations(array $operations)

No description

addStackOperation(StackOperation $stackOperation)

Adds a StackOperation to the list of existing Stack Operations.

array
getStackOptions()

No description

setStackOptions(array $options)

No description

addStackOption(string $key, mixed $value)

Sets a single Stack option to the list of existing Stack options.

__toString()

No description

UriInterface
getStackUri()

Returns the stack uri in 'dynamic' notation.

string
getStackUriString()

Returns the stack url part as it should be with "addOptionsToUrl" calls in 'dynamic' notation.

array
getConfigAsArray()

Gets stack operations / options as "flat" array.

addOverridingOptions(string $options)

For overwriting stack operation options or adding stack options.

Details

__construct($name = null, array $stackOperations = [], array $stackOptions = [], $baseUrl = null)

No description

Parameters

$name
array $stackOperations
array $stackOptions
$baseUrl

null|string getName()

Get name of stack for url.

Return Value

null|string

AbstractStack setName(string $name)

Since: 1.1.0

No description

Parameters

string $name

Return Value

AbstractStack

StackOperation[] getStackOperations()

No description

Return Value

StackOperation[]

StackOperation[] getStackOperationsByName(string $name)

Since: 1.2.0

Returns all operations matching name.

Parameters

string $name

operation name

Return Value

StackOperation[]

AbstractStack setStackOperations(array $operations)

Since: 1.1.0

No description

Parameters

array $operations

Return Value

AbstractStack

AbstractStack addStackOperation(StackOperation $stackOperation)

Since: 1.1.0

Adds a StackOperation to the list of existing Stack Operations.

Parameters

StackOperation $stackOperation

Return Value

AbstractStack

array getStackOptions()

No description

Return Value

array

AbstractStack setStackOptions(array $options)

Since: 1.1.0

No description

Parameters

array $options

Return Value

AbstractStack

AbstractStack addStackOption(string $key, mixed $value)

Since: 1.1.0

Sets a single Stack option to the list of existing Stack options.

Parameters

string $key
mixed $value

Return Value

AbstractStack

__toString()

No description

UriInterface getStackUri()

Since: 1.2.0

Returns the stack uri in 'dynamic' notation.

Return Value

UriInterface

string getStackUriString()

Since: 1.2.0

Returns the stack url part as it should be with "addOptionsToUrl" calls in 'dynamic' notation.

Return Value

string

array getConfigAsArray()

Since: 1.2.0

Gets stack operations / options as "flat" array.

Useful for generating dynamic stacks for example

Return Value

array

StackUri addOverridingOptions(string $options)

Since: 1.2.0

For overwriting stack operation options or adding stack options.

The format of the $options parameter is the same as you would use for overwriting ooptions via a render URL.

Example: 'resize-width-200--options-dpr-2-autoformat-true'

Using '/' instead of '--' is also valid, but if the object doesn't have operations defined already, the behaviour is different Examples:

'resize-width-200--crop-width-200-height-200' <- resizes and crops and image 'resize-width-200/crop-width-200-height-200' <- only resized the image, since the crop is an overwrite and the operation doesnt exist

But if there's already stack operations for resize and crop defined in the object, both above examples do the same.

Parameters

string $options

The same format as overwriting stack operations options via url

Return Value

StackUri

See also

https://rokka.io/documentation/references/render.html#overwriting-stack-operation-options