Methods |
public
|
__construct(array $array = [])
Create a new HtaccessContainer
Create a new HtaccessContainer
Parameters
$array |
[optional] An array to populate the ArrayObject
|
Overrides
|
#
|
public
|
setIdentation(integer $spaces): $this
Set the indentation level
Set the indentation level
Parameters
$spaces |
[required] The number of spaces to indent lines
|
Throws
|
#
|
public
|
isIgnoreComments(): boolean
|
#
|
public
|
setIgnoreComments(boolean $ignoreComments): $this
|
#
|
public
|
isIgnoreWhiteLines(): boolean
|
#
|
public
|
setIgnoreWhiteLines(boolean $ignoreWhiteLines): $this
|
#
|
public
|
search(string $name, int $type = null, bool $deepSearch = true): null|TokenInterface
Search this object for a Token with a specific name and return the first match
Search this object for a Token with a specific name and return the first match
Parameters
$name |
[required] Name of the token
|
$type |
[optional] TOKEN_DIRECTIVE | TOKEN_BLOCK
|
$deepSearch |
[optional] If the search should be multidimensional. Default is true
|
Returns
Returns the Token or null if none is found
|
#
|
public
|
getIndex(string $name, int $type = null): int|null
Search this object for a Token with specific name and return the index(key) of the first match
Search this object for a Token with specific name and return the index(key) of the first match
Parameters
$name |
[required] Name of the token
|
$type |
[optional] TOKEN_DIRECTIVE | TOKEN_BLOCK
|
Returns
Returns the index or null if Token is not found
|
#
|
public
|
jsonSerialize(): mixed
Get a representation ready to be encoded with json_encoded.
Note: Whitelines and Comments are ignored and will not be…
Get a representation ready to be encoded with json_encoded.
Note: Whitelines and Comments are ignored and will not be included in the serialization
Returns
data which can be serialized by json_encode,
which is a value of any type other than a resource.
Implements
|
#
|
public
|
txtSerialize(int $indentation = null, bool $ignoreWhiteLines = null, bool $ignoreComments = false): string
Returns a representation of the htaccess, ready for inclusion in a file
Returns a representation of the htaccess, ready for inclusion in a file
Parameters
$indentation |
[optional] Defaults to null
|
$ignoreWhiteLines |
[optional] Defaults to null
|
$ignoreComments |
[optional] Defaults to null
|
Implements
|
#
|
public
|
__toString(): string
Get a string representation of this ArrayObject
Get a string representation of this ArrayObject
Implements
|
#
|
public
|
slice(int $offset, int $length = null, bool $preserveKeys = false, bool $asArray = false): array
Returns the sequence of elements as specified by the offset and length parameters.
Returns the sequence of elements as specified by the offset and length parameters.
Parameters
$offset |
[required] If offset is non-negative, the sequence will start at that offset.
If offset is negative, the sequence will start that far from the end of the
array.
|
$length |
[optional] If length is given and is positive, then the sequence will have up to that
many elements in it. If the array is shorter than the length, then only the
available array elements will be present. If length is given and is negative
then the sequence will stop that many elements from the end of the array.
If it is omitted, then the sequence will have everything from offset up until
the end of the array.
|
$preserveKeys |
[optional] Note that arraySlice() will reorder and reset the numeric array indices by
default. You can change this behaviour by setting preserveKeys to TRUE.
|
$asArray |
[optional] By default, slice() returns a new instance of HtaccessContainer object.
If you prefer a basic array instead, set asArray to true
|
Returns
Throws
|
#
|
public
|
insertAt(int $offset, TokenInterface $token): $this
Parameters
$offset |
[required] If offset is positive then the token will be inserted at that offset from the
beginning. If offset is negative then it starts that far from the end of the input
array.
|
$token |
[required] The token to insert
|
Throws
|
#
|
public
|
splice(int $offset, int $length = null, array|ArrayAccess $replacement = []): array
Removes the elements designated by offset and length, and replaces them with the elements of the replacement
array, if…
Removes the elements designated by offset and length, and replaces them with the elements of the replacement
array, if supplied.
Parameters
$offset |
[required] If offset is positive then the start of removed portion is at that offset
from the beginning. If offset is negative then it starts that far from the
end of the input array.
|
$length |
[optional] If length is omitted, removes everything from offset to the end. If length
is specified and is positive, then that many elements will be removed.
If length is specified and is negative then the end of the removed portion
will be that many elements from the end.
Tip: to remove everything from offset to the end of the array when
replacement is also specified, use count($input) for length.
|
$replacement |
[optional] If replacement array is specified, then the removed elements
are replaced with elements from this array.
|
Returns
Returns the array consisting of the extracted elements.
Throws
|
#
|
public
|
offsetSet(int $offset, TokenInterface $value)
Throws
Overrides
Implements
|
#
|