From 09d3940a1f760c4771d2a9daaef00fb3c6f7d3b2 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Thu, 11 Jul 2024 13:08:56 +0200 Subject: [PATCH] Update documentation --- .phpdoc/guide/changelog.rst | 2 +- .phpdoc/guide/overview/datastructures.rst | 10 +- .phpdoc/guide/overview/index.rst | 4 +- .phpdoc/guide/overview/traits.rst | 8 +- .phpdoc/guide/usage/installation.rst | 10 +- .phpdoc/guide/usage/requirements.rst | 4 +- README.md | 4 +- ...s-Exceptions-InvalidDataTypeException.html | 4 +- ...OCC-Basics-DataStructures-StrictArray.html | 284 +++++++++++++----- ...asics-DataStructures-StrictCollection.html | 153 +++++++--- .../OCC-Basics-DataStructures-StrictList.html | 104 +++++-- ...OCC-Basics-DataStructures-StrictQueue.html | 118 +++++--- ...OCC-Basics-DataStructures-StrictStack.html | 118 +++++--- ...Traits-StrictSplDoublyLinkedListTrait.html | 103 +++++-- ...ics-ErrorHandlers-ThrowErrorException.html | 11 +- ...s-ErrorHandlers-TriggerExceptionError.html | 11 +- ...CC-Basics-Interfaces-ArrayAccessTrait.html | 33 +- .../OCC-Basics-Interfaces-CountableTrait.html | 12 +- ...ics-Interfaces-IteratorAggregateTrait.html | 12 +- .../OCC-Basics-Interfaces-IteratorTrait.html | 47 ++- doc/classes/OCC-Basics-Traits-Getter.html | 19 +- .../OCC-Basics-Traits-OverloadingGetter.html | 19 +- .../OCC-Basics-Traits-OverloadingSetter.html | 19 +- doc/classes/OCC-Basics-Traits-Setter.html | 19 +- doc/classes/OCC-Basics-Traits-Singleton.html | 26 +- .../OCC-Basics-Traits-TypeChecker.html | 33 +- doc/css/base.css | 7 +- doc/css/template.css | 4 + ...s-exceptions-invaliddatatypeexception.html | 3 + doc/files/src-datastructures-strictarray.html | 3 + .../src-datastructures-strictcollection.html | 3 + doc/files/src-datastructures-strictlist.html | 3 + doc/files/src-datastructures-strictqueue.html | 3 + doc/files/src-datastructures-strictstack.html | 3 + ...traits-strictspldoublylinkedlisttrait.html | 3 + ...src-errorhandlers-throwerrorexception.html | 3 + ...c-errorhandlers-triggerexceptionerror.html | 3 + .../src-interfaces-arrayaccesstrait.html | 3 + doc/files/src-interfaces-countabletrait.html | 3 + ...src-interfaces-iteratoraggregatetrait.html | 3 + doc/files/src-interfaces-iteratortrait.html | 3 + doc/files/src-traits-getter.html | 3 + doc/files/src-traits-overloadinggetter.html | 3 + doc/files/src-traits-overloadingsetter.html | 3 + doc/files/src-traits-setter.html | 3 + doc/files/src-traits-singleton.html | 3 + doc/files/src-traits-typechecker.html | 3 + .../src/DataStructures/StrictArray.php.txt | 4 +- doc/guides/changelog.html | 121 ++++++-- doc/guides/index.html | 94 ++++-- doc/guides/overview/datastructures.html | 174 ++++++++--- doc/guides/overview/errorhandlers.html | 52 +++- doc/guides/overview/index.html | 152 +++++++--- doc/guides/overview/interfaces.html | 117 ++++++-- doc/guides/overview/traits.html | 229 +++++++++++--- doc/guides/usage/index.html | 58 +++- doc/guides/usage/installation.html | 75 +++-- doc/guides/usage/requirements.html | 25 +- src/ErrorHandlers/ThrowErrorException.php | 2 + src/ErrorHandlers/TriggerExceptionError.php | 2 + 60 files changed, 1767 insertions(+), 593 deletions(-) diff --git a/.phpdoc/guide/changelog.rst b/.phpdoc/guide/changelog.rst index b1abda1..3dd0437 100644 --- a/.phpdoc/guide/changelog.rst +++ b/.phpdoc/guide/changelog.rst @@ -54,7 +54,7 @@ v2.0.0 * Added new trait :php:trait:`OCC\Basics\Traits\OverloadingGetter` * Added new trait :php:trait:`OCC\Basics\Traits\OverloadingSetter` * Added new trait :php:trait:`OCC\Basics\Traits\TypeChecker` -* Extended API for all datastructures (see :php:trait:`OCC\Basics\DataStructures\Traits\StrictSplDatastructureTrait`) +* Extended API for all datastructures (see :php:trait:`OCC\Basics\DataStructures\Traits\StrictSplDoublyLinkedListTrait`) * Introduced :php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException` for strict datastructures * Extended `documentation `_ diff --git a/.phpdoc/guide/overview/datastructures.rst b/.phpdoc/guide/overview/datastructures.rst index f79683f..111ef2b 100644 --- a/.phpdoc/guide/overview/datastructures.rst +++ b/.phpdoc/guide/overview/datastructures.rst @@ -10,13 +10,13 @@ The datastructures in this package are derived from their respective `Standard P `_ which they extend by the option to control the data types of items those datastructures can hold. -To restrict allowed data types for items, provide the constructor with an array of atomic types or fully qualified -class names you want to allow as item types. Available atomic types are `array`, `bool`, `callable`, `countable`, -`float` / `double`, `int` / `integer` / `long`, `iterable`, `null`, `numeric`, `object`, `resource`, `scalar` and -`string`. +To restrict allowed data types for items provide the constructor with an array of atomic types or fully qualified class +names (FQCN) you want to allow as item types. Available atomic types are `array`, `bool`, `callable`, `countable`, +`float` (or `double`), `int` (or `integer` or `long`), `iterable`, `null`, `numeric`, `object`, `resource`, `scalar` +and `string`. Trying to add an item with a data type not on the list of allowed types to a strict datastructure will result in an -:php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException`. +:php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException` being thrown. All strict datastructures inherit the implementation of the `\ArrayAccess `_, `\Countable `_ and `\Serializable `_ interfaces. All diff --git a/.phpdoc/guide/overview/index.rst b/.phpdoc/guide/overview/index.rst index 8dc9e06..940f394 100644 --- a/.phpdoc/guide/overview/index.rst +++ b/.phpdoc/guide/overview/index.rst @@ -6,8 +6,8 @@ Overview The package currently contains classes for :doc:`datastructures`, :doc:`errorhandlers`, multiple :doc:`interfaces`, and more generic :doc:`traits` for common use cases. They share the same design principles like property and method naming schema, the highest coding standards of `PHPStan `_ and `Psalm `_, and full -`PSR-12 `_ compliance to make sure they can be combined and easily re-used in -other projects. +`PSR-12 `_ compliance to make sure they can be combined and easily used in other +projects. .. toctree:: :maxdepth: 2 diff --git a/.phpdoc/guide/overview/traits.rst b/.phpdoc/guide/overview/traits.rst index 1ed6924..4c10bf2 100644 --- a/.phpdoc/guide/overview/traits.rst +++ b/.phpdoc/guide/overview/traits.rst @@ -23,7 +23,7 @@ reading. Replace `{Property}` in the method's name with the name of the actual p letter). Trying to access an undefined property or a property without corresponding "magic" getter method will result in an -`\InvalidArgumentException `_. +`\InvalidArgumentException `_ being thrown. Example: If the property is named `$fooBar`, the "magic" method has to be `_magicGetFooBar()`. This method is then called when `$fooBar` is read in a context where it normally would not be accessible. @@ -41,7 +41,7 @@ writing. Replace `{Property}` in the method's name with the name of the actual p letter). Trying to access an undefined property or a property without corresponding "magic" setter method will result in an -`\InvalidArgumentException `_. +`\InvalidArgumentException `_ being thrown. Example: If the property is named `$fooBar`, the "magic" method has to be `_magicSetFooBar()`. This method is then called when `$fooBar` is written to in a context where it normally would not be accessible. @@ -109,5 +109,5 @@ TypeChecker This allows to set a list of allowed atomic data types and fully qualified class names. It also provides a method to check if a value's data type matches at least one of these types. -Available atomic types are `array`, `bool`, `callable`, `countable`, `float` / `double`, `int` / `integer` / `long`, -`iterable`, `null`, `numeric`, `object`, `resource`, `scalar` and `string`. +Available atomic types are `array`, `bool`, `callable`, `countable`, `float` (or `double`), `int` (or `integer` or +`long`), `iterable`, `null`, `numeric`, `object`, `resource`, `scalar` and `string`. diff --git a/.phpdoc/guide/usage/installation.rst b/.phpdoc/guide/usage/installation.rst index 9ccec9a..47dba9b 100644 --- a/.phpdoc/guide/usage/installation.rst +++ b/.phpdoc/guide/usage/installation.rst @@ -9,7 +9,7 @@ Installation Composer ======== -The intended and recommended way of re-using this package is via `Composer `_. The following +The intended and recommended way of using this package is via `Composer `_. The following command will get you the latest version and make it a dependency of your project. It will also register all classes and traits with the autoloader to make them available inside the application. @@ -23,8 +23,8 @@ the desired version constraint: .. code-block:: shell - # This will install the latest patch level version of 2.0 (i. e. >=2.0.0 && <2.1.0) - composer require "opencultureconsulting/basics:~2.0" + # This will install the latest patch level version of 2.1 (i. e. >=2.1.0 && <2.2.0) + composer require "opencultureconsulting/basics:~2.1" All available versions as well as further information about :doc:`requirements` and dependencies can be found on `Packagist `_. @@ -46,8 +46,8 @@ well: .. code-block:: shell - # This will clone the repository state at version "2.0.0" into the "basics" directory - git clone --branch=v2.0.0 https://github.com/opencultureconsulting/php-basics.git basics + # This will clone the repository state at version "2.1.0" into the "basics" directory + git clone --branch=v2.1.0 https://github.com/opencultureconsulting/php-basics.git basics Be aware that you also need to make the classes and traits available in your application by either adding them to your autoloader or by including all files individually in PHP. diff --git a/.phpdoc/guide/usage/requirements.rst b/.phpdoc/guide/usage/requirements.rst index a46e1a2..9a746aa 100644 --- a/.phpdoc/guide/usage/requirements.rst +++ b/.phpdoc/guide/usage/requirements.rst @@ -9,8 +9,8 @@ Environment This package requires at least **PHP 8.1**. It is highly recommended to use `Composer `_ for dependency management and autoloading, -although it is technically not strictly required for re-using any of these classes and traits. But it certainly -makes it a lot easier! +although it is technically not strictly required for using any of these classes and traits. But it certainly makes it a +lot easier! Dependencies ============ diff --git a/README.md b/README.md index d4fc450..18017b0 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ***A collection of generic classes and useful traits for PHP projects.*** -The package currently contains classes for [type-sensitive data structures](src/DataStructures/), [error and exception handlers](src/ErrorHandlers/), multiple [traits implementing standard interfaces](src/Interfaces/), and more generic [traits for common use cases](src/Traits/). They share the same design principles like property and method naming schema, highest coding standards of [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/), and full [PSR-12](https://www.php-fig.org/psr/psr-12/) compliance to make sure they can be combined and easily re-used in other projects. +The package currently contains classes for [type-sensitive data structures](src/DataStructures/), [error and exception handlers](src/ErrorHandlers/), multiple [traits implementing standard interfaces](src/Interfaces/), and more generic [traits for common use cases](src/Traits/). They share the same design principles like property and method naming schema, highest coding standards of [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/), and full [PSR-12](https://www.php-fig.org/psr/psr-12/) compliance to make sure they can be combined and easily used in other projects. ## Quick Start -The intended and recommended way of re-using this package is via [Composer](https://getcomposer.org/). The following command will get you the latest version: +The intended and recommended way of using this package is via [Composer](https://getcomposer.org/). The following command will get you the latest version: composer require opencultureconsulting/basics diff --git a/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html b/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html index f38cfb6..656dd19 100644 --- a/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html +++ b/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html @@ -209,6 +209,7 @@

Common exception for type-sensitive datastructures.

+

Exception thrown if a value does not adhere to the defined list of valid data types.

@@ -233,6 +234,8 @@ data types.

+ +

Table of Contents @@ -251,7 +254,6 @@ data types.

- diff --git a/doc/classes/OCC-Basics-DataStructures-StrictArray.html b/doc/classes/OCC-Basics-DataStructures-StrictArray.html index 3f3cb9a..6ce75e4 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictArray.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictArray.html @@ -195,7 +195,7 @@ Iterator - Uses + uses IteratorTrait

@@ -214,6 +214,7 @@

A type-sensitive, traversable array.

+

Holds items as key/value pairs where keys have to be valid array keys while values can be of any type. To restrict allowed data types for items, provide the constructor with an array of atomic types or fully qualified class @@ -250,6 +251,8 @@ names.

+ +

Table of Contents @@ -279,231 +282,231 @@ names.

- __construct() + __construct()  : void
Create a type-sensitive collection of items.
- add() + add()  : void
Add/insert a item at the specified index.
- bottom() + bottom()  : AllowedType
Peek at the first item of the array.
- clear() + clear()  : void
Clear the collection of any items.
- count() + count()  : int<0, max>
Count the data items.
- current() + current()  : TValue|null
Return the current item.
- get() + get()  : AllowedType
Get the item at the specified index.
- getAllowedTypes() + getAllowedTypes()  : array<string|int, string>
Get allowed data types.
- hasAllowedType() + hasAllowedType()  : bool
Check if a value's data type is allowed.
- isAllowedType() + isAllowedType()  : bool
Check if a data type is allowed.
- isEmpty() + isEmpty()  : bool
Check if collection is empty.
- isList() + isList()  : bool
Check if this collection can be considered a list.
- key() + key()  : string|int|null
Return the current key.
- next() + next()  : void
Move forward to next item.
- offsetExists() + offsetExists()  : bool
Check if the specified offset exists.
- offsetGet() + offsetGet()  : TValue|null
Retrieve data at the specified offset.
- offsetSet() + offsetSet()  : void
-
Assign a value to the specified offset.
+
Set the item at the specified offset.
- offsetUnset() + offsetUnset()  : void
Unset the specified offset.
- pop() + pop()  : AllowedType
Pop the item from the end of the array.
- prev() + prev()  : void
Move back to previous item.
- push() + push()  : void
Push an item at the end of the array.
- remove() + remove()  : void
Remove an item from the collection.
- rewind() + rewind()  : void
Rewind the iterator to the first item.
- serialize() + serialize()  : string
Get string representation of $this.
- set() + set()  : void
Set an item at the specified index.
- setAllowedTypes() + setAllowedTypes()  : void
Set allowed data types.
- shift() + shift()  : AllowedType
Shift the item from the beginning of the array.
- toArray() + toArray()  : array<string|int, AllowedType>
Return array representation of collection.
- top() + top()  : AllowedType
Peek at the last item of the array.
- toStrictList() + toStrictList()  : StrictList<string|int, AllowedType>
Turn collection into a type-sensitive list.
- unserialize() + unserialize()  : void
Restore $this from string representation.
- unshift() + unshift()  : void
Prepend the array with an item.
- valid() + valid()  : bool
@@ -513,7 +516,6 @@ names.

- @@ -552,6 +554,7 @@ names.

+
Parameters
@@ -602,6 +605,8 @@ Possible values are:

+ +
Parameters
@@ -675,6 +681,8 @@ Possible values are:

+ +
Tags @@ -726,6 +735,8 @@ Possible values are:

+ +
Return values
AllowedType @@ -768,6 +779,9 @@ Possible values are:

+ + + @@ -803,6 +817,9 @@ Possible values are:

+ + +
Return values
@@ -846,6 +863,9 @@ Possible values are:

+ + +
Return values
@@ -887,6 +907,7 @@ Possible values are:

+
Parameters
@@ -919,6 +940,8 @@ Possible values are:

+ +
Return values
AllowedType @@ -961,6 +984,9 @@ Possible values are:

+ + +
Return values
@@ -1002,6 +1028,7 @@ Possible values are:

+
Parameters
@@ -1017,6 +1044,8 @@ Possible values are:

+ +
Return values
bool @@ -1057,6 +1086,7 @@ Possible values are:

+
Parameters
@@ -1072,6 +1102,8 @@ Possible values are:

+ +
Return values
bool @@ -1114,6 +1146,9 @@ Possible values are:

+ + +
Return values
@@ -1154,6 +1189,7 @@ Possible values are:

APIYes
+

It is considered a list if all keys are consecutive integers starting from 0.

@@ -1176,6 +1212,8 @@ from 0.

+ +
Return values
bool @@ -1218,6 +1256,9 @@ from 0.

+ + +
Return values
@@ -1261,6 +1302,9 @@ from 0.

+ + + @@ -1294,6 +1338,7 @@ from 0.

+
Parameters
@@ -1309,6 +1354,8 @@ from 0.

+ +
Return values
bool @@ -1349,6 +1396,7 @@ from 0.

+
Parameters
@@ -1364,6 +1412,8 @@ from 0.

+ +
Return values
TValue|null @@ -1382,28 +1432,29 @@ from 0.

>

offsetSet() - +

-

Assign a value to the specified offset.

+

Set the item at the specified offset.

public - offsetSet(string|int|null $offset, TValue $value) : void + offsetSet(string|int|null $offset, AllowedType $value) : void
APIYes
+
Parameters
@@ -1411,22 +1462,51 @@ from 0.

: string|int|null
-

The offset to assign to or NULL to append

+

The offset being set

$value - : TValue + : AllowedType
-

The value to set

+

The new item for the offset

+
+ Tags + + +
+
+
+ throws +
+
+ InvalidDataTypeException + +

if $value is not of allowed type

+
+ +
+
+ throws +
+
+ InvalidArgumentException + +

if $offset is not a valid array key

+
+ +
+
+ + @@ -1460,6 +1540,7 @@ from 0.

+
Parameters
@@ -1476,6 +1557,8 @@ from 0.

+ +
0.

+
Tags @@ -1527,6 +1611,8 @@ from 0.

+ +
Return values
AllowedType @@ -1569,6 +1655,9 @@ from 0.

+ + + @@ -1602,6 +1691,7 @@ from 0.

+
Parameters
@@ -1635,6 +1725,8 @@ from 0.

+ +
0.

+
Parameters
@@ -1699,6 +1792,8 @@ from 0.

+ +
0.

+ + +
@@ -1765,6 +1863,9 @@ from 0.

+ + +
Return values
@@ -1806,6 +1907,7 @@ from 0.

+
Parameters
@@ -1848,6 +1950,8 @@ from 0.

+ +
0.

+
Parameters
@@ -1912,6 +2017,8 @@ from 0.

+ +
0.

+
Tags @@ -1963,6 +2071,8 @@ from 0.

+ +
Return values
AllowedType @@ -2005,6 +2115,9 @@ from 0.

+ + +
Return values
@@ -2048,6 +2161,7 @@ from 0.

+
Tags @@ -2066,6 +2180,8 @@ from 0.

+ +
Return values
AllowedType @@ -2108,6 +2224,7 @@ from 0.

+
Tags @@ -2134,6 +2251,8 @@ from 0.

+ +
Return values
StrictList<string|int, AllowedType> @@ -2172,6 +2291,7 @@ from 0.

+
Parameters
@@ -2188,6 +2308,8 @@ from 0.

+ +
0.

+
Parameters
@@ -2252,6 +2375,8 @@ from 0.

+ +
0.

+ + +
Return values
@@ -2409,39 +2537,39 @@ from 0.

  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictCollection.html b/doc/classes/OCC-Basics-DataStructures-StrictCollection.html index e724b8b..b88b726 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictCollection.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictCollection.html @@ -192,7 +192,7 @@ ArrayAccess, Countable, Serializable - Uses + uses ArrayAccessTrait, CountableTrait, TypeChecker @@ -211,6 +211,7 @@

    A type-sensitive, unsorted collection.

    +

    Holds items as key/value pairs where keys have to be valid array keys while values can be of any type. To restrict allowed data types for items, provide the constructor with an array of atomic types or fully qualified class @@ -247,6 +248,8 @@ names.

    + +

    Table of Contents @@ -276,147 +279,147 @@ names.

    - __construct() + __construct()  : void
    Create a type-sensitive collection of items.
    - add() + add()  : void
    Add/insert a item at the specified index.
    - clear() + clear()  : void
    Clear the collection of any items.
    - count() + count()  : int<0, max>
    Count the data items.
    - get() + get()  : AllowedType
    Get the item at the specified index.
    - getAllowedTypes() + getAllowedTypes()  : array<string|int, string>
    Get allowed data types.
    - hasAllowedType() + hasAllowedType()  : bool
    Check if a value's data type is allowed.
    - isAllowedType() + isAllowedType()  : bool
    Check if a data type is allowed.
    - isEmpty() + isEmpty()  : bool
    Check if collection is empty.
    - isList() + isList()  : bool
    Check if this collection can be considered a list.
    - offsetExists() + offsetExists()  : bool
    Check if the specified offset exists.
    - offsetGet() + offsetGet()  : TValue|null
    Retrieve data at the specified offset.
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - offsetUnset() + offsetUnset()  : void
    Unset the specified offset.
    - remove() + remove()  : void
    Remove an item from the collection.
    - serialize() + serialize()  : string
    Get string representation of $this.
    - set() + set()  : void
    Set an item at the specified index.
    - setAllowedTypes() + setAllowedTypes()  : void
    Set allowed data types.
    - toArray() + toArray()  : array<string|int, AllowedType>
    Return array representation of collection.
    - toStrictList() + toStrictList()  : StrictList<string|int, AllowedType>
    Turn collection into a type-sensitive list.
    - unserialize() + unserialize()  : void
    @@ -426,7 +429,6 @@ names.

    - @@ -465,6 +467,7 @@ names.

    +
    Parameters
    @@ -515,6 +518,8 @@ Possible values are:

    + +
    Parameters
    @@ -588,6 +594,8 @@ Possible values are:

    + +
    Return values @@ -697,6 +711,7 @@ Possible values are:

    +
    Parameters
    @@ -729,6 +744,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -771,6 +788,9 @@ Possible values are:

    + + +
    Return values
    @@ -812,6 +832,7 @@ Possible values are:

    +
    Parameters
    @@ -827,6 +848,8 @@ Possible values are:

    + +
    Return values
    bool @@ -867,6 +890,7 @@ Possible values are:

    +
    Parameters
    @@ -882,6 +906,8 @@ Possible values are:

    + +
    Return values
    bool @@ -924,6 +950,9 @@ Possible values are:

    + + +
    Return values
    @@ -964,6 +993,7 @@ Possible values are:

    APIYes
    +

    It is considered a list if all keys are consecutive integers starting from 0.

    @@ -986,6 +1016,8 @@ from 0.

    + +
    Return values
    bool @@ -1026,6 +1058,7 @@ from 0.

    +
    Parameters
    @@ -1041,6 +1074,8 @@ from 0.

    + +
    Return values
    bool @@ -1081,6 +1116,7 @@ from 0.

    +
    Parameters
    @@ -1096,6 +1132,8 @@ from 0.

    + +
    Return values
    TValue|null @@ -1136,6 +1174,7 @@ from 0.

    +
    Parameters
    @@ -1188,6 +1227,8 @@ from 0.

    + +
    0.

    +
    Parameters
    @@ -1235,6 +1277,8 @@ from 0.

    + +
    0.

    +
    Parameters
    @@ -1299,6 +1344,8 @@ from 0.

    + +
    0.

    + + +
    Return values
    @@ -1371,6 +1421,7 @@ from 0.

    +
    Parameters
    @@ -1413,6 +1464,8 @@ from 0.

    + +
    0.

    +
    Parameters
    @@ -1477,6 +1531,8 @@ from 0.

    + +
    0.

    + + +
    Return values
    @@ -1553,6 +1612,7 @@ from 0.

    +
    Tags @@ -1579,6 +1639,8 @@ from 0.

    + +
    Return values
    StrictList<string|int, AllowedType> @@ -1617,6 +1679,7 @@ from 0.

    +
    Parameters
    @@ -1633,6 +1696,8 @@ from 0.

    + +
    @@ -1747,27 +1812,27 @@ from 0.

  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictList.html b/doc/classes/OCC-Basics-DataStructures-StrictList.html index 0442e8f..76bb734 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictList.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictList.html @@ -192,7 +192,7 @@ - Uses + uses StrictSplDoublyLinkedListTrait @@ -211,6 +211,7 @@

    A type-sensitive, taversable list.

    +

    Extends \SplDoublyLinkedList with an option to restrict the allowed data types for list items by providing the constructor with an array of atomic types or fully qualified class names.

    @@ -245,6 +246,8 @@ constructor with an array of atomic types or fully qualified class names.

    + +

    Table of Contents @@ -267,98 +270,98 @@ constructor with an array of atomic types or fully qualified class names.

    - __construct() + __construct()  : void
    Create a type-sensitive, traversable list of items.
    - add() + add()  : void
    Add/insert a new item at the specified offset.
    - append() + append()  : void
    Append items at the end of the list.
    - clear() + clear()  : void
    Clear the list of any items.
    - get() + get()  : AllowedType
    Get the item at the specified index.
    - isList() + isList()  : true
    Check if this can be considered a list.
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - prepend() + prepend()  : void
    Prepend items at the start of the list.
    - push() + push()  : void
    Push an item at the end of the list.
    - remove() + remove()  : void
    Remove an item from the list.
    - set() + set()  : void
    Set an item at the specified index.
    - toArray() + toArray()  : array<int, AllowedType>
    Return array representation of list.
    - toStrictCollection() + toStrictCollection()  : StrictCollection<string|int, AllowedType>
    Turn list into a type-sensitive collection.
    - unshift() + unshift()  : void
    @@ -368,7 +371,6 @@ constructor with an array of atomic types or fully qualified class names.

    - @@ -407,6 +409,7 @@ constructor with an array of atomic types or fully qualified class names.

    +
    Parameters
    @@ -457,6 +460,8 @@ Possible values are:

    + +
    Parameters
    @@ -540,6 +546,8 @@ Possible values are:

    + +
    Parameters
    @@ -604,6 +613,8 @@ Possible values are:

    + +
    Parameters
    @@ -702,6 +717,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -744,6 +761,9 @@ Possible values are:

    + + +
    Return values
    @@ -785,6 +805,7 @@ Possible values are:

    +
    Parameters
    @@ -837,6 +858,8 @@ Possible values are:

    + +
    Parameters
    @@ -901,6 +925,8 @@ Possible values are:

    + +
    Parameters
    @@ -965,6 +992,8 @@ Possible values are:

    + +
    Parameters
    @@ -1029,6 +1059,8 @@ Possible values are:

    + +
    Parameters
    @@ -1102,6 +1135,8 @@ Possible values are:

    + +
    Return values @@ -1178,6 +1216,9 @@ Possible values are:

    + + +
    Return values
    @@ -1219,6 +1260,7 @@ Possible values are:

    +
    Parameters
    @@ -1252,6 +1294,8 @@ Possible values are:

    + +
    @@ -1366,20 +1410,20 @@ Possible values are:

  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictQueue.html b/doc/classes/OCC-Basics-DataStructures-StrictQueue.html index cc20c8c..ad4a58a 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictQueue.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictQueue.html @@ -192,7 +192,7 @@ - Uses + uses StrictSplDoublyLinkedListTrait @@ -211,6 +211,7 @@

    A type-sensitive, taversable queue (FIFO).

    +

    Extends \SplQueue with an option to restrict the allowed data types for list items by providing the constructor with an array of atomic types or fully qualified class names.

    @@ -245,6 +246,8 @@ array of atomic types or fully qualified class names.

    + +

    Table of Contents @@ -267,112 +270,112 @@ array of atomic types or fully qualified class names.

    - __construct() + __construct()  : void
    Create a type-sensitive, traversable list of items.
    - add() + add()  : void
    Add/insert a new item at the specified offset.
    - append() + append()  : void
    Append items at the end of the list.
    - clear() + clear()  : void
    Clear the list of any items.
    - dequeue() + dequeue()  : AllowedType
    Dequeue an item from the queue.
    - enqueue() + enqueue()  : void
    Add an item to the queue.
    - get() + get()  : AllowedType
    Get the item at the specified index.
    - isList() + isList()  : true
    Check if this can be considered a list.
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - prepend() + prepend()  : void
    Prepend items at the start of the list.
    - push() + push()  : void
    Push an item at the end of the list.
    - remove() + remove()  : void
    Remove an item from the list.
    - set() + set()  : void
    Set an item at the specified index.
    - toArray() + toArray()  : array<int, AllowedType>
    Return array representation of list.
    - toStrictCollection() + toStrictCollection()  : StrictCollection<string|int, AllowedType>
    Turn list into a type-sensitive collection.
    - unshift() + unshift()  : void
    @@ -382,7 +385,6 @@ array of atomic types or fully qualified class names.

    - @@ -421,6 +423,7 @@ array of atomic types or fully qualified class names.

    +
    Parameters
    @@ -471,6 +474,8 @@ Possible values are:

    + +
    Parameters
    @@ -554,6 +560,8 @@ Possible values are:

    + +
    Parameters
    @@ -618,6 +627,8 @@ Possible values are:

    + +
    Tags @@ -704,6 +719,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -744,6 +761,7 @@ Possible values are:

    +
    Parameters
    @@ -777,6 +795,8 @@ Possible values are:

    + +
    Parameters
    @@ -840,6 +861,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -882,6 +905,9 @@ Possible values are:

    + + +
    Return values
    @@ -923,6 +949,7 @@ Possible values are:

    +
    Parameters
    @@ -975,6 +1002,8 @@ Possible values are:

    + +
    Parameters
    @@ -1039,6 +1069,8 @@ Possible values are:

    + +
    Parameters
    @@ -1103,6 +1136,8 @@ Possible values are:

    + +
    Parameters
    @@ -1167,6 +1203,8 @@ Possible values are:

    + +
    Parameters
    @@ -1240,6 +1279,8 @@ Possible values are:

    + +
    Return values @@ -1316,6 +1360,9 @@ Possible values are:

    + + +
    Return values
    @@ -1357,6 +1404,7 @@ Possible values are:

    +
    Parameters
    @@ -1390,6 +1438,8 @@ Possible values are:

    + +
    @@ -1504,22 +1554,22 @@ Possible values are:

  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictStack.html b/doc/classes/OCC-Basics-DataStructures-StrictStack.html index 98a8e5f..41a2cc1 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictStack.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictStack.html @@ -192,7 +192,7 @@ - Uses + uses StrictSplDoublyLinkedListTrait @@ -211,6 +211,7 @@

    A type-sensitive, taversable stack (LIFO).

    +

    Extends \SplStack with an option to restrict the allowed data types for list items by providing the constructor with an array of atomic types or fully qualified class names.

    @@ -245,6 +246,8 @@ array of atomic types or fully qualified class names.

    + +

    Table of Contents @@ -267,112 +270,112 @@ array of atomic types or fully qualified class names.

    - __construct() + __construct()  : void
    Create a type-sensitive, traversable list of items.
    - add() + add()  : void
    Add/insert a new item at the specified offset.
    - append() + append()  : void
    Append items at the end of the list.
    - clear() + clear()  : void
    Clear the list of any items.
    - get() + get()  : AllowedType
    Get the item at the specified index.
    - isList() + isList()  : true
    Check if this can be considered a list.
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - prepend() + prepend()  : void
    Prepend items at the start of the list.
    - push() + push()  : void
    Push an item at the end of the list.
    - remove() + remove()  : void
    Remove an item from the list.
    - set() + set()  : void
    Set an item at the specified index.
    - stack() + stack()  : void
    Add an item to the stack.
    - toArray() + toArray()  : array<int, AllowedType>
    Return array representation of list.
    - toStrictCollection() + toStrictCollection()  : StrictCollection<string|int, AllowedType>
    Turn list into a type-sensitive collection.
    - unshift() + unshift()  : void
    Prepend the list with an item.
    - unstack() + unstack()  : AllowedType
    @@ -382,7 +385,6 @@ array of atomic types or fully qualified class names.

    - @@ -421,6 +423,7 @@ array of atomic types or fully qualified class names.

    +
    Parameters
    @@ -471,6 +474,8 @@ Possible values are:

    + +
    Parameters
    @@ -554,6 +560,8 @@ Possible values are:

    + +
    Parameters
    @@ -618,6 +627,8 @@ Possible values are:

    + +
    Parameters
    @@ -716,6 +731,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -758,6 +775,9 @@ Possible values are:

    + + +
    Return values
    @@ -799,6 +819,7 @@ Possible values are:

    +
    Parameters
    @@ -851,6 +872,8 @@ Possible values are:

    + +
    Parameters
    @@ -915,6 +939,8 @@ Possible values are:

    + +
    Parameters
    @@ -979,6 +1006,8 @@ Possible values are:

    + +
    Parameters
    @@ -1043,6 +1073,8 @@ Possible values are:

    + +
    Parameters
    @@ -1116,6 +1149,8 @@ Possible values are:

    + +
    Parameters
    @@ -1180,6 +1216,8 @@ Possible values are:

    + +
    Return values @@ -1256,6 +1297,9 @@ Possible values are:

    + + +
    Return values
    @@ -1297,6 +1341,7 @@ Possible values are:

    +
    Parameters
    @@ -1330,6 +1375,8 @@ Possible values are:

    + +
    Tags @@ -1381,6 +1429,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -1504,22 +1554,22 @@ Possible values are:

  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDoublyLinkedListTrait.html b/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDoublyLinkedListTrait.html index 5a100fc..b9afa85 100644 --- a/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDoublyLinkedListTrait.html +++ b/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDoublyLinkedListTrait.html @@ -190,6 +190,7 @@

    The common interface of all type-sensitive, SPL-based datastructures.

    +

    This extends all methods of the common interface of the Standard PHP Library Doubly Linked List Datastructures by type-checking to only allow specified data types on the list.

    @@ -229,7 +230,9 @@ by type-checking to only allow specified data types on the list.

    - + + + @@ -255,98 +258,98 @@ by type-checking to only allow specified data types on the list.

    - __construct() + __construct()  : void
    Create a type-sensitive, traversable list of items.
    - add() + add()  : void
    Add/insert a new item at the specified offset.
    - append() + append()  : void
    Append items at the end of the list.
    - clear() + clear()  : void
    Clear the list of any items.
    - get() + get()  : AllowedType
    Get the item at the specified index.
    - isList() + isList()  : true
    Check if this can be considered a list.
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - prepend() + prepend()  : void
    Prepend items at the start of the list.
    - push() + push()  : void
    Push an item at the end of the list.
    - remove() + remove()  : void
    Remove an item from the list.
    - set() + set()  : void
    Set an item at the specified index.
    - toArray() + toArray()  : array<int, AllowedType>
    Return array representation of list.
    - toStrictCollection() + toStrictCollection()  : StrictCollection<string|int, AllowedType>
    Turn list into a type-sensitive collection.
    - unshift() + unshift()  : void
    @@ -395,6 +398,7 @@ by type-checking to only allow specified data types on the list.

    +
    Parameters
    @@ -445,6 +449,8 @@ Possible values are:

    + +
    Parameters
    @@ -528,6 +535,8 @@ Possible values are:

    + +
    Parameters
    @@ -592,6 +602,8 @@ Possible values are:

    + +
    Parameters
    @@ -690,6 +706,8 @@ Possible values are:

    + +
    Return values
    AllowedType @@ -732,6 +750,9 @@ Possible values are:

    + + +
    Return values
    @@ -773,6 +794,7 @@ Possible values are:

    +
    Parameters
    @@ -825,6 +847,8 @@ Possible values are:

    + +
    Parameters
    @@ -889,6 +914,8 @@ Possible values are:

    + +
    Parameters
    @@ -953,6 +981,8 @@ Possible values are:

    + +
    Parameters
    @@ -1017,6 +1048,8 @@ Possible values are:

    + +
    Parameters
    @@ -1090,6 +1124,8 @@ Possible values are:

    + +
    Return values @@ -1166,6 +1205,9 @@ Possible values are:

    + + +
    Return values
    @@ -1207,6 +1249,7 @@ Possible values are:

    +
    Parameters
    @@ -1240,6 +1283,8 @@ Possible values are:

    + +
    @@ -1352,20 +1397,20 @@ Possible values are:

  • Methods
  • diff --git a/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html b/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html index 995dc97..241f123 100644 --- a/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html +++ b/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html @@ -205,6 +205,7 @@

    Throws internal errors as exceptions.

    +

    If registered as error handler, this converts an internal PHP error into an ErrorException. It respects the error_reporting directive.

    @@ -232,6 +233,8 @@ + +

    Table of Contents @@ -254,7 +257,7 @@

    - __invoke() + __invoke()  : bool
    @@ -264,7 +267,6 @@ - @@ -303,6 +305,7 @@
    +
    Parameters
    @@ -362,6 +365,8 @@
    + +
    Return values
    bool @@ -485,7 +490,7 @@
  • Methods
  • diff --git a/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html b/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html index b4530c9..c5ddbb2 100644 --- a/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html +++ b/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html @@ -205,6 +205,7 @@

    Triggers errors for uncaught exceptions.

    +

    If registered as exception handler, this catches an uncaught exception and converts it into an internal PHP error of severity E_USER_ERROR.

    @@ -232,6 +233,8 @@ converts it into an internal PHP error of severity E_U + +

    Table of Contents @@ -254,7 +257,7 @@ converts it into an internal PHP error of severity E_U

    - __invoke() + __invoke()  : void
    @@ -264,7 +267,6 @@ converts it into an internal PHP error of severity E_U - @@ -303,6 +305,7 @@ converts it into an internal PHP error of severity E_U
    +
    Parameters
    @@ -319,6 +322,8 @@ converts it into an internal PHP error of severity E_U + +
    @@ -433,7 +438,7 @@ converts it into an internal PHP error of severity E_U
  • Methods
  • diff --git a/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html b/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html index dc73e22..86328d4 100644 --- a/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html @@ -189,6 +189,7 @@

    A generic implementation of the ArrayAccess interface.

    +

    Internally it accesses the protected $_data array.

    @@ -217,7 +218,9 @@
    -
    + + + @@ -243,28 +246,28 @@
    - offsetExists() + offsetExists()  : bool
    Check if the specified offset exists.
    - offsetGet() + offsetGet()  : TValue|null
    Retrieve data at the specified offset.
    - offsetSet() + offsetSet()  : void
    Assign a value to the specified offset.
    - offsetUnset() + offsetUnset()  : void
    @@ -315,6 +318,7 @@ +
    Parameters
    @@ -330,6 +334,8 @@ + +
    Return values
    bool @@ -370,6 +376,7 @@ +
    Parameters
    @@ -385,6 +392,8 @@ + +
    Return values
    TValue|null @@ -425,6 +434,7 @@ +
    Parameters
    @@ -450,6 +460,8 @@ + +
    Parameters
    @@ -497,6 +510,8 @@ + +
    @@ -609,10 +624,10 @@
  • Methods
  • diff --git a/doc/classes/OCC-Basics-Interfaces-CountableTrait.html b/doc/classes/OCC-Basics-Interfaces-CountableTrait.html index ea85a61..213bef8 100644 --- a/doc/classes/OCC-Basics-Interfaces-CountableTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-CountableTrait.html @@ -189,6 +189,7 @@

    A generic implementation of the Countable interface.

    +

    Internally it counts the values of the protected $_data array.

    @@ -217,7 +218,9 @@
    -
    +
    + + @@ -243,7 +246,7 @@
    - count() + count()  : int<0, max>
    @@ -296,6 +299,9 @@ + + +
    Return values
    @@ -418,7 +424,7 @@
  • Methods
  • diff --git a/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html b/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html index 8827683..df9fed6 100644 --- a/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html @@ -189,6 +189,7 @@

    A generic implementation of the IteratorAggregate interface.

    +

    Internally it iterates over the protected $_data array.

    @@ -217,7 +218,9 @@
    -
    + + + @@ -243,7 +246,7 @@
    - getIterator() + getIterator()  : ArrayIterator<string|int, TValue>
    @@ -296,6 +299,9 @@ + + +
    Return values
    @@ -418,7 +424,7 @@
  • Methods
  • diff --git a/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html b/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html index b0ede7b..22869eb 100644 --- a/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html @@ -189,6 +189,7 @@

    A generic implementation of the Iterator interface.

    +

    Internally it iterates over the protected $_data array.

    @@ -217,7 +218,9 @@
    -
    + + + @@ -243,42 +246,42 @@
    - current() + current()  : TValue|null
    Return the current item.
    - key() + key()  : string|int|null
    Return the current key.
    - next() + next()  : void
    Move forward to next item.
    - prev() + prev()  : void
    Move back to previous item.
    - rewind() + rewind()  : void
    Rewind the iterator to the first item.
    - valid() + valid()  : bool
    @@ -331,6 +334,9 @@ + + +
    Return values
    @@ -374,6 +380,9 @@ + + +
    Return values
    @@ -417,6 +426,9 @@ + + + @@ -452,6 +464,9 @@ + + + @@ -487,6 +502,9 @@ + + + @@ -522,6 +540,9 @@ + + +
    Return values
    @@ -644,12 +665,12 @@
  • Methods
  • diff --git a/doc/classes/OCC-Basics-Traits-Getter.html b/doc/classes/OCC-Basics-Traits-Getter.html index 45d28e8..532b3b4 100644 --- a/doc/classes/OCC-Basics-Traits-Getter.html +++ b/doc/classes/OCC-Basics-Traits-Getter.html @@ -189,6 +189,7 @@

    Reads data from inaccessible properties by using magic methods.

    +

    To make a protected or private property readable, provide a method named _magicGet{Property}() which handles the reading. Replace {Property} in the method's name with the name of the actual property (with an uppercase @@ -216,7 +217,9 @@ a context where it normally would not be accessible.

    -
    + + + @@ -242,14 +245,14 @@ a context where it normally would not be accessible.

    - __get() + __get()  : mixed
    Read data from an inaccessible property.
    - __isset() + __isset()  : bool
    @@ -298,6 +301,7 @@ a context where it normally would not be accessible.

    +
    Parameters
    @@ -330,6 +334,8 @@ a context where it normally would not be accessible.

    + +
    Return values
    mixed @@ -368,6 +374,7 @@ a context where it normally would not be accessible.

    +
    Parameters
    @@ -383,6 +390,8 @@ a context where it normally would not be accessible.

    + +
    Return values
    bool @@ -504,8 +513,8 @@ a context where it normally would not be accessible.

  • Methods
  • diff --git a/doc/classes/OCC-Basics-Traits-OverloadingGetter.html b/doc/classes/OCC-Basics-Traits-OverloadingGetter.html index c9b2c8a..0ca7f95 100644 --- a/doc/classes/OCC-Basics-Traits-OverloadingGetter.html +++ b/doc/classes/OCC-Basics-Traits-OverloadingGetter.html @@ -189,6 +189,7 @@

    Overloads a class with readable magic properties.

    +

    Internally it reads the protected $_data array whose keys are interpreted as property names.

    @@ -212,7 +213,9 @@ as property names.

    -
    +
    + + @@ -238,14 +241,14 @@ as property names.

    - __get() + __get()  : mixed
    Read data from an overloaded property.
    - __isset() + __isset()  : bool
    @@ -294,6 +297,7 @@ as property names.

    +
    Parameters
    @@ -309,6 +313,8 @@ as property names.

    + +
    Return values
    mixed @@ -347,6 +353,7 @@ as property names.

    +
    Parameters
    @@ -362,6 +369,8 @@ as property names.

    + +
    Return values
    bool @@ -483,8 +492,8 @@ as property names.

  • Methods
  • diff --git a/doc/classes/OCC-Basics-Traits-OverloadingSetter.html b/doc/classes/OCC-Basics-Traits-OverloadingSetter.html index 6093885..fe3ae4a 100644 --- a/doc/classes/OCC-Basics-Traits-OverloadingSetter.html +++ b/doc/classes/OCC-Basics-Traits-OverloadingSetter.html @@ -189,6 +189,7 @@

    Overloads a class with writable magic properties.

    +

    Internally it writes the protected $_data array whose keys are interpreted as property names.

    @@ -212,7 +213,9 @@ as property names.

    -
    +
    + + @@ -238,14 +241,14 @@ as property names.

    - __set() + __set()  : void
    Write data to an overloaded property.
    - __unset() + __unset()  : void
    @@ -294,6 +297,7 @@ as property names.

    +
    Parameters
    @@ -319,6 +323,8 @@ as property names.

    + +
    +
    Parameters
    @@ -364,6 +371,8 @@ as property names.

    + +
    @@ -476,8 +485,8 @@ as property names.

  • Methods
  • diff --git a/doc/classes/OCC-Basics-Traits-Setter.html b/doc/classes/OCC-Basics-Traits-Setter.html index 802bd73..31d992e 100644 --- a/doc/classes/OCC-Basics-Traits-Setter.html +++ b/doc/classes/OCC-Basics-Traits-Setter.html @@ -189,6 +189,7 @@

    Writes data to inaccessible properties by using magic methods.

    +

    To make a protected or private property writable, provide a method named _magicSet{Property}() which handles the writing. Replace {Property} in the method's name with the name of the actual property (with an uppercase @@ -216,7 +217,9 @@ to in a context where it normally would not be accessible.

    - + + + @@ -242,14 +245,14 @@ to in a context where it normally would not be accessible.

    - __set() + __set()  : void
    Write data to an inaccessible property.
    - __unset() + __unset()  : void
    @@ -298,6 +301,7 @@ to in a context where it normally would not be accessible.

    +
    Parameters
    @@ -340,6 +344,8 @@ to in a context where it normally would not be accessible.

    + +
    +
    Parameters
    @@ -385,6 +392,8 @@ to in a context where it normally would not be accessible.

    + +
    @@ -497,8 +506,8 @@ to in a context where it normally would not be accessible.

  • Methods
  • diff --git a/doc/classes/OCC-Basics-Traits-Singleton.html b/doc/classes/OCC-Basics-Traits-Singleton.html index de4e78b..fe43f7b 100644 --- a/doc/classes/OCC-Basics-Traits-Singleton.html +++ b/doc/classes/OCC-Basics-Traits-Singleton.html @@ -189,6 +189,7 @@

    Allows just a single instance of the class using this trait.

    +

    Get the singleton by calling the static method getInstance().

    If there is no object yet, the constructor is called with the same arguments as getInstance(). Any later call will just return the already instantiated @@ -213,7 +214,9 @@ as private to prevent direct instantiation of t

    - + + + @@ -239,21 +242,21 @@ as private to prevent direct instantiation of t
    - __clone() + __clone()  : void
    This is a singleton class, thus cloning is prohibited.
    - getInstance() + getInstance()  : static
    Get a singleton instance of this class.
    - __construct() + __construct()  : void
    @@ -304,6 +307,7 @@ as private to prevent direct instantiation of t +
    Tags @@ -323,6 +327,8 @@ as private to prevent direct instantiation of t
    + +
    private to prevent direct instantiation of t +
    Parameters
    @@ -369,6 +376,8 @@ as private to prevent direct instantiation of t + +
    Return values
    static @@ -409,6 +418,7 @@ as private to prevent direct instantiation of t +
    Tags @@ -428,6 +438,8 @@ as private to prevent direct instantiation of t
    + +
    @@ -540,9 +552,9 @@ as private to prevent direct instantiation of t
  • Methods
  • diff --git a/doc/classes/OCC-Basics-Traits-TypeChecker.html b/doc/classes/OCC-Basics-Traits-TypeChecker.html index 07d5652..bed3cce 100644 --- a/doc/classes/OCC-Basics-Traits-TypeChecker.html +++ b/doc/classes/OCC-Basics-Traits-TypeChecker.html @@ -189,6 +189,7 @@

    A generic data type checker.

    +

    This allows to set a list of allowed atomic data types and fully qualified class names. It also provides a method to check if a value's data type matches at least one of these types.

    @@ -210,7 +211,9 @@ matches at least one of these types.

    - + + + @@ -236,28 +239,28 @@ matches at least one of these types.

    - getAllowedTypes() + getAllowedTypes()  : array<string|int, string>
    Get allowed data types.
    - hasAllowedType() + hasAllowedType()  : bool
    Check if a value's data type is allowed.
    - isAllowedType() + isAllowedType()  : bool
    Check if a data type is allowed.
    - setAllowedTypes() + setAllowedTypes()  : void
    @@ -310,6 +313,9 @@ matches at least one of these types.

    + + +
    Return values
    @@ -351,6 +357,7 @@ matches at least one of these types.

    +
    Parameters
    @@ -366,6 +373,8 @@ matches at least one of these types.

    + +
    Return values
    bool @@ -406,6 +415,7 @@ matches at least one of these types.

    +
    Parameters
    @@ -421,6 +431,8 @@ matches at least one of these types.

    + +
    Return values
    bool @@ -461,6 +473,7 @@ matches at least one of these types.

    +
    Parameters
    @@ -494,6 +507,8 @@ matches at least one of these types.

    + +
    @@ -606,10 +621,10 @@ matches at least one of these types.

  • Methods
  • diff --git a/doc/css/base.css b/doc/css/base.css index 8b182de..08168d7 100644 --- a/doc/css/base.css +++ b/doc/css/base.css @@ -99,6 +99,7 @@ /* Base Styles -------------------------------------------------- */ body { + background-color: #fff; color: var(--text-color); font-family: var(--font-primary); font-size: var(--text-md); @@ -494,7 +495,7 @@ div.phpdocumentor-list > ul, ol.phpdocumentor-list, ul.phpdocumentor-list { margin-top: 0; - padding-left: var(--spacing-md); + padding-left: var(--spacing-lg); margin-bottom: var(--spacing-sm); } @@ -1215,6 +1216,10 @@ is too big a fix and needs to be done in a new design iteration. word-break: break-all; line-height: normal; } + + .phpdocumentor-on-this-page__content li.-deprecated { + text-decoration: line-through; + } } /* Used for screen readers and such */ diff --git a/doc/css/template.css b/doc/css/template.css index 82f2424..cdc39e3 100644 --- a/doc/css/template.css +++ b/doc/css/template.css @@ -126,6 +126,10 @@ flex: 0 1 auto; } +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a.-deprecated { + text-decoration: line-through; +} + .phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > span { flex: 1; white-space: nowrap; diff --git a/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html b/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html index f468577..2cb20cf 100644 --- a/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html +++ b/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-datastructures-strictarray.html b/doc/files/src-datastructures-strictarray.html index 2ee0f29..4a4072f 100644 --- a/doc/files/src-datastructures-strictarray.html +++ b/doc/files/src-datastructures-strictarray.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-datastructures-strictcollection.html b/doc/files/src-datastructures-strictcollection.html index 02bc36c..e9535f0 100644 --- a/doc/files/src-datastructures-strictcollection.html +++ b/doc/files/src-datastructures-strictcollection.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-datastructures-strictlist.html b/doc/files/src-datastructures-strictlist.html index 6aa1ef7..39a171e 100644 --- a/doc/files/src-datastructures-strictlist.html +++ b/doc/files/src-datastructures-strictlist.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-datastructures-strictqueue.html b/doc/files/src-datastructures-strictqueue.html index 9110604..151ca4c 100644 --- a/doc/files/src-datastructures-strictqueue.html +++ b/doc/files/src-datastructures-strictqueue.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-datastructures-strictstack.html b/doc/files/src-datastructures-strictstack.html index 08cf2f7..4f68f44 100644 --- a/doc/files/src-datastructures-strictstack.html +++ b/doc/files/src-datastructures-strictstack.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-datastructures-traits-strictspldoublylinkedlisttrait.html b/doc/files/src-datastructures-traits-strictspldoublylinkedlisttrait.html index 0e47876..f7c6165 100644 --- a/doc/files/src-datastructures-traits-strictspldoublylinkedlisttrait.html +++ b/doc/files/src-datastructures-traits-strictspldoublylinkedlisttrait.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-errorhandlers-throwerrorexception.html b/doc/files/src-errorhandlers-throwerrorexception.html index 4752b34..a4b8b2a 100644 --- a/doc/files/src-errorhandlers-throwerrorexception.html +++ b/doc/files/src-errorhandlers-throwerrorexception.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-errorhandlers-triggerexceptionerror.html b/doc/files/src-errorhandlers-triggerexceptionerror.html index 9789a1d..4dacd75 100644 --- a/doc/files/src-errorhandlers-triggerexceptionerror.html +++ b/doc/files/src-errorhandlers-triggerexceptionerror.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-interfaces-arrayaccesstrait.html b/doc/files/src-interfaces-arrayaccesstrait.html index ea05ad9..084e8e3 100644 --- a/doc/files/src-interfaces-arrayaccesstrait.html +++ b/doc/files/src-interfaces-arrayaccesstrait.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-interfaces-countabletrait.html b/doc/files/src-interfaces-countabletrait.html index 90b67fe..62d5738 100644 --- a/doc/files/src-interfaces-countabletrait.html +++ b/doc/files/src-interfaces-countabletrait.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-interfaces-iteratoraggregatetrait.html b/doc/files/src-interfaces-iteratoraggregatetrait.html index aa27ae4..1f98269 100644 --- a/doc/files/src-interfaces-iteratoraggregatetrait.html +++ b/doc/files/src-interfaces-iteratoraggregatetrait.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-interfaces-iteratortrait.html b/doc/files/src-interfaces-iteratortrait.html index 81a5d7d..b03fa08 100644 --- a/doc/files/src-interfaces-iteratortrait.html +++ b/doc/files/src-interfaces-iteratortrait.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-traits-getter.html b/doc/files/src-traits-getter.html index d53a09f..c2ccd8a 100644 --- a/doc/files/src-traits-getter.html +++ b/doc/files/src-traits-getter.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-traits-overloadinggetter.html b/doc/files/src-traits-overloadinggetter.html index 4efa2e7..b05c8c9 100644 --- a/doc/files/src-traits-overloadinggetter.html +++ b/doc/files/src-traits-overloadinggetter.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-traits-overloadingsetter.html b/doc/files/src-traits-overloadingsetter.html index e58e6a7..5d388e7 100644 --- a/doc/files/src-traits-overloadingsetter.html +++ b/doc/files/src-traits-overloadingsetter.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-traits-setter.html b/doc/files/src-traits-setter.html index 119f478..cf9bde9 100644 --- a/doc/files/src-traits-setter.html +++ b/doc/files/src-traits-setter.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-traits-singleton.html b/doc/files/src-traits-singleton.html index 7c82c71..c118915 100644 --- a/doc/files/src-traits-singleton.html +++ b/doc/files/src-traits-singleton.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src-traits-typechecker.html b/doc/files/src-traits-typechecker.html index 8501d80..275c3d5 100644 --- a/doc/files/src-traits-typechecker.html +++ b/doc/files/src-traits-typechecker.html @@ -176,6 +176,7 @@

    PHP Basics

    +

    Copyright (C) 2024 Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,6 +194,8 @@ along with this program. If not, see http + +

    Table of Contents diff --git a/doc/files/src/DataStructures/StrictArray.php.txt b/doc/files/src/DataStructures/StrictArray.php.txt index bd590ea..7a05194 100644 --- a/doc/files/src/DataStructures/StrictArray.php.txt +++ b/doc/files/src/DataStructures/StrictArray.php.txt @@ -83,7 +83,7 @@ class StrictArray extends StrictCollection implements Iterator */ public function pop(): mixed { - if ($this->count() === 0) { + if (count($this->_data) === 0) { throw new RuntimeException( 'Cannot return last item: array is empty.' ); @@ -126,7 +126,7 @@ class StrictArray extends StrictCollection implements Iterator */ public function shift(): mixed { - if ($this->count() === 0) { + if (count($this->_data) === 0) { throw new RuntimeException( 'Cannot return first item: array is empty.' ); diff --git a/doc/guides/changelog.html b/doc/guides/changelog.html index a78e8de..50284ca 100644 --- a/doc/guides/changelog.html +++ b/doc/guides/changelog.html @@ -169,18 +169,55 @@
    -

    Changelog

    +

    Changelog

    - +
    + +
    +
    -

    v2.1.0

    +

    v2.1.0

    + + +

    Breaking Changes: +

    -

    Breaking Changes:

      @@ -191,7 +228,10 @@
    -

    New Features:

    + +

    New Features: +

    +
      @@ -203,33 +243,47 @@
    -

    v2.0.0

    +

    v2.0.0

    + + +

    Breaking Changes: +

    -

    Breaking Changes:

    • Raised minimum PHP version from 8.0 to 8.1 in order to use new features like array_is_list() and the spread operator on string-keyed arrays
    • -
    • Interfaces - traits renamed and moved to different namespace

      OCC\Basics\InterfaceTraits\ArrayAccess       -> OCC\Basics\Interfaces\ArrayAccessTrait
      +    
    • +

      Interfaces + traits renamed and moved to different namespace

      +
      OCC\Basics\InterfaceTraits\ArrayAccess       -> OCC\Basics\Interfaces\ArrayAccessTrait
       OCC\Basics\InterfaceTraits\Countable         -> OCC\Basics\Interfaces\CountableTrait
       OCC\Basics\InterfaceTraits\IteratorAggregate -> OCC\Basics\Interfaces\IteratorAggregateTrait
      -OCC\Basics\InterfaceTraits\Iterator          -> OCC\Basics\Interfaces\IteratorTrait
    • +OCC\Basics\InterfaceTraits\Iterator -> OCC\Basics\Interfaces\IteratorTrait
      +
    • -
    • Prefixed internal methods for Getter +

    • +

      Prefixed internal methods for Getter and Setter with -_ to avoid confusion with regular class methods

      // old methods
      +_
      + to avoid confusion with regular class methods

      +
      // old methods
       function magicGet{Property}(): mixed
      -function magicSet{Property}(mixed $value): void
      // new methods
      +function magicSet{Property}(mixed $value): void
      +
      // new methods
       function _magicGet{Property}(): mixed
      -function _magicSet{Property}(mixed $value): void
    • +function _magicSet{Property}(mixed $value): void +
    -

    New Features:

    + +

    New Features: +

    +
    -

    v1.1.0

    +

    v1.1.0

    + + +

    Breaking Changes: +

    -

    Breaking Changes:

      -
    • Changed the constructor's signature for all DataStructures +

    • +

      Changed the constructor's signature for all DataStructures to improve compatibility with -the corresponding SPL datastructures

      // old constructor signature
      -public function __construct(iterable $items = [], array $allowedTypes = [])
      // new constructor signature
      -public function __construct(array $allowedTypes = [])
    • +the corresponding SPL datastructures

      +
      // old constructor signature
      +public function __construct(iterable $items = [], array $allowedTypes = [])
      +
      // new constructor signature
      +public function __construct(array $allowedTypes = [])
      +
    -

    v1.0.1

    +

    v1.0.1

    + + +

    New Features: +

    -

    New Features:

      @@ -295,9 +359,12 @@ public function __construct(array $allowedTypes = [])
    -

    v1.0.0

    +

    v1.0.0

    + + +

    Initial Release +

    -

    Initial Release

    @@ -315,7 +382,7 @@ public function __construct(array $allowedTypes = [])

    - + diff --git a/doc/guides/index.html b/doc/guides/index.html index f029ab7..6487c41 100644 --- a/doc/guides/index.html +++ b/doc/guides/index.html @@ -169,40 +169,96 @@
    -

    Documentation

    +

    Documentation

    @@ -222,7 +278,7 @@

    - + diff --git a/doc/guides/overview/datastructures.html b/doc/guides/overview/datastructures.html index e42953c..635de33 100644 --- a/doc/guides/overview/datastructures.html +++ b/doc/guides/overview/datastructures.html @@ -169,29 +169,92 @@
    -

    Typed Datastructures

    +

    Typed Datastructures

    - +
    + +
    +
    -

    The datastructures in this package are derived from their respective Standard PHP Library (SPL) counterparts which they extend by the option to control the data types of items those + +

    The datastructures in this package are derived from their respective Standard PHP Library (SPL) counterparts which they extend by the option to control the data types of items those datastructures can hold.

    -

    To restrict allowed data types for items, provide the constructor with an array of atomic types or fully qualified -class names you want to allow as item types. Available atomic types are array, bool, callable, countable, -float / double, int / integer / long, iterable, null, numeric, object, resource, scalar and -string.

    -

    Trying to add an item with a data type not on the list of allowed types to a strict datastructure will result in an -InvalidDataTypeException + + +

    To restrict allowed data types for items provide the constructor with an array of atomic types or fully qualified class +names (FQCN) you want to allow as item types. Available atomic types are array +, bool +, callable +, countable +, +float + (or double +), int + (or integer + or long +), iterable +, null +, numeric +, object +, resource +, scalar + +and string .

    -

    All strict datastructures inherit the implementation of the \ArrayAccess, + + +

    Trying to add an item with a data type not on the list of allowed types to a strict datastructure will result in an +InvalidDataTypeException + being thrown.

    + + +

    All strict datastructures inherit the implementation of the \ArrayAccess, \Countable and \Serializable interfaces. All -but StrictCollection also implement a \Traversable interface.

    -

    Examples:

    // create a collection of strings
    -$stringCollection = new StrictCollection(['string']);
    // create a queue of PSR-15 middlewares
    -$middlewareQueue = new StrictQueue(['Psr\Http\Server\MiddlewareInterface']);
    +but StrictCollection + also implement a \Traversable interface.

    + +
    +

    Examples:

    +
    // create a collection of strings
    +$stringCollection = new StrictCollection(['string']);
    +
    // create a queue of PSR-15 middlewares
    +$middlewareQueue = new StrictQueue(['Psr\Http\Server\MiddlewareInterface']);
    +
    @@ -207,18 +270,24 @@ $middlewareQueue = new StrictQueue(['Psr\Http\Server\MiddlewareInterface�
    -

    StrictCollection

    +

    StrictCollection

    -

    A type-sensitive, unsorted collection of items.

    -

    Holds items as key/value pairs where keys identify the items and have to be valid array keys while values can be of any + +

    A type-sensitive, unsorted collection of items. +

    + + +

    Holds items as key/value pairs where keys identify the items and have to be valid array keys while values can be of any controlled type. The collection can be accessed like an array, but not traversed because it has no particular order.

    +
    -

    Internally it holds the items in the $_data array, the same as most Interface Traits - and Traits - of this + +

    Internally it holds the items in the $_data + array, the same as most Interface Traits and Traits of this package.

    +
    @@ -238,18 +307,24 @@ package.

    -

    StrictArray

    +

    StrictArray

    -

    A type-sensitive, traversable array of items.

    -

    Holds items as key/value pairs where keys identify the items and have to be valid array keys while values can be of any + +

    A type-sensitive, traversable array of items. +

    + + +

    Holds items as key/value pairs where keys identify the items and have to be valid array keys while values can be of any controlled type. The array can be accessed and traversed just like any other array.

    +
    -

    Internally it holds the items in the $_data array, the same as most Interface Traits - and Traits - of this + +

    Internally it holds the items in the $_data + array, the same as most Interface Traits and Traits of this package.

    +
    @@ -269,11 +344,16 @@ package.

    -

    StrictList

    +

    StrictList

    -

    A type-sensitive, taversable list of items.

    -

    Extends \SplDoublyLinkedList with an option to restrict the allowed data + +

    A type-sensitive, taversable list of items. +

    + + +

    Extends \SplDoublyLinkedList with an option to restrict the allowed data types for list items. The list can be accessed and traversed like an array, but has only consecutive numerical keys.

    +
    @@ -290,14 +370,23 @@ types for list items. The list can be accessed and traversed like an array, but
    -

    StrictQueue

    +

    StrictQueue

    -

    A type-sensitive, taversable queue (FIFO) of items.

    -

    Extends \SplQueue with an option to restrict the allowed data types for queue items. + +

    A type-sensitive, taversable queue (FIFO) of items. +

    + + +

    Extends \SplQueue with an option to restrict the allowed data types for queue items. The queue can be accessed and traversed like an array, but has only consecutive numerical keys. Traversal follows the first-in, first-out (FIFO) principle meaning that items are returned in the same order they were added to the queue.

    -

    It is recommended to use the StrictQueue::enqueue() and StrictQueue::dequeue() alias methods when working with a + + +

    It is recommended to use the StrictQueue::enqueue() + and StrictQueue::dequeue() + alias methods when working with a queue, because those will ensure proper FIFO behavior and remove items while traversing.

    +
    @@ -314,14 +403,23 @@ queue, because those will ensure proper FIFO behavior and remove items while tra
    -

    StrictStack

    +

    StrictStack

    -

    A type-sensitive, taversable stack (LIFO) of items.

    -

    Extends \SplStack with an option to restrict the allowed data types for stack items. + +

    A type-sensitive, taversable stack (LIFO) of items. +

    + + +

    Extends \SplStack with an option to restrict the allowed data types for stack items. The stack can be accessed and traversed like an array, but has only consecutive numerical keys. Traversal follows the last-in, first-out (LIFO) principle meaning that items are returned in the reversed order they were added to the stack.

    -

    It is recommended to use the StrictStack::stack() and StrictStack::unstack() alias methods when working with a + + +

    It is recommended to use the StrictStack::stack() + and StrictStack::unstack() + alias methods when working with a stack, because those will ensure proper LIFO behavior and remove items while traversing.

    +
    @@ -339,7 +437,7 @@ stack, because those will ensure proper LIFO behavior and remove items while tra

    - + diff --git a/doc/guides/overview/errorhandlers.html b/doc/guides/overview/errorhandlers.html index 92a8642..5bbcf75 100644 --- a/doc/guides/overview/errorhandlers.html +++ b/doc/guides/overview/errorhandlers.html @@ -169,7 +169,7 @@
    -

    Error and Exception Handlers

    +

    Error and Exception Handlers

    @@ -185,18 +185,35 @@
    -

    ThrowErrorException

    +

    ThrowErrorException

    -

    Throws internal errors as exceptions.

    -

    If registered as error handler, this handles an internal PHP error by converting it into an \ErrorException. It respects the error_reporting + +

    Throws internal errors as exceptions. +

    + + +

    If registered as error handler, this handles an internal PHP error by converting it into an \ErrorException. It respects the error_reporting directive by only throwing an exception if the severity of the internal error is the same or higher than the setting.

    -

    Usage:

    set_error_handler(new ThrowErrorException());
    + +
    +

    Usage:

    +
    set_error_handler(new ThrowErrorException());
    +
    -

    By design user-defined error handlers can't handle errors of severity E_ERROR, E_PARSE, E_CORE_ERROR, -E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING and most of E_STRICT.

    + +

    By design user-defined error handlers can't handle errors of severity E_ERROR +, E_PARSE +, E_CORE_ERROR +, +E_CORE_WARNING +, E_COMPILE_ERROR +, E_COMPILE_WARNING + and most of E_STRICT +.

    +
    @@ -216,12 +233,21 @@ directive by only throwing an exception if the severity of the internal error is
    -

    TriggerExceptionError

    +

    TriggerExceptionError

    -

    Triggers errors for uncaught exceptions.

    -

    If registered as exception handler, this catches an uncaught exception and converts it into an internal PHP error of -severity E_USER_ERROR.

    -

    Usage:

    set_exception_handler(new TriggerExceptionError());
    + +

    Triggers errors for uncaught exceptions. +

    + + +

    If registered as exception handler, this catches an uncaught exception and converts it into an internal PHP error of +severity E_USER_ERROR +.

    + +
    +

    Usage:

    +
    set_exception_handler(new TriggerExceptionError());
    +
    @@ -240,7 +266,7 @@ severity E_USER_ERROR.

    - + diff --git a/doc/guides/overview/index.html b/doc/guides/overview/index.html index e861b9f..5b9c629 100644 --- a/doc/guides/overview/index.html +++ b/doc/guides/overview/index.html @@ -169,64 +169,146 @@
    -

    Overview

    +

    Overview

    -

    The package currently contains classes for Typed Datastructures -, Error and Exception Handlers -, multiple Interface Traits -, and -more generic Traits - for common use cases. They share the same design principles like property and method naming + +

    The package currently contains classes for Typed Datastructures, Error and Exception Handlers, multiple Interface Traits, and +more generic Traits for common use cases. They share the same design principles like property and method naming schema, the highest coding standards of PHPStan and Psalm, and full -PSR-12 compliance to make sure they can be combined and easily re-used in -other projects.

    +PSR-12 compliance to make sure they can be combined and easily used in other +projects.

    + @@ -246,7 +328,7 @@ other projects.

    - + diff --git a/doc/guides/overview/interfaces.html b/doc/guides/overview/interfaces.html index 3aa3097..954106a 100644 --- a/doc/guides/overview/interfaces.html +++ b/doc/guides/overview/interfaces.html @@ -169,24 +169,55 @@
    -

    Interface Traits

    +

    Interface Traits

    -

    This package contains some traits implementing common interfaces, which can easily be used in any class that internally + +

    This package contains some traits implementing common interfaces, which can easily be used in any class that internally uses an array for holding its properties or data. They also share the same internal logic to allow combining multiple traits within the same class.

    +
    @@ -204,14 +235,22 @@ this package.

    -

    ArrayAccessTrait

    +

    ArrayAccessTrait

    -

    A generic implementation of the ArrayAccess interface.

    -

    The \ArrayAccess interface allows objects to be accessed like arrays.

    -

    Usage:

    class Foo implements ArrayAccess
    +            
    +    

    A generic implementation of the ArrayAccess interface. +

    + + +

    The \ArrayAccess interface allows objects to be accessed like arrays.

    + +
    +

    Usage:

    +
    class Foo implements ArrayAccess
     {
         use \OCC\Basics\Interfaces\ArrayAccessTrait;
    -}
    +}
    +
    @@ -229,14 +268,22 @@ this package.

    -

    CountableTrait

    +

    CountableTrait

    -

    A generic implementation of the Countable interface.

    -

    The \Countable interface allows objects to be used with the count() function.

    -

    Usage:

    class Foo implements Countable
    +            
    +    

    A generic implementation of the Countable interface. +

    + + +

    The \Countable interface allows objects to be used with the count() function.

    + +
    +

    Usage:

    +
    class Foo implements Countable
     {
         use \OCC\Basics\Interfaces\CountableTrait;
    -}
    +}
    +
    @@ -254,14 +301,22 @@ this package.

    -

    IteratorAggregateTrait

    +

    IteratorAggregateTrait

    -

    A generic implementation of the IteratorAggregate interface.

    -

    The \IteratorAggregate interface creates an external \ArrayIterator for traversing the object's internal data array.

    -

    Usage:

    class Foo implements IteratorAggregate
    +            
    +    

    A generic implementation of the IteratorAggregate interface. +

    + + +

    The \IteratorAggregate interface creates an external \ArrayIterator for traversing the object's internal data array.

    + +
    +

    Usage:

    +
    class Foo implements IteratorAggregate
     {
         use \OCC\Basics\Interfaces\IteratorAggregateTrait;
    -}
    +}
    +
    @@ -279,15 +334,23 @@ this package.

    -

    IteratorTrait

    +

    IteratorTrait

    -

    A generic implementation of the Iterator interface.

    -

    The \Iterator interface creates an internal iterator for traversing the object's data + +

    A generic implementation of the Iterator interface. +

    + + +

    The \Iterator interface creates an internal iterator for traversing the object's data array.

    -

    Usage:

    class Foo implements Iterator
    +
    +            
    +

    Usage:

    +
    class Foo implements Iterator
     {
         use \OCC\Basics\Interfaces\IteratorTrait;
    -}
    +}
    +
    @@ -306,7 +369,7 @@ array.

    - + diff --git a/doc/guides/overview/traits.html b/doc/guides/overview/traits.html index 41edee3..4627f22 100644 --- a/doc/guides/overview/traits.html +++ b/doc/guides/overview/traits.html @@ -169,19 +169,59 @@
    -

    Traits

    +

    Traits

    - +
    + +
    +
    -

    This package provides a number of generic traits like different getter and setter methods, an implementation of the + +

    This package provides a number of generic traits like different getter and setter methods, an implementation of the singleton design pattern and some little helpers. Those traits are too small to justify their own packages and most of them -are dependencies of the Typed Datastructures - and Interface Traits - anyway.

    +are dependencies of the Typed Datastructures and Interface Traits anyway.

    +
    @@ -196,16 +236,32 @@ are dependencies of the Typed Data
    -

    Getter

    +

    Getter

    -

    Reads data from inaccessible properties by using magic methods.

    -

    To make a protected or private property readable, provide a method named _magicGet{Property}() which handles the -reading. Replace {Property} in the method's name with the name of the actual property (with an uppercase first + +

    Reads data from inaccessible properties by using magic methods. +

    + + +

    To make a protected + or private + property readable, provide a method named _magicGet{Property}() + which handles the +reading. Replace {Property} + in the method's name with the name of the actual property (with an uppercase first letter).

    -

    Trying to access an undefined property or a property without corresponding "magic" getter method will result in an -\InvalidArgumentException.

    -

    Example: If the property is named $fooBar, the "magic" method has to be _magicGetFooBar(). This method is then -called when $fooBar is read in a context where it normally would not be accessible.

    + + +

    Trying to access an undefined property or a property without corresponding "magic" getter method will result in an +\InvalidArgumentException being thrown.

    + +
    +

    Example: If the property is named $fooBar +, the "magic" method has to be _magicGetFooBar() +. This method is then +called when $fooBar + is read in a context where it normally would not be accessible.

    +
    @@ -223,16 +279,32 @@ called when $fooBar is read in a context where it normally would no
    -

    Setter

    +

    Setter

    -

    Writes data to inaccessible properties by using magic methods.

    -

    To make a protected or private property writable, provide a method named _magicSet{Property}() which handles the -writing. Replace {Property} in the method's name with the name of the actual property (with an uppercase first + +

    Writes data to inaccessible properties by using magic methods. +

    + + +

    To make a protected + or private + property writable, provide a method named _magicSet{Property}() + which handles the +writing. Replace {Property} + in the method's name with the name of the actual property (with an uppercase first letter).

    -

    Trying to access an undefined property or a property without corresponding "magic" setter method will result in an -\InvalidArgumentException.

    -

    Example: If the property is named $fooBar, the "magic" method has to be _magicSetFooBar(). This method is then -called when $fooBar is written to in a context where it normally would not be accessible.

    + + +

    Trying to access an undefined property or a property without corresponding "magic" setter method will result in an +\InvalidArgumentException being thrown.

    + +
    +

    Example: If the property is named $fooBar +, the "magic" method has to be _magicSetFooBar() +. This method is then +called when $fooBar + is written to in a context where it normally would not be accessible.

    +
    @@ -250,20 +322,33 @@ called when $fooBar is written to in a context where it normally wo
    -

    OverloadingGetter

    +

    OverloadingGetter

    -

    Overloads a class with readable virtual properties.

    -

    It reads a protected internal array whose keys are interpreted as property names.

    -

    Trying to access an undefined virtual property will not issue any warning or error, but return NULL instead.

    -

    Example: Reading Foo->bar will return the value of Foo::$_data['bar'].

    + +

    Overloads a class with readable virtual properties. +

    + + +

    It reads a protected internal array whose keys are interpreted as property names.

    + + +

    Trying to access an undefined virtual property will not issue any warning or error, but return NULL + instead.

    + +
    +

    Example: Reading Foo->bar + will return the value of Foo::$_data['bar'] +.

    +
    @@ -283,20 +368,33 @@ package.

    -

    OverloadingSetter

    +

    OverloadingSetter

    -

    Overloads a class with writable virtual properties.

    -

    It writes a protected internal array whose keys are interpreted as property names.

    -

    Trying to access a previously undefined virtual property will create a new one with the given name.

    -

    Example: Foo->bar = 42; will set Foo::$_data['bar'] to 42.

    + +

    Overloads a class with writable virtual properties. +

    + + +

    It writes a protected internal array whose keys are interpreted as property names.

    + + +

    Trying to access a previously undefined virtual property will create a new one with the given name.

    + +
    +

    Example: Foo->bar = 42; + will set Foo::$_data['bar'] + to 42 +.

    +
    @@ -316,17 +414,27 @@ package.

    -

    Singleton

    +

    Singleton

    -

    Allows just a single instance of the class using this trait.

    -

    Get the singleton by calling the static method getInstance(). If there is no object yet, the constructor is called -with the same arguments as getInstance(). Any later call will just return the already instantiated object + +

    Allows just a single instance of the class using this trait. +

    + + +

    Get the singleton by calling the static method getInstance() +. If there is no object yet, the constructor is called +with the same arguments as getInstance() +. Any later call will just return the already instantiated object (irrespective of the given arguments).

    +
    -

    In order for this to work as expected, the constructor has to be implemented as private to prevent direct + +

    In order for this to work as expected, the constructor has to be implemented as private + to prevent direct instantiation of the class.

    +
    @@ -346,13 +454,36 @@ instantiation of the class.

    -

    TypeChecker

    +

    TypeChecker

    -

    A generic data type checker.

    -

    This allows to set a list of allowed atomic data types and fully qualified class names. It also provides a method to + +

    A generic data type checker. +

    + + +

    This allows to set a list of allowed atomic data types and fully qualified class names. It also provides a method to check if a value's data type matches at least one of these types.

    -

    Available atomic types are array, bool, callable, countable, float / double, int / integer / long, -iterable, null, numeric, object, resource, scalar and string.

    + + +

    Available atomic types are array +, bool +, callable +, countable +, float + (or double +), int + (or integer + or +long +), iterable +, null +, numeric +, object +, resource +, scalar + and string +.

    +
    @@ -370,7 +501,7 @@ check if a value's data type matches at least one of these types.

    - + diff --git a/doc/guides/usage/index.html b/doc/guides/usage/index.html index 5f31f4a..ce4cc99 100644 --- a/doc/guides/usage/index.html +++ b/doc/guides/usage/index.html @@ -169,29 +169,59 @@
    -

    User Guide

    +

    User Guide

    -

    The PHP Basics are a library package, not a stand-alone application. The following documentation of requirements and + +

    The PHP Basics + are a library package, not a stand-alone application. The following documentation of requirements and installation procedures describes how to make use of the classes and traits within your own application. For a detailed -description of the package's contents have a look at the Overview - page.

    +description of the package's contents have a look at the Overview page.

    +
    @@ -211,7 +241,7 @@ description of the package's contents have a look at the + diff --git a/doc/guides/usage/installation.html b/doc/guides/usage/installation.html index 4fc5493..a57edcd 100644 --- a/doc/guides/usage/installation.html +++ b/doc/guides/usage/installation.html @@ -169,52 +169,91 @@
    -

    Installation

    +

    Installation

    - +
    + +
    +
    -

    Composer

    +

    Composer

    -

    The intended and recommended way of re-using this package is via Composer. The following + +

    The intended and recommended way of using this package is via Composer. The following command will get you the latest version and make it a dependency of your project. It will also register all classes and traits with the autoloader to make them available inside the application.

    +
    # This will install the latest stable version suitable for your project
     composer require "opencultureconsulting/basics"
    -

    If you want to use a specific version other than the latest available for your environment, you can do so by appending + + +

    If you want to use a specific version other than the latest available for your environment, you can do so by appending the desired version constraint:

    -
    # This will install the latest patch level version of 2.0 (i. e. >=2.0.0 && <2.1.0)
    -composer require "opencultureconsulting/basics:~2.0"
    -

    All available versions as well as further information about Requirements - and dependencies can be found on + +

    # This will install the latest patch level version of 2.1 (i. e. >=2.1.0 && <2.2.0)
    +composer require "opencultureconsulting/basics:~2.1"
    + + +

    All available versions as well as further information about Requirements and dependencies can be found on Packagist.

    +
    -

    Git

    +

    Git

    -

    Alternatively, you can fetch the files from GitHub and add + +

    Alternatively, you can fetch the files from GitHub and add them to your project manually. The best way is by cloning the repository, because then you can easily update to a newer version by just pulling the changes and checking out a different version tag.

    +
    # This will clone the repository into the "basics" directory
     git clone https://github.com/opencultureconsulting/php-basics.git basics
    -

    If you want to use a specific version other than the latest development state, you have to specify the desired tag as + + +

    If you want to use a specific version other than the latest development state, you have to specify the desired tag as well:

    -
    # This will clone the repository state at version "2.0.0" into the "basics" directory
    -git clone --branch=v2.0.0 https://github.com/opencultureconsulting/php-basics.git basics
    -

    Be aware that you also need to make the classes and traits available in your application by either adding them to your + +

    # This will clone the repository state at version "2.1.0" into the "basics" directory
    +git clone --branch=v2.1.0 https://github.com/opencultureconsulting/php-basics.git basics
    + + +

    Be aware that you also need to make the classes and traits available in your application by either adding them to your autoloader or by including all files individually in PHP.

    +
    -

    Download

    +

    Download

    -

    As a last resort you can also just download the files. You can find all available versions as well as the current + +

    As a last resort you can also just download the files. You can find all available versions as well as the current development state on the GitHub release page.

    +
    @@ -232,7 +271,7 @@ development state on the + diff --git a/doc/guides/usage/requirements.html b/doc/guides/usage/requirements.html index 1b6d14f..15880cf 100644 --- a/doc/guides/usage/requirements.html +++ b/doc/guides/usage/requirements.html @@ -169,21 +169,28 @@
    -

    Requirements

    +

    Requirements

    -

    Environment

    +

    Environment

    + + +

    This package requires at least PHP 8.1 +.

    + + +

    It is highly recommended to use Composer for dependency management and autoloading, +although it is technically not strictly required for using any of these classes and traits. But it certainly makes it a +lot easier!

    -

    This package requires at least PHP 8.1.

    -

    It is highly recommended to use Composer for dependency management and autoloading, -although it is technically not strictly required for re-using any of these classes and traits. But it certainly -makes it a lot easier!

    -

    Dependencies

    +

    Dependencies

    + + +

    This package does not have any external dependencies.

    -

    This package does not have any external dependencies.

    @@ -201,7 +208,7 @@ makes it a lot easier!

    - + diff --git a/src/ErrorHandlers/ThrowErrorException.php b/src/ErrorHandlers/ThrowErrorException.php index 271b77b..695ce23 100644 --- a/src/ErrorHandlers/ThrowErrorException.php +++ b/src/ErrorHandlers/ThrowErrorException.php @@ -35,6 +35,8 @@ use function error_reporting; * * > Usage: `set_error_handler(new ThrowErrorException());` * + * @api + * * @author Sebastian Meyer * @package Basics\ErrorHandlers */ diff --git a/src/ErrorHandlers/TriggerExceptionError.php b/src/ErrorHandlers/TriggerExceptionError.php index 16e9527..dcc08fc 100644 --- a/src/ErrorHandlers/TriggerExceptionError.php +++ b/src/ErrorHandlers/TriggerExceptionError.php @@ -36,6 +36,8 @@ use function trigger_error; * * > Usage: `set_exception_handler(new TriggerExceptionError());` * + * @api + * * @author Sebastian Meyer * @package Basics\ErrorHandlers */