From d0dcdb51106d94880022358522261de276cd097d Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Tue, 26 Mar 2024 20:10:30 +0100 Subject: [PATCH] Update documentation --- .phpdoc/guide/changelog.rst | 7 +- .phpdoc/guide/index.rst | 5 +- .phpdoc/guide/overview/datastructures.rst | 79 + .phpdoc/guide/overview/errorhandlers.rst | 27 + .phpdoc/guide/overview/index.rst | 14 + .phpdoc/guide/overview/interfaces.rst | 35 + .phpdoc/guide/overview/traits.rst | 78 + .phpdoc/guide/usage/index.rst | 12 +- .phpdoc/guide/usage/installation.rst | 3 + .phpdoc/template/css/custom.css.twig | 34 + .phpdoc/template/index.html.twig | 8 +- ...s-Exceptions-InvalidDataTypeException.html | 396 ++++ ...asics-DataStructures-StrictCollection.html | 597 +++--- .../OCC-Basics-DataStructures-StrictList.html | 1684 ++-------------- ...OCC-Basics-DataStructures-StrictQueue.html | 1765 ++--------------- ...tructures-StrictSplDatastructureTrait.html | 1390 +++++++++++++ ...OCC-Basics-DataStructures-StrictStack.html | 1735 ++-------------- ...es-Traits-StrictSplDatastructureTrait.html | 1391 +++++++++++++ ...ics-ErrorHandlers-ThrowErrorException.html | 18 + ...s-ErrorHandlers-TriggerExceptionError.html | 18 + ...CC-Basics-Interfaces-ArrayAccessTrait.html | 18 + .../OCC-Basics-Interfaces-CountableTrait.html | 18 + ...ics-Interfaces-IteratorAggregateTrait.html | 18 + .../OCC-Basics-Interfaces-IteratorTrait.html | 18 + doc/classes/OCC-Basics-Traits-Getter.html | 18 + .../OCC-Basics-Traits-OverloadingGetter.html | 18 + .../OCC-Basics-Traits-OverloadingSetter.html | 18 + doc/classes/OCC-Basics-Traits-Setter.html | 18 + doc/classes/OCC-Basics-Traits-Singleton.html | 18 + .../OCC-Basics-Traits-TypeChecker.html | 644 ++++++ doc/css/template.css | 34 + ...s-exceptions-invaliddatatypeexception.html | 362 ++++ .../src-datastructures-strictcollection.html | 18 + doc/files/src-datastructures-strictlist.html | 18 + doc/files/src-datastructures-strictqueue.html | 18 + ...tructures-strictspldatastructuretrait.html | 362 ++++ doc/files/src-datastructures-strictstack.html | 18 + ...es-traits-strictspldatastructuretrait.html | 362 ++++ ...src-errorhandlers-throwerrorexception.html | 18 + ...c-errorhandlers-triggerexceptionerror.html | 18 + .../src-interfaces-arrayaccesstrait.html | 18 + doc/files/src-interfaces-countabletrait.html | 18 + ...src-interfaces-iteratoraggregatetrait.html | 18 + doc/files/src-interfaces-iteratortrait.html | 18 + doc/files/src-traits-getter.html | 18 + doc/files/src-traits-overloadinggetter.html | 18 + doc/files/src-traits-overloadingsetter.html | 18 + doc/files/src-traits-setter.html | 18 + doc/files/src-traits-singleton.html | 18 + doc/files/src-traits-typechecker.html | 362 ++++ .../InvalidDataTypeException.php.txt | 39 + .../DataStructures/StrictCollection.php.txt | 168 +- .../src/DataStructures/StrictList.php.txt | 742 +------ .../src/DataStructures/StrictQueue.php.txt | 110 +- .../StrictSplDatastructureTrait.php.txt | 420 ++++ .../src/DataStructures/StrictStack.php.txt | 103 +- .../StrictSplDatastructureTrait.php.txt | 422 ++++ doc/files/src/Traits/TypeChecker.php.txt | 150 ++ doc/graphs/classes.html | 18 + doc/guides/changelog.html | 34 +- doc/guides/index.html | 56 +- doc/guides/overview/datastructures.html | 289 +++ doc/guides/overview/errorhandlers.html | 225 +++ doc/guides/overview/index.html | 76 + doc/guides/overview/interfaces.html | 235 +++ doc/guides/overview/traits.html | 272 +++ doc/guides/usage/index.html | 22 + doc/guides/usage/installation.html | 24 + doc/guides/usage/requirements.html | 18 + doc/index.html | 32 +- doc/indices/files.html | 21 + doc/js/searchIndex.js | 321 ++- doc/namespaces/default.html | 18 + .../occ-basics-datastructures-exceptions.html | 345 ++++ .../occ-basics-datastructures-traits.html | 345 ++++ doc/namespaces/occ-basics-datastructures.html | 27 + doc/namespaces/occ-basics-errorhandlers.html | 18 + doc/namespaces/occ-basics-interfaces.html | 18 + doc/namespaces/occ-basics-traits.html | 20 +- doc/namespaces/occ-basics.html | 18 + doc/namespaces/occ.html | 18 + doc/packages/Basics-DataStructures.html | 30 +- doc/packages/Basics-ErrorHandlers.html | 18 + doc/packages/Basics-Interfaces.html | 18 + doc/packages/Basics-Traits.html | 20 +- doc/packages/Basics.html | 18 + doc/packages/default.html | 18 + doc/reports/deprecated.html | 18 + doc/reports/errors.html | 18 + doc/reports/markers.html | 18 + 90 files changed, 10333 insertions(+), 6321 deletions(-) create mode 100644 .phpdoc/guide/overview/datastructures.rst create mode 100644 .phpdoc/guide/overview/errorhandlers.rst create mode 100644 .phpdoc/guide/overview/interfaces.rst create mode 100644 .phpdoc/guide/overview/traits.rst create mode 100644 doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html create mode 100644 doc/classes/OCC-Basics-DataStructures-StrictSplDatastructureTrait.html create mode 100644 doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html create mode 100644 doc/classes/OCC-Basics-Traits-TypeChecker.html create mode 100644 doc/files/src-datastructures-exceptions-invaliddatatypeexception.html create mode 100644 doc/files/src-datastructures-strictspldatastructuretrait.html create mode 100644 doc/files/src-datastructures-traits-strictspldatastructuretrait.html create mode 100644 doc/files/src-traits-typechecker.html create mode 100644 doc/files/src/DataStructures/Exceptions/InvalidDataTypeException.php.txt create mode 100644 doc/files/src/DataStructures/StrictSplDatastructureTrait.php.txt create mode 100644 doc/files/src/DataStructures/Traits/StrictSplDatastructureTrait.php.txt create mode 100644 doc/files/src/Traits/TypeChecker.php.txt create mode 100644 doc/guides/overview/datastructures.html create mode 100644 doc/guides/overview/errorhandlers.html create mode 100644 doc/guides/overview/interfaces.html create mode 100644 doc/guides/overview/traits.html create mode 100644 doc/namespaces/occ-basics-datastructures-exceptions.html create mode 100644 doc/namespaces/occ-basics-datastructures-traits.html diff --git a/.phpdoc/guide/changelog.rst b/.phpdoc/guide/changelog.rst index ab8d7be..d67317d 100644 --- a/.phpdoc/guide/changelog.rst +++ b/.phpdoc/guide/changelog.rst @@ -3,7 +3,8 @@ Changelog ######### -.. contents:: +.. sidebar:: Table of Contents + .. contents:: v2.0.0 ====== @@ -39,7 +40,9 @@ v2.0.0 * Added new error handler :php:class:`OCC\Basics\ErrorHandlers\TriggerExceptionError` * Added new trait :php:trait:`OCC\Basics\Traits\OverloadingGetter` * Added new trait :php:trait:`OCC\Basics\Traits\OverloadingSetter` -* Extended API for all datastructures +* Added new trait :php:trait:`OCC\Basics\Traits\TypeChecker` +* Extended API for all datastructures (see :php:trait:`OCC\Basics\DataStructures\Traits\StrictSplDatastructureTrait`) +* Introduced :php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException` for strict datastructures * Extended `documentation `_ v1.1.0 diff --git a/.phpdoc/guide/index.rst b/.phpdoc/guide/index.rst index c2a08f9..15f3f49 100644 --- a/.phpdoc/guide/index.rst +++ b/.phpdoc/guide/index.rst @@ -3,11 +3,8 @@ Documentation ############# -.. meta:: - :layout: landingpage - .. toctree:: - :hidden: + :maxdepth: 2 overview/index usage/index diff --git a/.phpdoc/guide/overview/datastructures.rst b/.phpdoc/guide/overview/datastructures.rst new file mode 100644 index 0000000..a8b1b05 --- /dev/null +++ b/.phpdoc/guide/overview/datastructures.rst @@ -0,0 +1,79 @@ +.. title:: Datastructures + +Typed Datastructures +#################### + +.. sidebar:: Table of Contents + .. contents:: + +All datastructures in this package have in common that you can control the types of items they 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 +:php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException`. + + Examples: + + .. code-block:: php + // create a collection of strings + $stringCollection = new StrictCollection(['string']); + + // create a queue of PSR-15 middlewares + $middlewareQueue = new StrictQueue(['Psr\Http\Server\MiddlewareInterface']); + +StrictCollection +================ + +.. sidebar:: API Documentation + :php:class:`OCC\Basics\DataStructures\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 +controlled type. + +A `StrictCollection` can be accessed like an array, but not traversed because it has no particular order. Technically +speaking, `StrictCollection` implements `\ArrayAccess `_, `\Countable +`_ and `\Serializable `_, but no `\Traversable +`_ interface. + +.. note:: + Internally it holds the items in the `$_data` array, the same as most :php:namespace:`OCC\Basics\Interfaces` and + :php:namespace:`OCC\Basics\Traits` of this package. + +StrictList +========== + +.. sidebar:: API Documentation + :php:class:`OCC\Basics\DataStructures\StrictList` + +*A type-sensitive, taversable list of items.* + +Extends `\SplDoublyLinkedList `_ with an option to restrict the allowed data +types for list items. + +StrictQueue +=========== + +.. sidebar:: API Documentation + :php:class:`OCC\Basics\DataStructures\StrictQueue` + +*A type-sensitive, taversable queue (FIFO) of items.* + +Extends `\SplDoublyLinkedList `_ with an option to restrict the allowed data +types for list items. + +StrictStack +=========== + +.. sidebar:: API Documentation + :php:class:`OCC\Basics\DataStructures\StrictStack` + +*A type-sensitive, taversable stack (LIFO) of items.* + +Extends `\SplDoublyLinkedList `_ with an option to restrict the allowed data +types for list items. diff --git a/.phpdoc/guide/overview/errorhandlers.rst b/.phpdoc/guide/overview/errorhandlers.rst new file mode 100644 index 0000000..eb82d53 --- /dev/null +++ b/.phpdoc/guide/overview/errorhandlers.rst @@ -0,0 +1,27 @@ +.. title:: Error Handlers + +Error and Exception Handlers +############################ + +.. sidebar:: Table of Contents + .. contents:: + +ThrowErrorException +=================== + +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. + +> Usage: `set_error_handler(new ThrowErrorException());` + +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());` diff --git a/.phpdoc/guide/overview/index.rst b/.phpdoc/guide/overview/index.rst index abf0d2b..8dc9e06 100644 --- a/.phpdoc/guide/overview/index.rst +++ b/.phpdoc/guide/overview/index.rst @@ -2,3 +2,17 @@ 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. + +.. toctree:: + :maxdepth: 2 + + datastructures + errorhandlers + interfaces + traits diff --git a/.phpdoc/guide/overview/interfaces.rst b/.phpdoc/guide/overview/interfaces.rst new file mode 100644 index 0000000..dcd8357 --- /dev/null +++ b/.phpdoc/guide/overview/interfaces.rst @@ -0,0 +1,35 @@ +.. title:: Interfaces + +Interface Traits +################ + +.. sidebar:: Table of Contents + .. contents:: + +ArrayAccessTrait +================ + +A generic implementation of the ArrayAccess interface. + +Internally it accesses the protected `$_data` array. + +CountableTrait +============== + +A generic implementation of the Countable interface. + +Internally it counts the values of the protected `$_data` array. + +IteratorAggregateTrait +====================== + +A generic implementation of the IteratorAggregate interface. + +Internally it iterates over the protected `$_data` array. + +IteratorTrait +============= + +A generic implementation of the Iterator interface. + +Internally it iterates over the protected `$_data` array. diff --git a/.phpdoc/guide/overview/traits.rst b/.phpdoc/guide/overview/traits.rst new file mode 100644 index 0000000..462083d --- /dev/null +++ b/.phpdoc/guide/overview/traits.rst @@ -0,0 +1,78 @@ +.. title:: Traits + +Traits +###### + +.. sidebar:: Table of Contents + .. contents:: + +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 letter). + +> 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. + +OverloadingGetter +================= + +Overloads a class with readable magic properties. + +Internally it reads the protected `$_data` array whose keys are interpreted +as property names. + +> Example: Reading `Foo->bar` will return the value of `$_data['bar']`. + +OverloadingSetter +================= + +Overloads a class with writable magic properties. + +Internally it writes the protected `$_data` array whose keys are interpreted +as property names. + +> Example: `Foo->bar = 42;` will set `$_data['bar']` to `42`. + +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 letter). + +> 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. + +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 (irrespective of the given arguments). + +In order for this to work as expected, the constructor has to be implemented +as `private` to prevent direct instantiation of the class. + +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 check if a value's data type matches +at least one of these types. diff --git a/.phpdoc/guide/usage/index.rst b/.phpdoc/guide/usage/index.rst index 1ce6e10..831e95d 100644 --- a/.phpdoc/guide/usage/index.rst +++ b/.phpdoc/guide/usage/index.rst @@ -3,8 +3,12 @@ User Guide ########## -.. toctree:: - :maxdepth: 2 +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 :doc:`../overview/index` page. - requirements - installation +.. toctree:: + :maxdepth: 2 + + requirements + installation diff --git a/.phpdoc/guide/usage/installation.rst b/.phpdoc/guide/usage/installation.rst index ad96dc2..9ccec9a 100644 --- a/.phpdoc/guide/usage/installation.rst +++ b/.phpdoc/guide/usage/installation.rst @@ -3,6 +3,9 @@ Installation ############ +.. sidebar:: Table of Contents + .. contents:: + Composer ======== diff --git a/.phpdoc/template/css/custom.css.twig b/.phpdoc/template/css/custom.css.twig index 5dc7e98..e6320d0 100644 --- a/.phpdoc/template/css/custom.css.twig +++ b/.phpdoc/template/css/custom.css.twig @@ -40,6 +40,8 @@ aside.phpdocumentor-sidebar padding: 0 var(--spacing-md) !important; } +p > code, +li > code, code.prettyprint { background-color: var(--code-background-color); @@ -50,6 +52,38 @@ code.prettyprint padding: var(--spacing-xxxs); } +@media (max-width: 999px) { +div.admonition-wrapper +{ + display: none; +} +} + +@media (min-width: 1000px) { +div.admonition-wrapper +{ + display: block; + float: right; + padding: var(--spacing-md); + margin: 0 0 var(--spacing-md) var(--spacing-md); + width: auto; + font-size: var(--text-sm); + border: 1px solid var(--primary-color-lighten); +} +} + +div.admonition-wrapper + p.sidebar-title +{ + font-weight: bold; +} + +div.contents + ul.phpdocumentor-list +{ + margin-bottom: 0; +} + div.phpdocumentor-content div.section ul diff --git a/.phpdoc/template/index.html.twig b/.phpdoc/template/index.html.twig index 3c519ac..01d4ee9 100644 --- a/.phpdoc/template/index.html.twig +++ b/.phpdoc/template/index.html.twig @@ -10,10 +10,10 @@

A collection of generic classes and useful traits for PHP projects.

-

The package currently contains classes for type-sensitive - data structures, error and exception handlers, multiple - traits implementing standard interfaces, and more generic - traits for common use cases. They share the same design principles +

The package currently contains classes for type-sensitive + data structures, error and exception handlers, multiple + traits implementing standard interfaces, and more generic + traits for common use cases. They share the same design principles like property and method naming schema, 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.

diff --git a/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html b/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html new file mode 100644 index 0000000..f38cfb6 --- /dev/null +++ b/doc/classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html @@ -0,0 +1,396 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
+

PHP Basics

+ + + + + + +
+ +
+
+ + + + +
+
+ + +
+

+ InvalidDataTypeException + + + extends DomainException + + +
+ in package + +
+ + +

+ +
+ + +
+ + + +

Common exception for type-sensitive datastructures.

+ +

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

+
+ + +
+ Tags + + +
+
+
+ author +
+
+ +

Sebastian Meyer sebastian.meyer@opencultureconsulting.com

+
+ +
+
+ + + +

+ Table of Contents + + +

+ + + + + + + + + + + + + + + + + + + +
+
+
+
+

+        
+ +
+
+ + + +
+
+
+ +
+ On this page + +
    +
  • Table Of Contents
  • +
  • +
      +
    +
  • + + +
+
+ +
+
+
+
+
+

Search results

+ +
+
+
    +
    +
    +
    +
    + + +
    + + + + + + + + diff --git a/doc/classes/OCC-Basics-DataStructures-StrictCollection.html b/doc/classes/OCC-Basics-DataStructures-StrictCollection.html index a73c5a9..e724b8b 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictCollection.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictCollection.html @@ -76,6 +76,24 @@

    Overview

    +

    User Guide @@ -175,7 +193,7 @@ Uses - ArrayAccessTrait, CountableTrait, Getter + ArrayAccessTrait, CountableTrait, TypeChecker

    @@ -186,9 +204,9 @@

    A type-sensitive, unsorted collection.

    @@ -250,19 +268,6 @@ names.

    -

    - Properties - - -

    -
    -
    - $allowedTypes - -  : array<string|int, string> -
    - -

    Methods @@ -277,26 +282,12 @@ names.

    Create a type-sensitive collection of items.
    -
    - __get() - -  : mixed -
    -
    Read data from an inaccessible property.
    - -
    - __isset() - -  : bool -
    -
    Check if an inaccessible property is set and not empty.
    -
    add()  : void
    -
    Add/insert a new item at the specified index.
    +
    Add/insert a item at the specified index.
    clear() @@ -315,23 +306,30 @@ names.

    get() -  : AllowedType|null +  : AllowedType
    Get the item at the specified index.
    - getAllowedTypes() + getAllowedTypes()  : array<string|int, string>
    -
    Get allowed data types for collection items.
    +
    Get allowed data types.
    - isAllowedType() + hasAllowedType()  : bool
    -
    Check if the item's data type is allowed in the collection.
    +
    Check if a value's data type is allowed.
    + +
    + isAllowedType() + +  : bool +
    +
    Check if a data type is allowed.
    isEmpty() @@ -396,6 +394,13 @@ names.

    Set an item at the specified index.
    +
    + setAllowedTypes() + +  : void +
    +
    Set allowed data types.
    +
    toArray() @@ -417,13 +422,6 @@ names.

    Restore $this from string representation.
    -
    - setAllowedTypes() - -  : void -
    -
    Set allowed data types of collection items.
    - @@ -432,49 +430,6 @@ names.

    -
    -

    - Properties - - -

    -
    -

    - $allowedTypes - - - - read-only -

    - - - - - public - array<string|int, string> - $allowedTypes - - -

    The allowed data types for items.

    -
    - - - - -
    -

    @@ -496,9 +451,9 @@ names.

    Create a type-sensitive collection of items.

    @@ -560,129 +515,6 @@ Possible values are:

    - -
    -

    - __get() - - -

    - - -

    Read data from an inaccessible property.

    - - - public - __get(string $property) : mixed - -
    -
    - -
    Parameters
    -
    -
    - $property - : string -
    -
    -

    The class property to get

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - InvalidArgumentException - -

    if the property or getter method do not exist

    -
    - -
    -
    - -
    -
    Return values
    - mixed - — -

    The class property's current value

    -
    - -
    - -
    -
    -

    - __isset() - - -

    - - -

    Check if an inaccessible property is set and not empty.

    - - - public - __isset(string $property) : bool - -
    -
    - -
    Parameters
    -
    -
    - $property - : string -
    -
    -

    The class property to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the class property is set and not empty

    -
    - -
    -
    StrictCollection.php : - 121 + 94 - + -

    Add/insert a new item at the specified index.

    +

    Add/insert a item at the specified index.

    public @@ -721,7 +553,7 @@ Possible values are:

    : string|int
    -

    The new item's index

    +

    The item's index

    @@ -730,7 +562,7 @@ Possible values are:

    : AllowedType
    -

    The new item

    +

    The item

    @@ -747,9 +579,9 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException -

    if $offset is not of allowed type

    +

    if $value is not of allowed type

    @@ -771,9 +603,9 @@ Possible values are:

    Clear the collection of any items.

    @@ -849,16 +681,16 @@ Possible values are:

    Get the item at the specified index.

    public - get(string|int $offset) : AllowedType|null + get(string|int $offset) : AllowedType
    APIYes
    @@ -879,12 +711,29 @@ Possible values are:

    +
    + Tags + + +
    +
    +
    + throws +
    +
    + OutOfRangeException + +

    when $offset is out of bounds

    +
    + +
    +
    Return values
    - AllowedType|null + AllowedType — -

    The item or NULL if key is invalid

    +

    The item

    @@ -898,18 +747,18 @@ Possible values are:

    >

    getAllowedTypes() - +

    -

    Get allowed data types for collection items.

    +

    Get allowed data types.

    public @@ -939,24 +788,24 @@ Possible values are:

    -public " > -

    - isAllowedType() - +

    + hasAllowedType() +

    -

    Check if the item's data type is allowed in the collection.

    +

    Check if a value's data type is allowed.

    public - isAllowedType(AllowedType $value) : bool + hasAllowedType(mixed $value) : bool
    APIYes
    @@ -967,10 +816,10 @@ Possible values are:

    $value - : AllowedType + : mixed
    -

    The item to check

    +

    The value to check

    @@ -982,7 +831,62 @@ Possible values are:

    Return values
    bool — -

    Whether the item's data type is allowed

    +

    Whether the value's data type is allowed

    +
    + +
    + +
    +
    +

    + isAllowedType() + + +

    + + +

    Check if a data type is allowed.

    + + + public + isAllowedType(string $type) : bool + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $type + : string +
    +
    +

    The type to check

    +
    + +
    +
    + + + +
    +
    Return values
    + bool + — +

    Whether the data type is allowed

    @@ -1002,9 +906,9 @@ Possible values are:

    Check if collection is empty.

    @@ -1045,9 +949,9 @@ Possible values are:

    Check if this collection can be considered a list.

    @@ -1216,9 +1120,9 @@ from 0.

    Set the item at the specified offset.

    @@ -1264,10 +1168,20 @@ from 0.

    throws
    +
    + InvalidDataTypeException + +

    if $value is not of allowed type

    +
    + +
    +
    + throws +
    InvalidArgumentException -

    if $offset or $value is not of allowed type

    +

    if $offset is not a valid array key

    @@ -1336,9 +1250,9 @@ from 0.

    Remove an item from the collection.

    @@ -1366,6 +1280,23 @@ from 0.

    +
    + Tags + + +
    +
    +
    + throws +
    +
    + OutOfRangeException + +

    when $offset is out of bounds

    +
    + +
    +
    @@ -1383,9 +1314,9 @@ from 0.

    Get string representation of $this.

    @@ -1424,9 +1355,9 @@ from 0.

    Set an item at the specified index.

    @@ -1473,7 +1404,7 @@ from 0.

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -1482,6 +1413,70 @@ from 0.

    + +
    +

    + setAllowedTypes() + + +

    + + +

    Set allowed data types.

    + + + public + setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $allowedTypes + : array<string|int, string> + = []
    +
    +

    Allowed data types

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if any value of $allowedTypes is not a string

    +
    + +
    +
    + +
    0.

    Return array representation of collection.

    @@ -1540,9 +1535,9 @@ from 0.

    Turn collection into a type-sensitive list.

    @@ -1608,9 +1603,9 @@ from 0.

    Restore $this from string representation.

    @@ -1638,68 +1633,6 @@ from 0.

    -
    -
    -

    - setAllowedTypes() - - -

    - - -

    Set allowed data types of collection items.

    - - - protected - setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void - -
    -
    - -
    Parameters
    -
    -
    - $allowedTypes - : array<string|int, string> - = []
    -
    -

    Allowed data types of items

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - InvalidArgumentException - -

    if any value of $allowedTypes is not a string

    -
    - -
    -
    - -

    @@ -1806,30 +1739,22 @@ from 0.

  • Table Of Contents
  • -
  • Properties
  • -
  • - -
  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictList.html b/doc/classes/OCC-Basics-DataStructures-StrictList.html index 72bc23b..efe5989 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictList.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictList.html @@ -76,6 +76,24 @@

    Overview

    +

    User Guide @@ -172,13 +190,10 @@

    - - implements - ArrayAccess, Countable, Iterator, Serializable Uses - Getter + StrictSplDatastructureTrait
    @@ -189,9 +204,9 @@

    A type-sensitive, taversable list.

    @@ -238,32 +253,12 @@ constructor with an array of atomic types or fully qualified class names.

    -

    - Interfaces - - -

    -
    -
    ArrayAccess
    Countable
    Iterator
    Serializable
    -

    - Properties - - -

    -
    -
    - $allowedTypes - -  : array<string|int, string> -
    - -

    Methods @@ -272,257 +267,103 @@ constructor with an array of atomic types or fully qualified class names.

    - __construct() + __construct()  : void
    Create a type-sensitive, traversable list of items.
    - __get() - -  : mixed -
    -
    Read data from an inaccessible property.
    - -
    - __isset() - -  : bool -
    -
    Check if an inaccessible property is set and not empty.
    - -
    - add() + add()  : void
    Add/insert a new item at the specified offset.
    - append() + append()  : void
    Append items at the end of the list.
    - bottom() - -  : AllowedType -
    -
    Peek at the item at the beginning of the list.
    - -
    - clear() + clear()  : void
    Clear the list of any items.
    - count() + get() -  : int -
    -
    Get the number of items on the list.
    - -
    - current() - -  : AllowedType -
    -
    Get the current list item.
    - -
    - get() - -  : AllowedType +  : AllowedType
    Get the item at the specified index.
    - getAllowedTypes() - -  : array<string|int, string> -
    -
    Get allowed data types for list items.
    - -
    - getIteratorMode() - -  : int -
    -
    Get the mode of iteration.
    - -
    - isAllowedType() - -  : bool -
    -
    Check if the item's data type is allowed on the list.
    - -
    - isEmpty() - -  : bool -
    -
    Check if list is empty.
    - -
    - isList() + isList()  : true
    Check if this can be considered a list.
    - key() - -  : int -
    -
    Get the current list index.
    - -
    - next() - -  : void -
    -
    Move the cursor to the next list index.
    - -
    - offsetExists() - -  : bool -
    -
    Check if the specified index exists and is not empty.
    - -
    - offsetGet() - -  : AllowedType -
    -
    Get the item from the specified index.
    - -
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - offsetUnset() - -  : void -
    -
    Unset the item at the specified index.
    - -
    - pop() - -  : AllowedType -
    -
    Pops an item from the end of the list.
    - -
    - prepend() + prepend()  : void
    Prepend items at the start of the list.
    - prev() - -  : void -
    -
    Move the cursor to the previous list index.
    - -
    - push() + push()  : void
    Push an item at the end of the list.
    - remove() + remove()  : void
    Remove an item from the list.
    - rewind() - -  : void -
    -
    Rewind the iterator's cursor.
    - -
    - set() + set()  : void
    Set an item at the specified index.
    - setIteratorMode() + toArray() -  : int -
    -
    Set the mode of iteration.
    - -
    - shift() - -  : AllowedType -
    -
    Shift an item from the beginning of the list.
    - -
    - toArray() - -  : array<string|int, AllowedType> +  : array<int, AllowedType>
    Return array representation of list.
    - top() + toStrictCollection() -  : AllowedType -
    -
    Peek at the item at the end of the list.
    - -
    - toStrictCollection() - -  : StrictCollection<string|int, AllowedType> +  : StrictCollection<string|int, AllowedType>
    Turn list into a type-sensitive collection.
    - unshift() + unshift()  : void
    Prepend the list with an item.
    -
    - valid() - -  : bool -
    -
    Check if current cursor position is valid.
    - -
    - setAllowedTypes() - -  : void -
    -
    Set allowed data types of list items.
    -
    @@ -531,49 +372,6 @@ constructor with an array of atomic types or fully qualified class names.

    -
    -

    - Properties - - -

    -
    -

    - $allowedTypes - - - - read-only -

    - - - - - public - array<string|int, string> - $allowedTypes - - -

    The allowed data types for values.

    -
    - - - - -
    -

    @@ -589,15 +387,15 @@ constructor with an array of atomic types or fully qualified class names.

    >

    __construct() - +

    Create a type-sensitive, traversable list of items.

    @@ -642,7 +440,7 @@ Possible values are:

    Tags - +
    @@ -659,129 +457,6 @@ Possible values are:

    - -
    -

    - __get() - - -

    - - -

    Read data from an inaccessible property.

    - - - public - __get(string $property) : mixed - -
    -
    - -
    Parameters
    -
    -
    - $property - : string -
    -
    -

    The class property to get

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - InvalidArgumentException - -

    if the property or getter method do not exist

    -
    - -
    -
    - -
    -
    Return values
    - mixed - — -

    The class property's current value

    -
    - -
    - -
    -
    -

    - __isset() - - -

    - - -

    Check if an inaccessible property is set and not empty.

    - - - public - __isset(string $property) : bool - -
    -
    - -
    Parameters
    -
    -
    - $property - : string -
    -
    -

    The class property to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the class property is set and not empty

    -
    - -
    -
    add() - +

    Add/insert a new item at the specified offset.

    public - add(int $offset, AllowedType $value) : void + add(int $offset, AllowedType $value) : void
    APIYes
    @@ -826,7 +501,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The new item for the offset

    @@ -838,7 +513,7 @@ Possible values are:

    Tags - +
    @@ -846,7 +521,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -874,22 +549,22 @@ Possible values are:

    >

    append() - +

    Append items at the end of the list.

    public - append(AllowedType ...$values) : void + append(AllowedType ...$values) : void
    APIYes
    @@ -900,7 +575,7 @@ Possible values are:

    $values - : AllowedType + : AllowedType

    One or more items to append

    @@ -912,7 +587,7 @@ Possible values are:

    Tags - +
    @@ -920,7 +595,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if any $values is not of allowed type

    @@ -929,66 +604,6 @@ Possible values are:

    -
    -
    -

    - bottom() - - -

    - - -

    Peek at the item at the beginning of the list.

    - - - public - bottom() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The first item of the list

    -
    - -
    -
    -
    -

    - count() - - -

    - - -

    Get the number of items on the list.

    - - - public - count() : int - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - int - — -

    The number of items on the list

    -
    - -
    - -
    -
    -

    - current() - - -

    - - -

    Get the current list item.

    - - - public - current() : AllowedType - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - AllowedType - — -

    The current item

    -
    - -
    -
    get() - +

    Get the item at the specified index.

    public - get(int $offset) : AllowedType + get(int $offset) : AllowedType
    APIYes
    @@ -1157,7 +686,7 @@ Possible values are:

    Tags - +
    @@ -1175,197 +704,13 @@ Possible values are:

    Return values
    - AllowedType + AllowedType

    The item

    -
    -
    -

    - getAllowedTypes() - - -

    - - -

    Get allowed data types for list items.

    - - - public - getAllowedTypes() : array<string|int, string> - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - array<string|int, string> - — -

    The list of allowed data types

    -
    - -
    - -
    -
    -

    - getIteratorMode() - - -

    - - -

    Get the mode of iteration.

    - - - public - getIteratorMode() : int - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - int - — -

    The set of flags and modes of iteration

    -
    - -
    - -
    -
    -

    - isAllowedType() - - -

    - - -

    Check if the item's data type is allowed on the list.

    - - - public - isAllowedType(AllowedType $value) : bool - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $value - : AllowedType -
    -
    -

    The item to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the item's data type is allowed

    -
    - -
    - -
    -
    -

    - isEmpty() - - -

    - - -

    Check if list is empty.

    - - - public - isEmpty() : bool - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - bool - — -

    Whether the list contains no items

    -
    - -
    -
    - -
    -

    - key() - - -

    - - -

    Get the current list index.

    - - - public - key() : int - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - int - — -

    The current list index

    -
    - -
    - -
    -
    -

    - next() - - -

    - - -

    Move the cursor to the next list index.

    - - - public - next() : void - -
    -
    APIYes
    - -
    - - - - - -
    -
    -

    - offsetExists() - - -

    - - -

    Check if the specified index exists and is not empty.

    - - - public - offsetExists(int $offset) : bool - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $offset - : int -
    -
    -

    The index to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the index exists and is not empty

    -
    - -
    - -
    -
    -

    - offsetGet() - - -

    - - -

    Get the item from the specified index.

    - - - public - offsetGet(int $offset) : AllowedType - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $offset - : int -
    -
    -

    The item's index

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - OutOfRangeException - -

    when $offset is out of bounds

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The item

    -
    - -
    -
    offsetSet() - +

    Set the item at the specified offset.

    public - offsetSet(int|null $offset, AllowedType $value) : void + offsetSet(int|null $offset, AllowedType $value) : void
    APIYes
    @@ -1658,7 +798,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The new item for the offset

    @@ -1670,7 +810,7 @@ Possible values are:

    Tags - +
    @@ -1678,7 +818,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -1697,130 +837,6 @@ Possible values are:

    -
    -
    -

    - offsetUnset() - - -

    - - -

    Unset the item at the specified index.

    - - - public - offsetUnset(int $offset) : void - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $offset - : int -
    -
    -

    The item's index

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - OutOfRangeException - -

    when $offset is out of bounds

    -
    - -
    -
    - - -
    -
    -

    - pop() - - -

    - - -

    Pops an item from the end of the list.

    - - - public - pop() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The item from the end of the list

    -
    - -
    -
    prepend() - +

    Prepend items at the start of the list.

    public - prepend(AllowedType ...$values) : void + prepend(AllowedType ...$values) : void
    APIYes
    @@ -1856,7 +872,7 @@ Possible values are:

    $values - : AllowedType + : AllowedType

    One or more items to prepend

    @@ -1868,7 +884,7 @@ Possible values are:

    Tags - +
    @@ -1876,7 +892,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -1885,41 +901,6 @@ Possible values are:

    -
    -
    -

    - prev() - - -

    - - -

    Move the cursor to the previous list index.

    - - - public - prev() : void - -
    -
    APIYes
    - -
    - - - - -
    push() - +

    Push an item at the end of the list.

    public - push(AllowedType $value) : void + push(AllowedType $value) : void
    APIYes
    @@ -1955,7 +936,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The item to push

    @@ -1967,7 +948,7 @@ Possible values are:

    Tags - +
    @@ -1975,7 +956,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -1993,15 +974,15 @@ Possible values are:

    >

    remove() - +

    Remove an item from the list.

    @@ -2031,7 +1012,7 @@ Possible values are:

    Tags - +
    @@ -2048,41 +1029,6 @@ Possible values are:

    -
    -
    -

    - rewind() - - -

    - - -

    Rewind the iterator's cursor.

    - - - public - rewind() : void - -
    -
    APIYes
    - -
    - - - - -
    set() - +

    Set an item at the specified index.

    public - set(int $offset, AllowedType $value) : void + set(int $offset, AllowedType $value) : void
    APIYes
    @@ -2127,7 +1073,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The item

    @@ -2139,7 +1085,7 @@ Possible values are:

    Tags - +
    @@ -2147,7 +1093,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -2156,150 +1102,6 @@ Possible values are:

    -
    -
    -

    - setIteratorMode() - - -

    - - -

    Set the mode of iteration.

    - - - public - setIteratorMode(int $mode) : int - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $mode - : int -
    -
    -

    The new iterator mode (0, 1, 2 or 3)

    -

    There are two orthogonal sets of modes that can be set.

    -

    The direction of iteration (either one or the other):

    -
      -
    • StrictList::IT_MODE_FIFO (queue style)
    • -
    • StrictList::IT_MODE_LIFO (stack style)
    • -
    -

    The behavior of the iterator (either one or the other):

    -
      -
    • StrictList::IT_MODE_DELETE (delete items)
    • -
    • StrictList::IT_MODE_KEEP (keep items)
    • -
    -

    The default mode is: IT_MODE_FIFO | IT_MODE_KEEP

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RangeException - -

    if an invalid $mode is given

    -
    - -
    -
    - -
    -
    Return values
    - int - — -

    The set of flags and modes of iteration

    -
    - -
    - -
    -
    -

    - shift() - - -

    - - -

    Shift an item from the beginning of the list.

    - - - public - shift() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The first item of the list

    -
    - -
    -
    toArray() - +

    Return array representation of list.

    public - toArray() : array<string|int, AllowedType> + toArray() : array<int, AllowedType>
    APIYes
    @@ -2336,73 +1138,13 @@ Possible values are:

    Return values
    - array<string|int, AllowedType> + array<int, AllowedType>

    Array of list items

    -
    -
    -

    - top() - - -

    - - -

    Peek at the item at the end of the list.

    - - - public - top() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The last item of the list

    -
    - -
    -
    toStrictCollection() - +

    Turn list into a type-sensitive collection.

    public - toStrictCollection() : StrictCollection<string|int, AllowedType> + toStrictCollection() : StrictCollection<string|int, AllowedType>
    APIYes
    @@ -2439,7 +1181,7 @@ Possible values are:

    Return values
    - StrictCollection<string|int, AllowedType> + StrictCollection<string|int, AllowedType>

    A type-sensitive collection of the list's items

    @@ -2455,22 +1197,22 @@ Possible values are:

    >

    unshift() - +

    Prepend the list with an item.

    public - unshift(AllowedType $value) : void + unshift(AllowedType $value) : void
    APIYes
    @@ -2481,7 +1223,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The item to unshift

    @@ -2493,7 +1235,7 @@ Possible values are:

    Tags - +
    @@ -2501,7 +1243,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -2510,111 +1252,6 @@ Possible values are:

    -
    -
    -

    - valid() - - -

    - - -

    Check if current cursor position is valid.

    - - - public - valid() : bool - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - bool - — -

    Whether the current cursor position is valid

    -
    - -
    - -
    -
    -

    - setAllowedTypes() - - -

    - - -

    Set allowed data types of list items.

    - - - protected - setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void - -
    -
    - -
    Parameters
    -
    -
    - $allowedTypes - : array<string|int, string> - = []
    -
    -

    Allowed data types of items

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - InvalidArgumentException - -

    if any value of $allowedTypes is not a string

    -
    - -
    -
    - -
    @@ -2721,57 +1358,28 @@ Possible values are:

  • Table Of Contents
  • -
  • Properties
  • -
  • - -
  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictQueue.html b/doc/classes/OCC-Basics-DataStructures-StrictQueue.html index 414e310..96e4fab 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictQueue.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictQueue.html @@ -76,6 +76,24 @@

    Overview

    +

    User Guide @@ -161,7 +179,7 @@ StrictQueue - extends StrictList + extends SplQueue
    @@ -172,10 +190,10 @@
    - - implements - ArrayAccess, Countable, Iterator, Serializable + + Uses + StrictSplDatastructureTrait

    @@ -186,18 +204,16 @@

    A type-sensitive, taversable queue (FIFO).

    -

    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. It -also restricts the iterator direction to first-in, first-out (FIFO) exactly -like \SplQueue.

    +

    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.

    @@ -237,32 +253,12 @@ like \SplQueue.

    -

    - Interfaces - - -

    -
    -
    ArrayAccess
    Countable
    Iterator
    Serializable
    -

    - Properties - - -

    -
    -
    - $allowedTypes - -  : array<string|int, string> -
    - -

    Methods @@ -271,75 +267,33 @@ like \SplQueue.

    - __construct() + __construct()  : void
    -
    Create a type-sensitive, traversable queue of items.
    +
    Create a type-sensitive, traversable list of items.
    - __get() - -  : mixed -
    -
    Read data from an inaccessible property.
    - -
    - __isset() - -  : bool -
    -
    Check if an inaccessible property is set and not empty.
    - -
    - add() + add()  : void
    Add/insert a new item at the specified offset.
    - append() + append()  : void
    Append items at the end of the list.
    - bottom() - -  : AllowedType -
    -
    Peek at the item at the beginning of the list.
    - -
    - clear() + clear()  : void
    Clear the list of any items.
    -
    - count() - -  : int -
    -
    Get the number of items on the list.
    - -
    - current() - -  : AllowedType -
    -
    Get the current list item.
    - -
    - dequeue() - -  : AllowedType -
    -
    Dequeue an item from the queue.
    -
    enqueue() @@ -348,194 +302,75 @@ like \SplQueue.

    Add an item to the queue.
    - get() + get() -  : AllowedType +  : AllowedType
    Get the item at the specified index.
    - getAllowedTypes() - -  : array<string|int, string> -
    -
    Get allowed data types for list items.
    - -
    - getIteratorMode() - -  : int -
    -
    Get the mode of iteration.
    - -
    - isAllowedType() - -  : bool -
    -
    Check if the item's data type is allowed on the list.
    - -
    - isEmpty() - -  : bool -
    -
    Check if list is empty.
    - -
    - isList() + isList()  : true
    Check if this can be considered a list.
    - key() - -  : int -
    -
    Get the current list index.
    - -
    - next() - -  : void -
    -
    Move the cursor to the next list index.
    - -
    - offsetExists() - -  : bool -
    -
    Check if the specified index exists and is not empty.
    - -
    - offsetGet() - -  : AllowedType -
    -
    Get the item from the specified index.
    - -
    - offsetSet() + offsetSet()  : void
    Set the item at the specified offset.
    - offsetUnset() - -  : void -
    -
    Unset the item at the specified index.
    - -
    - pop() - -  : AllowedType -
    -
    Pops an item from the end of the list.
    - -
    - prepend() + prepend()  : void
    Prepend items at the start of the list.
    - prev() - -  : void -
    -
    Move the cursor to the previous list index.
    - -
    - push() + push()  : void
    Push an item at the end of the list.
    - remove() + remove()  : void
    Remove an item from the list.
    - rewind() - -  : void -
    -
    Rewind the iterator's cursor.
    - -
    - set() + set()  : void
    Set an item at the specified index.
    - setIteratorMode() + toArray() -  : int -
    -
    Set the mode of iteration.
    - -
    - shift() - -  : AllowedType -
    -
    Shift an item from the beginning of the list.
    - -
    - toArray() - -  : array<string|int, AllowedType> +  : array<int, AllowedType>
    Return array representation of list.
    - top() + toStrictCollection() -  : AllowedType -
    -
    Peek at the item at the end of the list.
    - -
    - toStrictCollection() - -  : StrictCollection<string|int, AllowedType> +  : StrictCollection<string|int, AllowedType>
    Turn list into a type-sensitive collection.
    - unshift() + unshift()  : void
    Prepend the list with an item.
    -
    - valid() - -  : bool -
    -
    Check if current cursor position is valid.
    - -
    - setAllowedTypes() - -  : void -
    -
    Set allowed data types of list items.
    -
    @@ -544,49 +379,6 @@ like \SplQueue.

    -
    -

    - Properties - - -

    -
    -

    - $allowedTypes - - - - read-only -

    - - - - - public - array<string|int, string> - $allowedTypes - - -

    The allowed data types for values.

    -
    - - - - -
    -

    @@ -602,18 +394,18 @@ like \SplQueue.

    >

    __construct() - +

    -

    Create a type-sensitive, traversable queue of items.

    +

    Create a type-sensitive, traversable list of items.

    public @@ -655,7 +447,7 @@ Possible values are:

    Tags - +
    @@ -672,129 +464,6 @@ Possible values are:

    - -
    -

    - __get() - - -

    - - -

    Read data from an inaccessible property.

    - - - public - __get(string $property) : mixed - -
    -
    - -
    Parameters
    -
    -
    - $property - : string -
    -
    -

    The class property to get

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - InvalidArgumentException - -

    if the property or getter method do not exist

    -
    - -
    -
    - -
    -
    Return values
    - mixed - — -

    The class property's current value

    -
    - -
    - -
    -
    -

    - __isset() - - -

    - - -

    Check if an inaccessible property is set and not empty.

    - - - public - __isset(string $property) : bool - -
    -
    - -
    Parameters
    -
    -
    - $property - : string -
    -
    -

    The class property to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the class property is set and not empty

    -
    - -
    -
    add() - +

    Add/insert a new item at the specified offset.

    public - add(int $offset, AllowedType $value) : void + add(int $offset, AllowedType $value) : void
    APIYes
    @@ -839,7 +508,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The new item for the offset

    @@ -851,7 +520,7 @@ Possible values are:

    Tags - +
    @@ -859,7 +528,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -887,22 +556,22 @@ Possible values are:

    >

    append() - +

    Append items at the end of the list.

    public - append(AllowedType ...$values) : void + append(AllowedType ...$values) : void
    APIYes
    @@ -913,7 +582,7 @@ Possible values are:

    $values - : AllowedType + : AllowedType

    One or more items to append

    @@ -925,7 +594,7 @@ Possible values are:

    Tags - +
    @@ -933,7 +602,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if any $values is not of allowed type

    @@ -942,66 +611,6 @@ Possible values are:

    -
    -
    -

    - bottom() - - -

    - - -

    Peek at the item at the beginning of the list.

    - - - public - bottom() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The first item of the list

    -
    - -
    -
    -
    -

    - count() - - -

    - - -

    Get the number of items on the list.

    - - - public - count() : int - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - int - — -

    The number of items on the list

    -
    - -
    - -
    -
    -

    - current() - - -

    - - -

    Get the current list item.

    - - - public - current() : AllowedType - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - AllowedType - — -

    The current item

    -
    - -
    - -
    -
    -

    - dequeue() - - -

    - - -

    Dequeue an item from the queue.

    - - - public - dequeue() : AllowedType - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - AllowedType - — -

    The dequeued item

    -
    - -
    -
    StrictQueue.php : - 80 + 61 - +

    Add an item to the queue.

    @@ -1221,7 +701,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -1239,22 +719,22 @@ Possible values are:

    >

    get() - +

    Get the item at the specified index.

    public - get(int $offset) : AllowedType + get(int $offset) : AllowedType
    APIYes
    @@ -1277,7 +757,7 @@ Possible values are:

    Tags - +
    @@ -1295,197 +775,13 @@ Possible values are:

    Return values
    - AllowedType + AllowedType

    The item

    -
    -
    -

    - getAllowedTypes() - - -

    - - -

    Get allowed data types for list items.

    - - - public - getAllowedTypes() : array<string|int, string> - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - array<string|int, string> - — -

    The list of allowed data types

    -
    - -
    - -
    -
    -

    - getIteratorMode() - - -

    - - -

    Get the mode of iteration.

    - - - public - getIteratorMode() : int - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - int - — -

    The set of flags and modes of iteration

    -
    - -
    - -
    -
    -

    - isAllowedType() - - -

    - - -

    Check if the item's data type is allowed on the list.

    - - - public - isAllowedType(AllowedType $value) : bool - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $value - : AllowedType -
    -
    -

    The item to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the item's data type is allowed

    -
    - -
    - -
    -
    -

    - isEmpty() - - -

    - - -

    Check if list is empty.

    - - - public - isEmpty() : bool - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - bool - — -

    Whether the list contains no items

    -
    - -
    -
    - -
    -

    - key() - - -

    - - -

    Get the current list index.

    - - - public - key() : int - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - int - — -

    The current list index

    -
    - -
    - -
    -
    -

    - next() - - -

    - - -

    Move the cursor to the next list index.

    - - - public - next() : void - -
    -
    APIYes
    - -
    - - - - - -
    -
    -

    - offsetExists() - - -

    - - -

    Check if the specified index exists and is not empty.

    - - - public - offsetExists(int $offset) : bool - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $offset - : int -
    -
    -

    The index to check

    -
    - -
    -
    - - - -
    -
    Return values
    - bool - — -

    Whether the index exists and is not empty

    -
    - -
    - -
    -
    -

    - offsetGet() - - -

    - - -

    Get the item from the specified index.

    - - - public - offsetGet(int $offset) : AllowedType - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $offset - : int -
    -
    -

    The item's index

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - OutOfRangeException - -

    when $offset is out of bounds

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The item

    -
    - -
    -
    offsetSet() - +

    Set the item at the specified offset.

    public - offsetSet(int|null $offset, AllowedType $value) : void + offsetSet(int|null $offset, AllowedType $value) : void
    APIYes
    @@ -1778,7 +869,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The new item for the offset

    @@ -1790,7 +881,7 @@ Possible values are:

    Tags - +
    @@ -1798,7 +889,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -1817,130 +908,6 @@ Possible values are:

    -
    -
    -

    - offsetUnset() - - -

    - - -

    Unset the item at the specified index.

    - - - public - offsetUnset(int $offset) : void - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $offset - : int -
    -
    -

    The item's index

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - OutOfRangeException - -

    when $offset is out of bounds

    -
    - -
    -
    - - -
    -
    -

    - pop() - - -

    - - -

    Pops an item from the end of the list.

    - - - public - pop() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The item from the end of the list

    -
    - -
    -
    prepend() - +

    Prepend items at the start of the list.

    public - prepend(AllowedType ...$values) : void + prepend(AllowedType ...$values) : void
    APIYes
    @@ -1976,7 +943,7 @@ Possible values are:

    $values - : AllowedType + : AllowedType

    One or more items to prepend

    @@ -1988,7 +955,7 @@ Possible values are:

    Tags - +
    @@ -1996,7 +963,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -2005,41 +972,6 @@ Possible values are:

    -
    -
    -

    - prev() - - -

    - - -

    Move the cursor to the previous list index.

    - - - public - prev() : void - -
    -
    APIYes
    - -
    - - - - -
    push() - +

    Push an item at the end of the list.

    public - push(AllowedType $value) : void + push(AllowedType $value) : void
    APIYes
    @@ -2075,7 +1007,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The item to push

    @@ -2087,7 +1019,7 @@ Possible values are:

    Tags - +
    @@ -2095,7 +1027,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -2113,15 +1045,15 @@ Possible values are:

    >

    remove() - +

    Remove an item from the list.

    @@ -2151,7 +1083,7 @@ Possible values are:

    Tags - +
    @@ -2168,41 +1100,6 @@ Possible values are:

    -
    -
    -

    - rewind() - - -

    - - -

    Rewind the iterator's cursor.

    - - - public - rewind() : void - -
    -
    APIYes
    - -
    - - - - -
    set() - +

    Set an item at the specified index.

    public - set(int $offset, AllowedType $value) : void + set(int $offset, AllowedType $value) : void
    APIYes
    @@ -2247,7 +1144,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The item

    @@ -2259,7 +1156,7 @@ Possible values are:

    Tags - +
    @@ -2267,7 +1164,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -2276,159 +1173,6 @@ Possible values are:

    -
    -
    -

    - setIteratorMode() - - -

    - - -

    Set the mode of iteration.

    - - - public - final setIteratorMode(int $mode) : int - -
    -
    APIYes
    - -
    - -
    Parameters
    -
    -
    - $mode - : int -
    -
    -

    The new iterator mode (0 or 1)

    -

    There are two orthogonal sets of modes that can be set.

    -

    The direction of iteration (fixed for StrictQueue):

    -
      -
    • StrictQueue::IT_MODE_FIFO (queue style)
    • -
    -

    The behavior of the iterator (either one or the other):

    -
      -
    • StrictQueue::IT_MODE_DELETE (delete items)
    • -
    • StrictQueue::IT_MODE_KEEP (keep items)
    • -
    -

    The default mode is: IT_MODE_FIFO | IT_MODE_KEEP

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RangeException - -

    if an invalid $mode is given

    -
    - -
    -
    - throws -
    -
    - RuntimeException - -

    if trying to change iterator direction

    -
    - -
    -
    - -
    -
    Return values
    - int - — -

    The set of flags and modes of iteration

    -
    - -
    - -
    -
    -

    - shift() - - -

    - - -

    Shift an item from the beginning of the list.

    - - - public - shift() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The first item of the list

    -
    - -
    -
    toArray() - +

    Return array representation of list.

    public - toArray() : array<string|int, AllowedType> + toArray() : array<int, AllowedType>
    APIYes
    @@ -2465,73 +1209,13 @@ Possible values are:

    Return values
    - array<string|int, AllowedType> + array<int, AllowedType>

    Array of list items

    -
    -
    -

    - top() - - -

    - - -

    Peek at the item at the end of the list.

    - - - public - top() : AllowedType - -
    -
    APIYes
    - -
    - - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - RuntimeException - -

    if the list is empty

    -
    - -
    -
    - -
    -
    Return values
    - AllowedType - — -

    The last item of the list

    -
    - -
    -
    toStrictCollection() - +

    Turn list into a type-sensitive collection.

    public - toStrictCollection() : StrictCollection<string|int, AllowedType> + toStrictCollection() : StrictCollection<string|int, AllowedType>
    APIYes
    @@ -2568,7 +1252,7 @@ Possible values are:

    Return values
    - StrictCollection<string|int, AllowedType> + StrictCollection<string|int, AllowedType>

    A type-sensitive collection of the list's items

    @@ -2584,22 +1268,22 @@ Possible values are:

    >

    unshift() - +

    Prepend the list with an item.

    public - unshift(AllowedType $value) : void + unshift(AllowedType $value) : void
    APIYes
    @@ -2610,7 +1294,7 @@ Possible values are:

    $value - : AllowedType + : AllowedType

    The item to unshift

    @@ -2622,7 +1306,7 @@ Possible values are:

    Tags - +
    @@ -2630,7 +1314,7 @@ Possible values are:

    throws
    - InvalidArgumentException + InvalidDataTypeException

    if $value is not of allowed type

    @@ -2639,111 +1323,6 @@ Possible values are:

    -
    -
    -

    - valid() - - -

    - - -

    Check if current cursor position is valid.

    - - - public - valid() : bool - -
    -
    APIYes
    - -
    - - - - -
    -
    Return values
    - bool - — -

    Whether the current cursor position is valid

    -
    - -
    - -
    -
    -

    - setAllowedTypes() - - -

    - - -

    Set allowed data types of list items.

    - - - protected - setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void - -
    -
    - -
    Parameters
    -
    -
    - $allowedTypes - : array<string|int, string> - = []
    -
    -

    Allowed data types of items

    -
    - -
    -
    - - -
    - Tags - - -
    -
    -
    - throws -
    -
    - InvalidArgumentException - -

    if any value of $allowedTypes is not a string

    -
    - -
    -
    - -
    @@ -2850,59 +1429,29 @@ Possible values are:

  • Table Of Contents
  • -
  • Properties
  • -
  • - -
  • Methods
  • diff --git a/doc/classes/OCC-Basics-DataStructures-StrictSplDatastructureTrait.html b/doc/classes/OCC-Basics-DataStructures-StrictSplDatastructureTrait.html new file mode 100644 index 0000000..2552eec --- /dev/null +++ b/doc/classes/OCC-Basics-DataStructures-StrictSplDatastructureTrait.html @@ -0,0 +1,1390 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
    +

    PHP Basics

    + + + + + + +
    + +
    +
    + + + + +
    +
    + + +
    +

    + StrictSplDatastructureTrait +

    + + + +

    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.

    +
    + + +
    + Tags + + +
    +
    +
    + author +
    +
    + +

    Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    +
    + +
    +
    + template +
    +
    + +

    AllowedType of mixed

    +
    + +
    +
    + + + +

    + Table of Contents + + +

    + + + + + + + + + + +

    + Methods + + +

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

    + Methods + + +

    +
    +

    + __construct() + + +

    + + +

    Create a type-sensitive, traversable list of items.

    + + + public + __construct([array<string|int, string> $allowedTypes = [] ]) : void + +
    +
    + +
    Parameters
    +
    +
    + $allowedTypes + : array<string|int, string> + = []
    +
    +

    Allowed data types of items (optional)

    +

    If empty, all types are allowed. +Possible values are:

    +
      +
    • "array"
    • +
    • "bool"
    • +
    • "callable"
    • +
    • "countable"
    • +
    • "float" or "double"
    • +
    • "int" or "integer" or "long"
    • +
    • "iterable"
    • +
    • "null"
    • +
    • "numeric"
    • +
    • "object" or FQCN
    • +
    • "resource"
    • +
    • "scalar"
    • +
    • "string"
    • +
    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if any value of $allowedTypes is not a string

    +
    + +
    +
    + + +
    +
    +

    + add() + + +

    + + +

    Add/insert a new item at the specified offset.

    + + + public + add(int $offset, AllowedType $value) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $offset + : int +
    +
    +

    The offset where the new item is to be inserted

    +
    + +
    +
    + $value + : AllowedType +
    +
    +

    The new item for the offset

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if $value is not of allowed type

    +
    + +
    +
    + throws +
    +
    + OutOfRangeException + +

    when $offset is out of bounds

    +
    + +
    +
    + + +
    +
    +

    + append() + + +

    + + +

    Append items at the end of the list.

    + + + public + append(AllowedType ...$values) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $values + : AllowedType +
    +
    +

    One or more items to append

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if any $values is not of allowed type

    +
    + +
    +
    + + +
    +
    +

    + clear() + + +

    + + +

    Clear the list of any items.

    + + + public + clear() : void + +
    +
    APIYes
    + +
    + + + + + +
    +
    +

    + get() + + +

    + + +

    Get the item at the specified index.

    + + + public + get(int $offset) : AllowedType + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $offset + : int +
    +
    +

    The item's index

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + OutOfRangeException + +

    when $offset is out of bounds

    +
    + +
    +
    + +
    +
    Return values
    + AllowedType + — +

    The item

    +
    + +
    + +
    +
    +

    + isList() + + +

    + + +

    Check if this can be considered a list.

    + + + public + isList() : true + +
    +
    APIYes
    + +
    + + + + +
    +
    Return values
    + true + — +

    Always TRUE (this exists only for compatibility reasons)

    +
    + +
    + +
    +
    +

    + offsetSet() + + +

    + + +

    Set the item at the specified offset.

    + + + public + offsetSet(int|null $offset, AllowedType $value) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $offset + : int|null +
    +
    +

    The offset being set or NULL to append

    +
    + +
    +
    + $value + : AllowedType +
    +
    +

    The new item for the offset

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if $value is not of allowed type

    +
    + +
    +
    + throws +
    +
    + OutOfRangeException + +

    when $offset is out of bounds

    +
    + +
    +
    + + +
    +
    +

    + prepend() + + +

    + + +

    Prepend items at the start of the list.

    + + + public + prepend(AllowedType ...$values) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $values + : AllowedType +
    +
    +

    One or more items to prepend

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if $value is not of allowed type

    +
    + +
    +
    + + +
    +
    +

    + push() + + +

    + + +

    Push an item at the end of the list.

    + + + public + push(AllowedType $value) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $value + : AllowedType +
    +
    +

    The item to push

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if $value is not of allowed type

    +
    + +
    +
    + + +
    +
    +

    + remove() + + +

    + + +

    Remove an item from the list.

    + + + public + remove(int $offset) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $offset + : int +
    +
    +

    The item's index

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + OutOfRangeException + +

    when $offset is out of bounds

    +
    + +
    +
    + + +
    +
    +

    + set() + + +

    + + +

    Set an item at the specified index.

    + + + public + set(int $offset, AllowedType $value) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $offset + : int +
    +
    +

    The item's index

    +
    + +
    +
    + $value + : AllowedType +
    +
    +

    The item

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if $value is not of allowed type

    +
    + +
    +
    + + +
    +
    +

    + toArray() + + +

    + + +

    Return array representation of list.

    + + + public + toArray() : array<int, AllowedType> + +
    +
    APIYes
    + +
    + + + + +
    +
    Return values
    + array<int, AllowedType> + — +

    Array of list items

    +
    + +
    + +
    +
    +

    + toStrictCollection() + + +

    + + +

    Turn list into a type-sensitive collection.

    + + + public + toStrictCollection() : StrictCollection<string|int, AllowedType> + +
    +
    APIYes
    + +
    + + + + +
    +
    Return values
    + StrictCollection<string|int, AllowedType> + — +

    A type-sensitive collection of the list's items

    +
    + +
    + +
    +
    +

    + unshift() + + +

    + + +

    Prepend the list with an item.

    + + + public + unshift(AllowedType $value) : void + +
    +
    APIYes
    + +
    + +
    Parameters
    +
    +
    + $value + : AllowedType +
    +
    +

    The item to unshift

    +
    + +
    +
    + + +
    + Tags + + +
    +
    +
    + throws +
    +
    + InvalidArgumentException + +

    if $value is not of allowed type

    +
    + +
    +
    + + +
    +
    + +
    +
    +
    +
    +
    
    +        
    + +
    +
    + + + +
    +
    +
    + +
    + On this page + + +
    + +
    +
    +
    +
    +
    +

    Search results

    + +
    +
    +
      +
      +
      +
      +
      + + +
      + + + + + + + + diff --git a/doc/classes/OCC-Basics-DataStructures-StrictStack.html b/doc/classes/OCC-Basics-DataStructures-StrictStack.html index a0c75a1..b101e45 100644 --- a/doc/classes/OCC-Basics-DataStructures-StrictStack.html +++ b/doc/classes/OCC-Basics-DataStructures-StrictStack.html @@ -76,6 +76,24 @@

      Overview

      +

      User Guide @@ -161,7 +179,7 @@ StrictStack - extends StrictList + extends SplStack
      @@ -172,10 +190,10 @@
      - - implements - ArrayAccess, Countable, Iterator, Serializable + + Uses + StrictSplDatastructureTrait

      @@ -186,18 +204,16 @@

      A type-sensitive, taversable stack (LIFO).

      -

      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. It -also restricts the iterator direction to last-in, first-out (LIFO) exactly -like \SplStack.

      +

      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.

      @@ -237,32 +253,12 @@ like \SplStack.

      -

      - Interfaces - - -

      -
      -
      ArrayAccess
      Countable
      Iterator
      Serializable
      -

      - Properties - - -

      -
      -
      - $allowedTypes - -  : array<string|int, string> -
      - -

      Methods @@ -271,215 +267,82 @@ like \SplStack.

      - __construct() + __construct()  : void
      -
      Create a type-sensitive, traversable stack of items.
      +
      Create a type-sensitive, traversable list of items.
      - __get() - -  : mixed -
      -
      Read data from an inaccessible property.
      - -
      - __isset() - -  : bool -
      -
      Check if an inaccessible property is set and not empty.
      - -
      - add() + add()  : void
      Add/insert a new item at the specified offset.
      - append() + append()  : void
      Append items at the end of the list.
      - bottom() - -  : AllowedType -
      -
      Peek at the item at the beginning of the list.
      - -
      - clear() + clear()  : void
      Clear the list of any items.
      - count() + get() -  : int -
      -
      Get the number of items on the list.
      - -
      - current() - -  : AllowedType -
      -
      Get the current list item.
      - -
      - get() - -  : AllowedType +  : AllowedType
      Get the item at the specified index.
      - getAllowedTypes() - -  : array<string|int, string> -
      -
      Get allowed data types for list items.
      - -
      - getIteratorMode() - -  : int -
      -
      Get the mode of iteration.
      - -
      - isAllowedType() - -  : bool -
      -
      Check if the item's data type is allowed on the list.
      - -
      - isEmpty() - -  : bool -
      -
      Check if list is empty.
      - -
      - isList() + isList()  : true
      Check if this can be considered a list.
      - key() - -  : int -
      -
      Get the current list index.
      - -
      - next() - -  : void -
      -
      Move the cursor to the next list index.
      - -
      - offsetExists() - -  : bool -
      -
      Check if the specified index exists and is not empty.
      - -
      - offsetGet() - -  : AllowedType -
      -
      Get the item from the specified index.
      - -
      - offsetSet() + offsetSet()  : void
      Set the item at the specified offset.
      - offsetUnset() - -  : void -
      -
      Unset the item at the specified index.
      - -
      - pop() - -  : AllowedType -
      -
      Pops an item from the end of the list.
      - -
      - prepend() + prepend()  : void
      Prepend items at the start of the list.
      - prev() - -  : void -
      -
      Move the cursor to the previous list index.
      - -
      - push() + push()  : void
      Push an item at the end of the list.
      - remove() + remove()  : void
      Remove an item from the list.
      - rewind() - -  : void -
      -
      Rewind the iterator's cursor.
      - -
      - set() + set()  : void
      Set an item at the specified index.
      -
      - setIteratorMode() - -  : int -
      -
      Set the mode of iteration.
      - -
      - shift() - -  : AllowedType -
      -
      Shift an item from the beginning of the list.
      -
      stack() @@ -488,28 +351,21 @@ like \SplStack.

      Add an item to the stack.
      - toArray() + toArray() -  : array<string|int, AllowedType> +  : array<int, AllowedType>
      Return array representation of list.
      - top() + toStrictCollection() -  : AllowedType -
      -
      Peek at the item at the end of the list.
      - -
      - toStrictCollection() - -  : StrictCollection<string|int, AllowedType> +  : StrictCollection<string|int, AllowedType>
      Turn list into a type-sensitive collection.
      - unshift() + unshift()  : void
      @@ -522,20 +378,6 @@ like \SplStack.

      Unstack an item from the stack.
      -
      - valid() - -  : bool -
      -
      Check if current cursor position is valid.
      - -
      - setAllowedTypes() - -  : void -
      -
      Set allowed data types of list items.
      -
      @@ -544,49 +386,6 @@ like \SplStack.

      -
      -

      - Properties - - -

      -
      -

      - $allowedTypes - - - - read-only -

      - - - - - public - array<string|int, string> - $allowedTypes - - -

      The allowed data types for values.

      -
      - - - - -
      -

      @@ -602,18 +401,18 @@ like \SplStack.

      >

      __construct() - +

      -

      Create a type-sensitive, traversable stack of items.

      +

      Create a type-sensitive, traversable list of items.

      public @@ -655,7 +454,7 @@ Possible values are:

      Tags - +
      @@ -672,129 +471,6 @@ Possible values are:

      - -
      -

      - __get() - - -

      - - -

      Read data from an inaccessible property.

      - - - public - __get(string $property) : mixed - -
      -
      - -
      Parameters
      -
      -
      - $property - : string -
      -
      -

      The class property to get

      -
      - -
      -
      - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - InvalidArgumentException - -

      if the property or getter method do not exist

      -
      - -
      -
      - -
      -
      Return values
      - mixed - — -

      The class property's current value

      -
      - -
      - -
      -
      -

      - __isset() - - -

      - - -

      Check if an inaccessible property is set and not empty.

      - - - public - __isset(string $property) : bool - -
      -
      - -
      Parameters
      -
      -
      - $property - : string -
      -
      -

      The class property to check

      -
      - -
      -
      - - - -
      -
      Return values
      - bool - — -

      Whether the class property is set and not empty

      -
      - -
      -
      add() - +

      Add/insert a new item at the specified offset.

      public - add(int $offset, AllowedType $value) : void + add(int $offset, AllowedType $value) : void
      APIYes
      @@ -839,7 +515,7 @@ Possible values are:

      $value - : AllowedType + : AllowedType

      The new item for the offset

      @@ -851,7 +527,7 @@ Possible values are:

      Tags - +
      @@ -859,7 +535,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -887,22 +563,22 @@ Possible values are:

      >

      append() - +

      Append items at the end of the list.

      public - append(AllowedType ...$values) : void + append(AllowedType ...$values) : void
      APIYes
      @@ -913,7 +589,7 @@ Possible values are:

      $values - : AllowedType + : AllowedType

      One or more items to append

      @@ -925,7 +601,7 @@ Possible values are:

      Tags - +
      @@ -933,7 +609,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if any $values is not of allowed type

      @@ -942,66 +618,6 @@ Possible values are:

      -
      -
      -

      - bottom() - - -

      - - -

      Peek at the item at the beginning of the list.

      - - - public - bottom() : AllowedType - -
      -
      APIYes
      - -
      - - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - RuntimeException - -

      if the list is empty

      -
      - -
      -
      - -
      -
      Return values
      - AllowedType - — -

      The first item of the list

      -
      - -
      -
      -
      -

      - count() - - -

      - - -

      Get the number of items on the list.

      - - - public - count() : int - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - int - — -

      The number of items on the list

      -
      - -
      - -
      -
      -

      - current() - - -

      - - -

      Get the current list item.

      - - - public - current() : AllowedType - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - AllowedType - — -

      The current item

      -
      - -
      -
      get() - +

      Get the item at the specified index.

      public - get(int $offset) : AllowedType + get(int $offset) : AllowedType
      APIYes
      @@ -1170,7 +700,7 @@ Possible values are:

      Tags - +
      @@ -1188,197 +718,13 @@ Possible values are:

      Return values
      - AllowedType + AllowedType

      The item

      -
      -
      -

      - getAllowedTypes() - - -

      - - -

      Get allowed data types for list items.

      - - - public - getAllowedTypes() : array<string|int, string> - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - array<string|int, string> - — -

      The list of allowed data types

      -
      - -
      - -
      -
      -

      - getIteratorMode() - - -

      - - -

      Get the mode of iteration.

      - - - public - getIteratorMode() : int - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - int - — -

      The set of flags and modes of iteration

      -
      - -
      - -
      -
      -

      - isAllowedType() - - -

      - - -

      Check if the item's data type is allowed on the list.

      - - - public - isAllowedType(AllowedType $value) : bool - -
      -
      APIYes
      - -
      - -
      Parameters
      -
      -
      - $value - : AllowedType -
      -
      -

      The item to check

      -
      - -
      -
      - - - -
      -
      Return values
      - bool - — -

      Whether the item's data type is allowed

      -
      - -
      - -
      -
      -

      - isEmpty() - - -

      - - -

      Check if list is empty.

      - - - public - isEmpty() : bool - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - bool - — -

      Whether the list contains no items

      -
      - -
      -
      - -
      -

      - key() - - -

      - - -

      Get the current list index.

      - - - public - key() : int - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - int - — -

      The current list index

      -
      - -
      - -
      -
      -

      - next() - - -

      - - -

      Move the cursor to the next list index.

      - - - public - next() : void - -
      -
      APIYes
      - -
      - - - - - -
      -
      -

      - offsetExists() - - -

      - - -

      Check if the specified index exists and is not empty.

      - - - public - offsetExists(int $offset) : bool - -
      -
      APIYes
      - -
      - -
      Parameters
      -
      -
      - $offset - : int -
      -
      -

      The index to check

      -
      - -
      -
      - - - -
      -
      Return values
      - bool - — -

      Whether the index exists and is not empty

      -
      - -
      - -
      -
      -

      - offsetGet() - - -

      - - -

      Get the item from the specified index.

      - - - public - offsetGet(int $offset) : AllowedType - -
      -
      APIYes
      - -
      - -
      Parameters
      -
      -
      - $offset - : int -
      -
      -

      The item's index

      -
      - -
      -
      - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - OutOfRangeException - -

      when $offset is out of bounds

      -
      - -
      -
      - -
      -
      Return values
      - AllowedType - — -

      The item

      -
      - -
      -
      offsetSet() - +

      Set the item at the specified offset.

      public - offsetSet(int|null $offset, AllowedType $value) : void + offsetSet(int|null $offset, AllowedType $value) : void
      APIYes
      @@ -1671,7 +812,7 @@ Possible values are:

      $value - : AllowedType + : AllowedType

      The new item for the offset

      @@ -1683,7 +824,7 @@ Possible values are:

      Tags - +
      @@ -1691,7 +832,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -1710,130 +851,6 @@ Possible values are:

      -
      -
      -

      - offsetUnset() - - -

      - - -

      Unset the item at the specified index.

      - - - public - offsetUnset(int $offset) : void - -
      -
      APIYes
      - -
      - -
      Parameters
      -
      -
      - $offset - : int -
      -
      -

      The item's index

      -
      - -
      -
      - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - OutOfRangeException - -

      when $offset is out of bounds

      -
      - -
      -
      - - -
      -
      -

      - pop() - - -

      - - -

      Pops an item from the end of the list.

      - - - public - pop() : AllowedType - -
      -
      APIYes
      - -
      - - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - RuntimeException - -

      if the list is empty

      -
      - -
      -
      - -
      -
      Return values
      - AllowedType - — -

      The item from the end of the list

      -
      - -
      -
      prepend() - +

      Prepend items at the start of the list.

      public - prepend(AllowedType ...$values) : void + prepend(AllowedType ...$values) : void
      APIYes
      @@ -1869,7 +886,7 @@ Possible values are:

      $values - : AllowedType + : AllowedType

      One or more items to prepend

      @@ -1881,7 +898,7 @@ Possible values are:

      Tags - +
      @@ -1889,7 +906,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -1898,41 +915,6 @@ Possible values are:

      -
      -
      -

      - prev() - - -

      - - -

      Move the cursor to the previous list index.

      - - - public - prev() : void - -
      -
      APIYes
      - -
      - - - - -
      push() - +

      Push an item at the end of the list.

      public - push(AllowedType $value) : void + push(AllowedType $value) : void
      APIYes
      @@ -1968,7 +950,7 @@ Possible values are:

      $value - : AllowedType + : AllowedType

      The item to push

      @@ -1980,7 +962,7 @@ Possible values are:

      Tags - +
      @@ -1988,7 +970,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -2006,15 +988,15 @@ Possible values are:

      >

      remove() - +

      Remove an item from the list.

      @@ -2044,7 +1026,7 @@ Possible values are:

      Tags - +
      @@ -2061,41 +1043,6 @@ Possible values are:

      -
      -
      -

      - rewind() - - -

      - - -

      Rewind the iterator's cursor.

      - - - public - rewind() : void - -
      -
      APIYes
      - -
      - - - - -
      set() - +

      Set an item at the specified index.

      public - set(int $offset, AllowedType $value) : void + set(int $offset, AllowedType $value) : void
      APIYes
      @@ -2140,7 +1087,7 @@ Possible values are:

      $value - : AllowedType + : AllowedType

      The item

      @@ -2152,7 +1099,7 @@ Possible values are:

      Tags - +
      @@ -2160,7 +1107,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -2169,159 +1116,6 @@ Possible values are:

      -
      -
      -

      - setIteratorMode() - - -

      - - -

      Set the mode of iteration.

      - - - public - final setIteratorMode(int $mode) : int - -
      -
      APIYes
      - -
      - -
      Parameters
      -
      -
      - $mode - : int -
      -
      -

      The new iterator mode (2 or 3)

      -

      There are two orthogonal sets of modes that can be set.

      -

      The direction of iteration (fixed for StrictStack):

      -
        -
      • StrictStack::IT_MODE_LIFO (stack style)
      • -
      -

      The behavior of the iterator (either one or the other):

      -
        -
      • StrictStack::IT_MODE_DELETE (delete items)
      • -
      • StrictStack::IT_MODE_KEEP (keep items)
      • -
      -

      The default mode is: IT_MODE_LIFO | IT_MODE_KEEP

      -
      - -
      -
      - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - RangeException - -

      if an invalid $mode is given

      -
      - -
      -
      - throws -
      -
      - RuntimeException - -

      if trying to change iterator direction

      -
      - -
      -
      - -
      -
      Return values
      - int - — -

      The set of flags and modes of iteration

      -
      - -
      - -
      -
      -

      - shift() - - -

      - - -

      Shift an item from the beginning of the list.

      - - - public - shift() : AllowedType - -
      -
      APIYes
      - -
      - - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - RuntimeException - -

      if the list is empty

      -
      - -
      -
      - -
      -
      Return values
      - AllowedType - — -

      The first item of the list

      -
      - -
      -
      StrictStack.php : - 68 + 62 - +

      Add an item to the stack.

      @@ -2377,7 +1171,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -2395,22 +1189,22 @@ Possible values are:

      >

      toArray() - +

      Return array representation of list.

      public - toArray() : array<string|int, AllowedType> + toArray() : array<int, AllowedType>
      APIYes
      @@ -2422,73 +1216,13 @@ Possible values are:

      Return values
      - array<string|int, AllowedType> + array<int, AllowedType>

      Array of list items

      -
      -
      -

      - top() - - -

      - - -

      Peek at the item at the end of the list.

      - - - public - top() : AllowedType - -
      -
      APIYes
      - -
      - - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - RuntimeException - -

      if the list is empty

      -
      - -
      -
      - -
      -
      Return values
      - AllowedType - — -

      The last item of the list

      -
      - -
      -
      toStrictCollection() - +

      Turn list into a type-sensitive collection.

      public - toStrictCollection() : StrictCollection<string|int, AllowedType> + toStrictCollection() : StrictCollection<string|int, AllowedType>
      APIYes
      @@ -2525,7 +1259,7 @@ Possible values are:

      Return values
      - StrictCollection<string|int, AllowedType> + StrictCollection<string|int, AllowedType>

      A type-sensitive collection of the list's items

      @@ -2541,22 +1275,22 @@ Possible values are:

      >

      unshift() - +

      Prepend the list with an item.

      public - unshift(AllowedType $value) : void + unshift(AllowedType $value) : void
      APIYes
      @@ -2567,7 +1301,7 @@ Possible values are:

      $value - : AllowedType + : AllowedType

      The item to unshift

      @@ -2579,7 +1313,7 @@ Possible values are:

      Tags - +
      @@ -2587,7 +1321,7 @@ Possible values are:

      throws
      - InvalidArgumentException + InvalidDataTypeException

      if $value is not of allowed type

      @@ -2611,9 +1345,9 @@ Possible values are:

      Unstack an item from the stack.

      @@ -2629,6 +1363,23 @@ Possible values are:

      +
      + Tags + + +
      +
      +
      + throws +
      +
      + RuntimeException + +

      if the list is empty

      +
      + +
      +
      Return values
      @@ -2639,111 +1390,6 @@ Possible values are:

      -
      -
      -

      - valid() - - -

      - - -

      Check if current cursor position is valid.

      - - - public - valid() : bool - -
      -
      APIYes
      - -
      - - - - -
      -
      Return values
      - bool - — -

      Whether the current cursor position is valid

      -
      - -
      - -
      -
      -

      - setAllowedTypes() - - -

      - - -

      Set allowed data types of list items.

      - - - protected - setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void - -
      -
      - -
      Parameters
      -
      -
      - $allowedTypes - : array<string|int, string> - = []
      -
      -

      Allowed data types of items

      -
      - -
      -
      - - -
      - Tags - - -
      -
      -
      - throws -
      -
      - InvalidArgumentException - -

      if any value of $allowedTypes is not a string

      -
      - -
      -
      - -
      @@ -2850,59 +1496,30 @@ Possible values are:

    • Table Of Contents
    • -
    • Properties
    • -
    • - -
    • Methods
    • diff --git a/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html b/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html new file mode 100644 index 0000000..2cb70b0 --- /dev/null +++ b/doc/classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html @@ -0,0 +1,1391 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
      +

      PHP Basics

      + + + + + + +
      + +
      +
      + + + + +
      +
      + + +
      +

      + StrictSplDatastructureTrait +

      + + + +

      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.

      +
      + + +
      + Tags + + +
      +
      +
      + author +
      +
      + +

      Sebastian Meyer sebastian.meyer@opencultureconsulting.com

      +
      + +
      +
      + template +
      +
      + +

      AllowedType of mixed

      +
      + +
      +
      + + + +

      + Table of Contents + + +

      + + + + + + + + + + +

      + Methods + + +

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

      + Methods + + +

      +
      +

      + __construct() + + +

      + + +

      Create a type-sensitive, traversable list of items.

      + + + public + __construct([array<string|int, string> $allowedTypes = [] ]) : void + +
      +
      + +
      Parameters
      +
      +
      + $allowedTypes + : array<string|int, string> + = []
      +
      +

      Allowed data types of items (optional)

      +

      If empty, all types are allowed. +Possible values are:

      +
        +
      • "array"
      • +
      • "bool"
      • +
      • "callable"
      • +
      • "countable"
      • +
      • "float" or "double"
      • +
      • "int" or "integer" or "long"
      • +
      • "iterable"
      • +
      • "null"
      • +
      • "numeric"
      • +
      • "object" or FQCN
      • +
      • "resource"
      • +
      • "scalar"
      • +
      • "string"
      • +
      +
      + +
      +
      + + +
      + Tags + + +
      +
      +
      + throws +
      +
      + InvalidArgumentException + +

      if any value of $allowedTypes is not a string

      +
      + +
      +
      + + +
      +
      +

      + add() + + +

      + + +

      Add/insert a new item at the specified offset.

      + + + public + add(int $offset, AllowedType $value) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $offset + : int +
      +
      +

      The offset where the new item is to be inserted

      +
      + +
      +
      + $value + : AllowedType +
      +
      +

      The new item for the offset

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

      if $value is not of allowed type

      +
      + +
      +
      + throws +
      +
      + OutOfRangeException + +

      when $offset is out of bounds

      +
      + +
      +
      + + +
      +
      +

      + append() + + +

      + + +

      Append items at the end of the list.

      + + + public + append(AllowedType ...$values) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $values + : AllowedType +
      +
      +

      One or more items to append

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

      if any $values is not of allowed type

      +
      + +
      +
      + + +
      +
      +

      + clear() + + +

      + + +

      Clear the list of any items.

      + + + public + clear() : void + +
      +
      APIYes
      + +
      + + + + + +
      +
      +

      + get() + + +

      + + +

      Get the item at the specified index.

      + + + public + get(int $offset) : AllowedType + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $offset + : int +
      +
      +

      The item's index

      +
      + +
      +
      + + +
      + Tags + + +
      +
      +
      + throws +
      +
      + OutOfRangeException + +

      when $offset is out of bounds

      +
      + +
      +
      + +
      +
      Return values
      + AllowedType + — +

      The item

      +
      + +
      + +
      +
      +

      + isList() + + +

      + + +

      Check if this can be considered a list.

      + + + public + isList() : true + +
      +
      APIYes
      + +
      + + + + +
      +
      Return values
      + true + — +

      Always TRUE (this exists only for compatibility reasons)

      +
      + +
      + +
      +
      +

      + offsetSet() + + +

      + + +

      Set the item at the specified offset.

      + + + public + offsetSet(int|null $offset, AllowedType $value) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $offset + : int|null +
      +
      +

      The offset being set or NULL to append

      +
      + +
      +
      + $value + : AllowedType +
      +
      +

      The new item for the offset

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

      if $value is not of allowed type

      +
      + +
      +
      + throws +
      +
      + OutOfRangeException + +

      when $offset is out of bounds

      +
      + +
      +
      + + +
      +
      +

      + prepend() + + +

      + + +

      Prepend items at the start of the list.

      + + + public + prepend(AllowedType ...$values) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $values + : AllowedType +
      +
      +

      One or more items to prepend

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

      if $value is not of allowed type

      +
      + +
      +
      + + +
      +
      +

      + push() + + +

      + + +

      Push an item at the end of the list.

      + + + public + push(AllowedType $value) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $value + : AllowedType +
      +
      +

      The item to push

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

      if $value is not of allowed type

      +
      + +
      +
      + + +
      +
      +

      + remove() + + +

      + + +

      Remove an item from the list.

      + + + public + remove(int $offset) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $offset + : int +
      +
      +

      The item's index

      +
      + +
      +
      + + +
      + Tags + + +
      +
      +
      + throws +
      +
      + OutOfRangeException + +

      when $offset is out of bounds

      +
      + +
      +
      + + +
      +
      +

      + set() + + +

      + + +

      Set an item at the specified index.

      + + + public + set(int $offset, AllowedType $value) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $offset + : int +
      +
      +

      The item's index

      +
      + +
      +
      + $value + : AllowedType +
      +
      +

      The item

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

      if $value is not of allowed type

      +
      + +
      +
      + + +
      +
      +

      + toArray() + + +

      + + +

      Return array representation of list.

      + + + public + toArray() : array<int, AllowedType> + +
      +
      APIYes
      + +
      + + + + +
      +
      Return values
      + array<int, AllowedType> + — +

      Array of list items

      +
      + +
      + +
      +
      +

      + toStrictCollection() + + +

      + + +

      Turn list into a type-sensitive collection.

      + + + public + toStrictCollection() : StrictCollection<string|int, AllowedType> + +
      +
      APIYes
      + +
      + + + + +
      +
      Return values
      + StrictCollection<string|int, AllowedType> + — +

      A type-sensitive collection of the list's items

      +
      + +
      + +
      +
      +

      + unshift() + + +

      + + +

      Prepend the list with an item.

      + + + public + unshift(AllowedType $value) : void + +
      +
      APIYes
      + +
      + +
      Parameters
      +
      +
      + $value + : AllowedType +
      +
      +

      The item to unshift

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

      if $value is not of allowed type

      +
      + +
      +
      + + +
      +
      + +
      +
      +
      +
      +
      
      +        
      + +
      +
      + + + +
      +
      +
      + +
      + On this page + + +
      + +
      +
      +
      +
      +
      +

      Search results

      + +
      +
      +
        +
        +
        +
        +
        + + +
        + + + + + + + + diff --git a/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html b/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html index e4425cf..995dc97 100644 --- a/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html +++ b/doc/classes/OCC-Basics-ErrorHandlers-ThrowErrorException.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html b/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html index d6b9827..b4530c9 100644 --- a/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html +++ b/doc/classes/OCC-Basics-ErrorHandlers-TriggerExceptionError.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html b/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html index 8d893c7..dc73e22 100644 --- a/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-ArrayAccessTrait.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Interfaces-CountableTrait.html b/doc/classes/OCC-Basics-Interfaces-CountableTrait.html index e74e7d8..ea85a61 100644 --- a/doc/classes/OCC-Basics-Interfaces-CountableTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-CountableTrait.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html b/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html index 67cbba8..8827683 100644 --- a/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-IteratorAggregateTrait.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html b/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html index af7105a..b0ede7b 100644 --- a/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html +++ b/doc/classes/OCC-Basics-Interfaces-IteratorTrait.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Traits-Getter.html b/doc/classes/OCC-Basics-Traits-Getter.html index 695d39a..45d28e8 100644 --- a/doc/classes/OCC-Basics-Traits-Getter.html +++ b/doc/classes/OCC-Basics-Traits-Getter.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Traits-OverloadingGetter.html b/doc/classes/OCC-Basics-Traits-OverloadingGetter.html index 09fa1e8..c9b2c8a 100644 --- a/doc/classes/OCC-Basics-Traits-OverloadingGetter.html +++ b/doc/classes/OCC-Basics-Traits-OverloadingGetter.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Traits-OverloadingSetter.html b/doc/classes/OCC-Basics-Traits-OverloadingSetter.html index ea9d3d2..6093885 100644 --- a/doc/classes/OCC-Basics-Traits-OverloadingSetter.html +++ b/doc/classes/OCC-Basics-Traits-OverloadingSetter.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Traits-Setter.html b/doc/classes/OCC-Basics-Traits-Setter.html index d804505..802bd73 100644 --- a/doc/classes/OCC-Basics-Traits-Setter.html +++ b/doc/classes/OCC-Basics-Traits-Setter.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Traits-Singleton.html b/doc/classes/OCC-Basics-Traits-Singleton.html index 80c4648..de4e78b 100644 --- a/doc/classes/OCC-Basics-Traits-Singleton.html +++ b/doc/classes/OCC-Basics-Traits-Singleton.html @@ -76,6 +76,24 @@

        Overview

        +

        User Guide diff --git a/doc/classes/OCC-Basics-Traits-TypeChecker.html b/doc/classes/OCC-Basics-Traits-TypeChecker.html new file mode 100644 index 0000000..07d5652 --- /dev/null +++ b/doc/classes/OCC-Basics-Traits-TypeChecker.html @@ -0,0 +1,644 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
        +

        PHP Basics

        + + + + + + +
        + +
        +
        + + + + +
        +
        + + +
        +

        + 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 check if a value's data type +matches at least one of these types.

        +
        + + +
        + Tags + + +
        +
        +
        + author +
        +
        + +

        Sebastian Meyer sebastian.meyer@opencultureconsulting.com

        +
        + +
        +
        + + + +

        + Table of Contents + + +

        + + + + + + + + + + +

        + Methods + + +

        +
        +
        + getAllowedTypes() + +  : array<string|int, string> +
        +
        Get allowed data types.
        + +
        + hasAllowedType() + +  : bool +
        +
        Check if a value's data type is allowed.
        + +
        + isAllowedType() + +  : bool +
        +
        Check if a data type is allowed.
        + +
        + setAllowedTypes() + +  : void +
        +
        Set allowed data types.
        + +
        + + + + + + + + +
        +

        + Methods + + +

        +
        +

        + getAllowedTypes() + + +

        + + +

        Get allowed data types.

        + + + public + getAllowedTypes() : array<string|int, string> + +
        +
        APIYes
        + +
        + + + + +
        +
        Return values
        + array<string|int, string> + — +

        The list of allowed data types

        +
        + +
        + +
        +
        +

        + hasAllowedType() + + +

        + + +

        Check if a value's data type is allowed.

        + + + public + hasAllowedType(mixed $value) : bool + +
        +
        APIYes
        + +
        + +
        Parameters
        +
        +
        + $value + : mixed +
        +
        +

        The value to check

        +
        + +
        +
        + + + +
        +
        Return values
        + bool + — +

        Whether the value's data type is allowed

        +
        + +
        + +
        +
        +

        + isAllowedType() + + +

        + + +

        Check if a data type is allowed.

        + + + public + isAllowedType(string $type) : bool + +
        +
        APIYes
        + +
        + +
        Parameters
        +
        +
        + $type + : string +
        +
        +

        The type to check

        +
        + +
        +
        + + + +
        +
        Return values
        + bool + — +

        Whether the data type is allowed

        +
        + +
        + +
        +
        +

        + setAllowedTypes() + + +

        + + +

        Set allowed data types.

        + + + public + setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void + +
        +
        APIYes
        + +
        + +
        Parameters
        +
        +
        + $allowedTypes + : array<string|int, string> + = []
        +
        +

        Allowed data types

        +
        + +
        +
        + + +
        + Tags + + +
        +
        +
        + throws +
        +
        + InvalidArgumentException + +

        if any value of $allowedTypes is not a string

        +
        + +
        +
        + + +
        +
        + +
        +
        +
        +
        +
        
        +        
        + +
        +
        + + + +
        +
        +
        + +
        + On this page + + +
        + +
        +
        +
        +
        +
        +

        Search results

        + +
        +
        +
          +
          +
          +
          +
          + + +
          + + + + + + + + diff --git a/doc/css/template.css b/doc/css/template.css index 6dd70bf..82f2424 100644 --- a/doc/css/template.css +++ b/doc/css/template.css @@ -311,6 +311,8 @@ aside.phpdocumentor-sidebar padding: 0 var(--spacing-md) !important; } +p > code, +li > code, code.prettyprint { background-color: var(--code-background-color); @@ -321,6 +323,38 @@ code.prettyprint padding: var(--spacing-xxxs); } +@media (max-width: 999px) { +div.admonition-wrapper +{ + display: none; +} +} + +@media (min-width: 1000px) { +div.admonition-wrapper +{ + display: block; + float: right; + padding: var(--spacing-md); + margin: 0 0 var(--spacing-md) var(--spacing-md); + width: auto; + font-size: var(--text-sm); + border: 1px solid var(--primary-color-lighten); +} +} + +div.admonition-wrapper + p.sidebar-title +{ + font-weight: bold; +} + +div.contents + ul.phpdocumentor-list +{ + margin-bottom: 0; +} + div.phpdocumentor-content div.section ul diff --git a/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html b/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html new file mode 100644 index 0000000..f468577 --- /dev/null +++ b/doc/files/src-datastructures-exceptions-invaliddatatypeexception.html @@ -0,0 +1,362 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
          +

          PHP Basics

          + + + + + + +
          + +
          +
          + + + + +
          +
          +
            +
          + +
          +

          InvalidDataTypeException.php

          + +

          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 +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

          +

          This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

          +

          You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

          +
          + + + + + +

          + Table of Contents + + +

          + + + + +

          + Classes + + +

          +
          +
          InvalidDataTypeException
          Common exception for type-sensitive datastructures.
          + + + + + + + + + + + + + +
          +
          +
          +
          +
          
          +        
          + +
          +
          + + + +
          +
          +
          + +
          + On this page + +
            +
          • Table Of Contents
          • +
          • + +
          • + + +
          +
          + +
          +
          +
          +
          +
          +

          Search results

          + +
          +
          +
            +
            +
            +
            +
            + + +
            + + + + + + + + diff --git a/doc/files/src-datastructures-strictcollection.html b/doc/files/src-datastructures-strictcollection.html index c51b3db..02bc36c 100644 --- a/doc/files/src-datastructures-strictcollection.html +++ b/doc/files/src-datastructures-strictcollection.html @@ -76,6 +76,24 @@

            Overview

            +

            User Guide diff --git a/doc/files/src-datastructures-strictlist.html b/doc/files/src-datastructures-strictlist.html index 1018b28..6aa1ef7 100644 --- a/doc/files/src-datastructures-strictlist.html +++ b/doc/files/src-datastructures-strictlist.html @@ -76,6 +76,24 @@

            Overview

            +

            User Guide diff --git a/doc/files/src-datastructures-strictqueue.html b/doc/files/src-datastructures-strictqueue.html index 3957f9a..9110604 100644 --- a/doc/files/src-datastructures-strictqueue.html +++ b/doc/files/src-datastructures-strictqueue.html @@ -76,6 +76,24 @@

            Overview

            +

            User Guide diff --git a/doc/files/src-datastructures-strictspldatastructuretrait.html b/doc/files/src-datastructures-strictspldatastructuretrait.html new file mode 100644 index 0000000..0fe48df --- /dev/null +++ b/doc/files/src-datastructures-strictspldatastructuretrait.html @@ -0,0 +1,362 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
            +

            PHP Basics

            + + + + + + +
            + +
            +
            + + + + +
            +
            +
              +
            + +
            +

            StrictSplDatastructureTrait.php

            + +

            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 +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

            +

            This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

            +

            You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

            +
            + + + + + +

            + Table of Contents + + +

            + + + + + +

            + Traits + + +

            +
            +
            StrictSplDatastructureTrait
            The common interface of all type-sensitive, SPL-based datastructures.
            + + + + + + + + + + + + +
            +
            +
            +
            +
            
            +        
            + +
            +
            + + + +
            +
            +
            + +
            + On this page + +
              +
            • Table Of Contents
            • +
            • + +
            • + + +
            +
            + +
            +
            +
            +
            +
            +

            Search results

            + +
            +
            +
              +
              +
              +
              +
              + + +
              + + + + + + + + diff --git a/doc/files/src-datastructures-strictstack.html b/doc/files/src-datastructures-strictstack.html index cb3832b..08cf2f7 100644 --- a/doc/files/src-datastructures-strictstack.html +++ b/doc/files/src-datastructures-strictstack.html @@ -76,6 +76,24 @@

              Overview

              +

              User Guide diff --git a/doc/files/src-datastructures-traits-strictspldatastructuretrait.html b/doc/files/src-datastructures-traits-strictspldatastructuretrait.html new file mode 100644 index 0000000..7169048 --- /dev/null +++ b/doc/files/src-datastructures-traits-strictspldatastructuretrait.html @@ -0,0 +1,362 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
              +

              PHP Basics

              + + + + + + +
              + +
              +
              + + + + +
              +
              +
                +
              + +
              +

              StrictSplDatastructureTrait.php

              + +

              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 +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

              +

              This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

              +

              You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

              +
              + + + + + +

              + Table of Contents + + +

              + + + + + +

              + Traits + + +

              +
              +
              StrictSplDatastructureTrait
              The common interface of all type-sensitive, SPL-based datastructures.
              + + + + + + + + + + + + +
              +
              +
              +
              +
              
              +        
              + +
              +
              + + + +
              +
              +
              + +
              + On this page + +
                +
              • Table Of Contents
              • +
              • + +
              • + + +
              +
              + +
              +
              +
              +
              +
              +

              Search results

              + +
              +
              +
                +
                +
                +
                +
                + + +
                + + + + + + + + diff --git a/doc/files/src-errorhandlers-throwerrorexception.html b/doc/files/src-errorhandlers-throwerrorexception.html index 90b53a9..4752b34 100644 --- a/doc/files/src-errorhandlers-throwerrorexception.html +++ b/doc/files/src-errorhandlers-throwerrorexception.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-errorhandlers-triggerexceptionerror.html b/doc/files/src-errorhandlers-triggerexceptionerror.html index 0d586fc..9789a1d 100644 --- a/doc/files/src-errorhandlers-triggerexceptionerror.html +++ b/doc/files/src-errorhandlers-triggerexceptionerror.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-interfaces-arrayaccesstrait.html b/doc/files/src-interfaces-arrayaccesstrait.html index 9ec30cd..ea05ad9 100644 --- a/doc/files/src-interfaces-arrayaccesstrait.html +++ b/doc/files/src-interfaces-arrayaccesstrait.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-interfaces-countabletrait.html b/doc/files/src-interfaces-countabletrait.html index 9308df4..90b67fe 100644 --- a/doc/files/src-interfaces-countabletrait.html +++ b/doc/files/src-interfaces-countabletrait.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-interfaces-iteratoraggregatetrait.html b/doc/files/src-interfaces-iteratoraggregatetrait.html index d5e889d..aa27ae4 100644 --- a/doc/files/src-interfaces-iteratoraggregatetrait.html +++ b/doc/files/src-interfaces-iteratoraggregatetrait.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-interfaces-iteratortrait.html b/doc/files/src-interfaces-iteratortrait.html index 1a33a9f..81a5d7d 100644 --- a/doc/files/src-interfaces-iteratortrait.html +++ b/doc/files/src-interfaces-iteratortrait.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-traits-getter.html b/doc/files/src-traits-getter.html index d9c2226..d53a09f 100644 --- a/doc/files/src-traits-getter.html +++ b/doc/files/src-traits-getter.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-traits-overloadinggetter.html b/doc/files/src-traits-overloadinggetter.html index 429c8e8..4efa2e7 100644 --- a/doc/files/src-traits-overloadinggetter.html +++ b/doc/files/src-traits-overloadinggetter.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-traits-overloadingsetter.html b/doc/files/src-traits-overloadingsetter.html index bb9a5c7..e58e6a7 100644 --- a/doc/files/src-traits-overloadingsetter.html +++ b/doc/files/src-traits-overloadingsetter.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-traits-setter.html b/doc/files/src-traits-setter.html index 58da7f8..119f478 100644 --- a/doc/files/src-traits-setter.html +++ b/doc/files/src-traits-setter.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-traits-singleton.html b/doc/files/src-traits-singleton.html index f053c3f..7c82c71 100644 --- a/doc/files/src-traits-singleton.html +++ b/doc/files/src-traits-singleton.html @@ -76,6 +76,24 @@

                Overview

                +

                User Guide diff --git a/doc/files/src-traits-typechecker.html b/doc/files/src-traits-typechecker.html new file mode 100644 index 0000000..8501d80 --- /dev/null +++ b/doc/files/src-traits-typechecker.html @@ -0,0 +1,362 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
                +

                PHP Basics

                + + + + + + +
                + +
                +
                + + + + +
                +
                +
                  +
                + +
                +

                TypeChecker.php

                + +

                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 +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

                +

                This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

                +

                You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

                +
                + + + + + +

                + Table of Contents + + +

                + + + + + +

                + Traits + + +

                +
                +
                TypeChecker
                A generic data type checker.
                + + + + + + + + + + + + +
                +
                +
                +
                +
                
                +        
                + +
                +
                + + + +
                +
                +
                + +
                + On this page + +
                  +
                • Table Of Contents
                • +
                • + +
                • + + +
                +
                + +
                +
                +
                +
                +
                +

                Search results

                + +
                +
                +
                  +
                  +
                  +
                  +
                  + + +
                  + + + + + + + + diff --git a/doc/files/src/DataStructures/Exceptions/InvalidDataTypeException.php.txt b/doc/files/src/DataStructures/Exceptions/InvalidDataTypeException.php.txt new file mode 100644 index 0000000..784d43e --- /dev/null +++ b/doc/files/src/DataStructures/Exceptions/InvalidDataTypeException.php.txt @@ -0,0 +1,39 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\Basics\DataStructures\Exceptions; + +use DomainException; + +/** + * Common exception for type-sensitive datastructures. + * + * Exception thrown if a value does not adhere to the defined list of valid + * data types. + * + * @author Sebastian Meyer + * @package Basics\DataStructures + */ +class InvalidDataTypeException extends DomainException +{ +} diff --git a/doc/files/src/DataStructures/StrictCollection.php.txt b/doc/files/src/DataStructures/StrictCollection.php.txt index d814faa..78f6883 100644 --- a/doc/files/src/DataStructures/StrictCollection.php.txt +++ b/doc/files/src/DataStructures/StrictCollection.php.txt @@ -27,35 +27,17 @@ use ArrayAccess; use Countable; use DomainException; use InvalidArgumentException; +use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; use OCC\Basics\Interfaces\ArrayAccessTrait; use OCC\Basics\Interfaces\CountableTrait; -use OCC\Basics\Traits\Getter; +use OCC\Basics\Traits\TypeChecker; +use OutOfRangeException; use Serializable; use function array_is_list; -use function array_map; -use function array_sum; -use function count; -use function function_exists; use function get_debug_type; -use function is_a; -use function is_array; -use function is_bool; -use function is_callable; -use function is_countable; -use function is_double; -use function is_float; -use function is_int; use function is_integer; -use function is_iterable; -use function is_long; -use function is_null; -use function is_numeric; -use function is_resource; -use function is_scalar; use function is_string; -use function is_object; -use function ltrim; use function serialize; use function sprintf; use function unserialize; @@ -73,8 +55,6 @@ use function unserialize; * @author Sebastian Meyer * @package Basics\DataStructures * - * @property-read string[] $allowedTypes The allowed data types for items. - * * @api * * @template AllowedType of mixed @@ -86,35 +66,28 @@ class StrictCollection implements ArrayAccess, Countable, Serializable use ArrayAccessTrait; /** @use CountableTrait */ use CountableTrait; - use Getter; - - /** - * The allowed data types for collection items. - * - * @var string[] - * - * @internal - */ - protected array $allowedTypes = []; + use TypeChecker { + setAllowedTypes as protected; + } /** * Holds the collection's items. * - * @var AllowedType[] + * @var array * * @internal */ protected array $_data = []; /** - * Add/insert a new item at the specified index. + * Add/insert a item at the specified index. * - * @param array-key $offset The new item's index - * @param AllowedType $value The new item + * @param array-key $offset The item's index + * @param AllowedType $value The item * * @return void * - * @throws InvalidArgumentException if `$offset` is not of allowed type + * @throws InvalidDataTypeException if `$value` is not of allowed type * * @api */ @@ -140,53 +113,25 @@ class StrictCollection implements ArrayAccess, Countable, Serializable * * @param array-key $offset The item's index * - * @return ?AllowedType The item or NULL if key is invalid + * @return AllowedType The item + * + * @throws OutOfRangeException when `$offset` is out of bounds * * @api */ public function get(int|string $offset): mixed { - return $this->offsetGet($offset); - } - - /** - * Get allowed data types for collection items. - * - * @return string[] The list of allowed data types - * - * @api - */ - public function getAllowedTypes(): array - { - return $this->allowedTypes; - } - - /** - * Check if the item's data type is allowed in the collection. - * - * @param AllowedType $value The item to check - * - * @return bool Whether the item's data type is allowed - * - * @api - */ - public function isAllowedType(mixed $value): bool - { - if (count($this->allowedTypes) === 0) { - return true; + if (!$this->offsetExists($offset)) { + throw new OutOfRangeException( + sprintf( + 'Offset %s is not a valid index key for this collection.', + $offset + ) + ); } - foreach ($this->allowedTypes as $type) { - $function = 'is_' . $type; - if (function_exists($function) && $function($value)) { - return true; - } - /** @var class-string $fqcn */ - $fqcn = ltrim($type, '\\'); - if (is_object($value) && is_a($value, $fqcn)) { - return true; - } - } - return false; + /** @var AllowedType $value */ + $value = $this->offsetGet($offset); + return $value; } /** @@ -226,7 +171,8 @@ class StrictCollection implements ArrayAccess, Countable, Serializable * * @return void * - * @throws InvalidArgumentException if `$offset` or `$value` is not of allowed type + * @throws InvalidDataTypeException if `$value` is not of allowed type + * @throws InvalidArgumentException if `$offset` is not a valid array key * * @api */ @@ -240,8 +186,8 @@ class StrictCollection implements ArrayAccess, Countable, Serializable ) ); } - if (!$this->isAllowedType($value)) { - throw new InvalidArgumentException( + if (!$this->hasAllowedType($value)) { + throw new InvalidDataTypeException( sprintf( 'Parameter 2 must be an allowed type, %s given.', get_debug_type($value) @@ -258,10 +204,20 @@ class StrictCollection implements ArrayAccess, Countable, Serializable * * @return void * + * @throws OutOfRangeException when `$offset` is out of bounds + * * @api */ public function remove(int|string $offset): void { + if (!$this->offsetExists($offset)) { + throw new OutOfRangeException( + sprintf( + 'Offset %s is not a valid index key for this collection.', + $offset + ) + ); + } $this->offsetUnset($offset); } @@ -283,7 +239,7 @@ class StrictCollection implements ArrayAccess, Countable, Serializable * * @return void * - * @throws InvalidArgumentException if `$value` is not of allowed type + * @throws InvalidDataTypeException if `$value` is not of allowed type * * @api */ @@ -292,29 +248,10 @@ class StrictCollection implements ArrayAccess, Countable, Serializable $this->offsetSet($offset, $value); } - /** - * Set allowed data types of collection items. - * - * @param string[] $allowedTypes Allowed data types of items - * - * @return void - * - * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string - */ - protected function setAllowedTypes(array $allowedTypes = []): void - { - if (array_sum(array_map('is_string', $allowedTypes)) !== count($allowedTypes)) { - throw new InvalidArgumentException( - 'Allowed types must be array of strings or empty array.' - ); - } - $this->allowedTypes = $allowedTypes; - } - /** * Return array representation of collection. * - * @return AllowedType[] Array of collection items + * @return array Array of collection items * * @api */ @@ -338,12 +275,11 @@ class StrictCollection implements ArrayAccess, Countable, Serializable { if (!$this->isList()) { throw new DomainException( - 'Cannot convert into list: collection contains non-integer and/or non-consecutive keys.' + 'Cannot convert into StrictList: collection contains non-integer and/or non-consecutive keys.' ); } - $strictList = new StrictList($this->allowedTypes); - $items = $this->toArray(); - $strictList->append(...$items); + $strictList = new StrictList($this->getAllowedTypes()); + $strictList->append(...$this->toArray()); return $strictList; } @@ -361,18 +297,6 @@ class StrictCollection implements ArrayAccess, Countable, Serializable $this->__unserialize($dataArray); } - /** - * Magic getter method for $this->allowedTypes. - * - * @return string[] The list of allowed data types - * - * @internal - */ - protected function _magicGetAllowedTypes(): array - { - return $this->getAllowedTypes(); - } - /** * Create a type-sensitive collection of items. * @@ -425,8 +349,8 @@ class StrictCollection implements ArrayAccess, Countable, Serializable public function __serialize(): array { return [ - 'StrictCollection::allowedTypes' => $this->allowedTypes, - 'StrictCollection::items' => $this->_data + 'StrictCollection::allowedTypes' => $this->getAllowedTypes(), + 'StrictCollection::items' => $this->toArray() ]; } @@ -446,7 +370,7 @@ class StrictCollection implements ArrayAccess, Countable, Serializable /** @var string[] $allowedTypes */ $allowedTypes = $data['StrictCollection::allowedTypes']; $this->setAllowedTypes($allowedTypes); - /** @var AllowedType[] $items */ + /** @var array $items */ $items = $data['StrictCollection::items']; foreach ($items as $offset => $value) { $this->offsetSet($offset, $value); diff --git a/doc/files/src/DataStructures/StrictList.php.txt b/doc/files/src/DataStructures/StrictList.php.txt index db1ec77..be8f407 100644 --- a/doc/files/src/DataStructures/StrictList.php.txt +++ b/doc/files/src/DataStructures/StrictList.php.txt @@ -23,46 +23,8 @@ declare(strict_types=1); namespace OCC\Basics\DataStructures; -use ArrayAccess; -use Countable; -use InvalidArgumentException; -use Iterator; -use OutOfRangeException; -use RangeException; -use RuntimeException; +use OCC\Basics\DataStructures\Traits\StrictSplDatastructureTrait; use SplDoublyLinkedList; -use OCC\Basics\Traits\Getter; -use Serializable; - -use function array_map; -use function array_sum; -use function count; -use function function_exists; -use function get_debug_type; -use function in_array; -use function is_a; -use function is_array; -use function is_bool; -use function is_callable; -use function is_countable; -use function is_double; -use function is_float; -use function is_int; -use function is_integer; -use function is_iterable; -use function is_long; -use function is_null; -use function is_numeric; -use function is_resource; -use function is_scalar; -use function is_string; -use function is_object; -use function iterator_to_array; -use function ltrim; -use function range; -use function serialize; -use function sprintf; -use function unserialize; /** * A type-sensitive, taversable list. @@ -74,709 +36,13 @@ use function unserialize; * @author Sebastian Meyer * @package Basics\DataStructures * - * @property-read string[] $allowedTypes The allowed data types for values. - * * @api * * @template AllowedType of mixed * @extends SplDoublyLinkedList - * @implements ArrayAccess - * @implements Iterator */ -class StrictList extends SplDoublyLinkedList implements ArrayAccess, Countable, Iterator, Serializable +class StrictList extends SplDoublyLinkedList { - use Getter; - - /** - * The allowed data types for list items. - * - * @var string[] - * - * @internal - */ - protected array $allowedTypes = []; - - /** - * Add/insert a new item at the specified offset. - * - * @param int $offset The offset where the new item is to be inserted - * @param AllowedType $value The new item for the offset - * - * @return void - * - * @throws InvalidArgumentException if `$value` is not of allowed type - * @throws OutOfRangeException when `$offset` is out of bounds - * - * @api - */ - public function add(int $offset, mixed $value): void - { - $this->offsetSet($offset, $value); - } - - /** - * Append items at the end of the list. - * - * @param AllowedType ...$values One or more items to append - * - * @return void - * - * @throws InvalidArgumentException if any `$values` is not of allowed type - * - * @api - */ - public function append(mixed ...$values): void - { - /** @var array $values */ - foreach ($values as $count => $value) { - if (!$this->isAllowedType($value)) { - throw new InvalidArgumentException( - sprintf( - 'Parameter %d must be an allowed type, %s given.', - $count + 1, - get_debug_type($value) - ) - ); - } - } - foreach ($values as $value) { - parent::push($value); - } - } - - /** - * Peek at the item at the beginning of the list. - * - * @return AllowedType The first item of the list - * - * @throws RuntimeException if the list is empty - * - * @api - */ - public function bottom(): mixed - { - return parent::bottom(); - } - - /** - * Clear the list of any items. - * - * @return void - * - * @api - */ - public function clear(): void - { - while (!$this->isEmpty()) { - $this->pop(); - } - $this->rewind(); - } - - /** - * Get the number of items on the list. - * - * @return int The number of items on the list - * - * @api - */ - public function count(): int - { - return parent::count(); - } - - /** - * Get the current list item. - * - * @return AllowedType The current item - * - * @api - */ - public function current(): mixed - { - return parent::current(); - } - - /** - * Get the item at the specified index. - * - * @param int $offset The item's index - * - * @return AllowedType The item - * - * @throws OutOfRangeException when `$offset` is out of bounds - * - * @api - */ - public function get(int $offset): mixed - { - return $this->offsetGet($offset); - } - - /** - * Get allowed data types for list items. - * - * @return string[] The list of allowed data types - * - * @api - */ - public function getAllowedTypes(): array - { - return $this->allowedTypes; - } - - /** - * Get the mode of iteration. - * - * @return int The set of flags and modes of iteration - * - * @api - */ - public function getIteratorMode(): int - { - return parent::getIteratorMode(); - } - - /** - * Check if the item's data type is allowed on the list. - * - * @param AllowedType $value The item to check - * - * @return bool Whether the item's data type is allowed - * - * @api - */ - public function isAllowedType(mixed $value): bool - { - if (count($this->allowedTypes) === 0) { - return true; - } - foreach ($this->allowedTypes as $type) { - $function = 'is_' . $type; - if (function_exists($function) && $function($value)) { - return true; - } - /** @var class-string $fqcn */ - $fqcn = ltrim($type, '\\'); - if (is_object($value) && is_a($value, $fqcn)) { - return true; - } - } - return false; - } - - /** - * Check if list is empty. - * - * @return bool Whether the list contains no items - * - * @api - */ - public function isEmpty(): bool - { - return parent::isEmpty(); - } - - /** - * Check if this can be considered a list. - * - * @return true Always TRUE (this exists only for compatibility reasons) - * - * @api - */ - public function isList(): bool - { - return true; - } - - /** - * Get the current list index. - * - * @return int The current list index - * - * @api - */ - public function key(): int - { - return parent::key(); - } - - /** - * Move the cursor to the next list index. - * - * @return void - * - * @api - */ - public function next(): void - { - parent::next(); - } - - /** - * Check if the specified index exists and is not empty. - * - * @param int $offset The index to check - * - * @return bool Whether the index exists and is not empty - * - * @api - */ - public function offsetExists(mixed $offset): bool - { - return parent::offsetExists($offset); - } - - /** - * Get the item from the specified index. - * - * @param int $offset The item's index - * - * @return AllowedType The item - * - * @throws OutOfRangeException when `$offset` is out of bounds - * - * @api - */ - public function offsetGet(mixed $offset): mixed - { - return parent::offsetGet($offset); - } - - /** - * Set the item at the specified offset. - * - * @param ?int $offset The offset being set or NULL to append - * @param AllowedType $value The new item for the offset - * - * @return void - * - * @throws InvalidArgumentException if `$value` is not of allowed type - * @throws OutOfRangeException when `$offset` is out of bounds - * - * @api - */ - public function offsetSet(mixed $offset, mixed $value): void - { - if (!$this->isAllowedType($value)) { - throw new InvalidArgumentException( - sprintf( - 'Parameter 2 must be an allowed type, %s given.', - get_debug_type($value) - ) - ); - } - /** @psalm-suppress PossiblyNullArgument */ - parent::offsetSet($offset, $value); - } - - /** - * Unset the item at the specified index. - * - * @param int $offset The item's index - * - * @return void - * - * @throws OutOfRangeException when `$offset` is out of bounds - * - * @api - */ - public function offsetUnset(mixed $offset): void - { - parent::offsetUnset($offset); - } - - /** - * Pops an item from the end of the list. - * - * @return AllowedType The item from the end of the list - * - * @throws RuntimeException if the list is empty - * - * @api - */ - public function pop(): mixed - { - return parent::pop(); - } - - /** - * Prepend items at the start of the list. - * - * @param AllowedType ...$values One or more items to prepend - * - * @return void - * - * @throws InvalidArgumentException if `$value` is not of allowed type - * - * @api - */ - public function prepend(mixed ...$values): void - { - /** @var array $values */ - foreach ($values as $count => $value) { - if (!$this->isAllowedType($value)) { - throw new InvalidArgumentException( - sprintf( - 'Parameter %d must be an allowed type, %s given.', - $count + 1, - get_debug_type($value) - ) - ); - } - } - foreach ($values as $value) { - parent::unshift($value); - } - } - - /** - * Move the cursor to the previous list index. - * - * @return void - * - * @api - */ - public function prev(): void - { - parent::prev(); - } - - /** - * Push an item at the end of the list. - * - * @param AllowedType $value The item to push - * - * @return void - * - * @throws InvalidArgumentException if `$value` is not of allowed type - * - * @api - */ - public function push(mixed $value): void - { - if (!$this->isAllowedType($value)) { - throw new InvalidArgumentException( - sprintf( - 'Parameter 1 must be an allowed type, %s given.', - get_debug_type($value) - ) - ); - } - parent::push($value); - } - - /** - * Remove an item from the list. - * - * @param int $offset The item's index - * - * @return void - * - * @throws OutOfRangeException when `$offset` is out of bounds - * - * @api - */ - public function remove(int $offset): void - { - $this->offsetUnset($offset); - } - - /** - * Rewind the iterator's cursor. - * - * @return void - * - * @api - */ - public function rewind(): void - { - parent::rewind(); - } - - /** - * Get string representation of $this. - * - * @return string The string representation - * - * @internal - */ - public function serialize(): string - { - return serialize($this->__serialize()); - } - - /** - * Set an item at the specified index. - * - * @param int $offset The item's index - * @param AllowedType $value The item - * - * @return void - * - * @throws InvalidArgumentException if `$value` is not of allowed type - * - * @api - */ - public function set(int $offset, mixed $value): void - { - $this->offsetSet($offset, $value); - } - - /** - * Set allowed data types of list items. - * - * @param string[] $allowedTypes Allowed data types of items - * - * @return void - * - * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string - */ - protected function setAllowedTypes(array $allowedTypes = []): void - { - if (array_sum(array_map('is_string', $allowedTypes)) !== count($allowedTypes)) { - throw new InvalidArgumentException( - 'Allowed types must be array of strings or empty array.' - ); - } - $this->allowedTypes = $allowedTypes; - } - - /** - * Set the mode of iteration. - * - * @param int $mode The new iterator mode (0, 1, 2 or 3) - * - * There are two orthogonal sets of modes that can be set. - * - * The direction of iteration (either one or the other): - * - StrictList::IT_MODE_FIFO (queue style) - * - StrictList::IT_MODE_LIFO (stack style) - * - * The behavior of the iterator (either one or the other): - * - StrictList::IT_MODE_DELETE (delete items) - * - StrictList::IT_MODE_KEEP (keep items) - * - * The default mode is: IT_MODE_FIFO | IT_MODE_KEEP - * - * @return int The set of flags and modes of iteration - * - * @throws RangeException if an invalid `$mode` is given - * - * @api - */ - public function setIteratorMode(int $mode): int - { - if (!in_array($mode, range(0, 3), true)) { - throw new RangeException( - sprintf( - 'Iterator mode must be an integer in range [0..3], %d given.', - $mode - ) - ); - } - return parent::setIteratorMode($mode); - } - - /** - * Shift an item from the beginning of the list. - * - * @return AllowedType The first item of the list - * - * @throws RuntimeException if the list is empty - * - * @api - */ - public function shift(): mixed - { - return parent::shift(); - } - - /** - * Return array representation of list. - * - * @return AllowedType[] Array of list items - * - * @api - */ - public function toArray(): array - { - return iterator_to_array($this, true); - } - - /** - * Turn list into a type-sensitive collection. - * - * @return StrictCollection A type-sensitive collection of the list's items - * - * @api - */ - public function toStrictCollection(): StrictCollection - { - $strictCollection = new StrictCollection($this->allowedTypes); - foreach ($this->toArray() as $offset => $value) { - $strictCollection[$offset] = $value; - } - return $strictCollection; - } - - /** - * Peek at the item at the end of the list. - * - * @return AllowedType The last item of the list - * - * @throws RuntimeException if the list is empty - * - * @api - */ - public function top(): mixed - { - return parent::top(); - } - - /** - * Restore $this from string representation. - * - * @param string $data The string representation - * - * @return void - * - * @internal - */ - public function unserialize($data): void - { - /** @var mixed[] $dataArray */ - $dataArray = unserialize($data); - $this->__unserialize($dataArray); - } - - /** - * Prepend the list with an item. - * - * @param AllowedType $value The item to unshift - * - * @return void - * - * @throws InvalidArgumentException if `$value` is not of allowed type - * - * @api - */ - public function unshift(mixed $value): void - { - if (!$this->isAllowedType($value)) { - throw new InvalidArgumentException( - sprintf( - 'Parameter 1 must be an allowed type, %s given.', - get_debug_type($value) - ) - ); - } - parent::unshift($value); - } - - /** - * Check if current cursor position is valid. - * - * @return bool Whether the current cursor position is valid - * - * @api - */ - public function valid(): bool - { - return parent::valid(); - } - - /** - * Magic getter method for $this->allowedTypes. - * - * @return string[] The list of allowed data types - * - * @internal - */ - protected function _magicGetAllowedTypes(): array - { - return $this->getAllowedTypes(); - } - - /** - * Create a type-sensitive, traversable list of items. - * - * @param string[] $allowedTypes Allowed data types of items (optional) - * - * If empty, all types are allowed. - * Possible values are: - * - "array" - * - "bool" - * - "callable" - * - "countable" - * - "float" or "double" - * - "int" or "integer" or "long" - * - "iterable" - * - "null" - * - "numeric" - * - "object" or FQCN - * - "resource" - * - "scalar" - * - "string" - * - * @return void - * - * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string - */ - public function __construct(array $allowedTypes = []) - { - $this->setAllowedTypes($allowedTypes); - } - - /** - * Get debug information for $this. - * - * @return mixed[] The debug information - * - * @internal - */ - public function __debugInfo(): array - { - return $this->__serialize(); - } - - /** - * Get array representation of $this. - * - * @return mixed[] The array representation - * - * @internal - */ - public function __serialize(): array - { - return [ - 'StrictList::allowedTypes' => $this->allowedTypes, - 'SplDoublyLinkedList::dllist' => iterator_to_array($this), - 'SplDoublyLinkedList::flags' => $this->getIteratorMode() - ]; - } - - /** - * Restore $this from array representation. - * - * @param mixed[] $data The array representation - * - * @return void - * - * @internal - * - * @psalm-suppress MethodSignatureMismatch - */ - public function __unserialize(array $data): void - { - /** @var string[] $allowedTypes */ - $allowedTypes = $data['StrictList::allowedTypes']; - $this->setAllowedTypes($allowedTypes); - /** @var array $values */ - $values = $data['SplDoublyLinkedList::dllist']; - $this->append(...$values); - /** @var int $flags */ - $flags = $data['SplDoublyLinkedList::flags']; - $this->setIteratorMode($flags); - } + /** @use StrictSplDatastructureTrait */ + use StrictSplDatastructureTrait; } diff --git a/doc/files/src/DataStructures/StrictQueue.php.txt b/doc/files/src/DataStructures/StrictQueue.php.txt index f132fd7..266fa7c 100644 --- a/doc/files/src/DataStructures/StrictQueue.php.txt +++ b/doc/files/src/DataStructures/StrictQueue.php.txt @@ -23,24 +23,16 @@ declare(strict_types=1); namespace OCC\Basics\DataStructures; -use ArrayAccess; -use Countable; -use InvalidArgumentException; -use Iterator; -use RangeException; -use RuntimeException; -use Serializable; - -use function sprintf; +use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; +use OCC\Basics\DataStructures\Traits\StrictSplDatastructureTrait; +use SplQueue; /** * A type-sensitive, taversable queue (FIFO). * - * Extends [\SplDoublyLinkedList](https://www.php.net/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. It - * also restricts the iterator direction to first-in, first-out (FIFO) exactly - * like [\SplQueue](https://www.php.net/splqueue). + * Extends [\SplQueue](https://www.php.net/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. * * @author Sebastian Meyer * @package Basics\DataStructures @@ -48,23 +40,12 @@ use function sprintf; * @api * * @template AllowedType of mixed - * @extends StrictList - * @implements ArrayAccess - * @implements Iterator + * @extends SplQueue */ -class StrictQueue extends StrictList implements ArrayAccess, Countable, Iterator, Serializable +class StrictQueue extends SplQueue { - /** - * Dequeue an item from the queue. - * - * @return AllowedType The dequeued item - * - * @api - */ - public function dequeue(): mixed - { - return parent::shift(); - } + /** @use StrictSplDatastructureTrait */ + use StrictSplDatastructureTrait; /** * Add an item to the queue. @@ -73,79 +54,12 @@ class StrictQueue extends StrictList implements ArrayAccess, Countable, Iterator * * @return void * - * @throws InvalidArgumentException if `$value` is not of allowed type + * @throws InvalidDataTypeException if `$value` is not of allowed type * * @api */ public function enqueue(mixed $value): void { - parent::push($value); - } - - /** - * Set the mode of iteration. - * - * @param int $mode The new iterator mode (0 or 1) - * - * There are two orthogonal sets of modes that can be set. - * - * The direction of iteration (fixed for StrictQueue): - * - StrictQueue::IT_MODE_FIFO (queue style) - * - * The behavior of the iterator (either one or the other): - * - StrictQueue::IT_MODE_DELETE (delete items) - * - StrictQueue::IT_MODE_KEEP (keep items) - * - * The default mode is: IT_MODE_FIFO | IT_MODE_KEEP - * - * @return int The set of flags and modes of iteration - * - * @throws RangeException if an invalid `$mode` is given - * @throws RuntimeException if trying to change iterator direction - * - * @api - */ - final public function setIteratorMode(int $mode): int - { - if ($mode > 1) { - throw new RuntimeException( - sprintf( - 'Changing the iterator direction of %s is prohibited.', - static::class - ) - ); - } - return parent::setIteratorMode($mode); - } - - /** - * Create a type-sensitive, traversable queue of items. - * - * @param string[] $allowedTypes Allowed data types of items (optional) - * - * If empty, all types are allowed. - * Possible values are: - * - "array" - * - "bool" - * - "callable" - * - "countable" - * - "float" or "double" - * - "int" or "integer" or "long" - * - "iterable" - * - "null" - * - "numeric" - * - "object" or FQCN - * - "resource" - * - "scalar" - * - "string" - * - * @return void - * - * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string - */ - public function __construct(array $allowedTypes = []) - { - parent::__construct($allowedTypes); - $this->setIteratorMode(0); + $this->push($value); } } diff --git a/doc/files/src/DataStructures/StrictSplDatastructureTrait.php.txt b/doc/files/src/DataStructures/StrictSplDatastructureTrait.php.txt new file mode 100644 index 0000000..8608abc --- /dev/null +++ b/doc/files/src/DataStructures/StrictSplDatastructureTrait.php.txt @@ -0,0 +1,420 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\Basics\DataStructures; + +use InvalidArgumentException; +use OCC\Basics\Traits\TypeChecker; +use OutOfRangeException; + +use function get_debug_type; +use function iterator_to_array; +use function serialize; +use function sprintf; +use function unserialize; + +/** + * 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](https://www.php.net/spl.datastructures) + * by type-checking to only allow specified data types on the list. + * + * @author Sebastian Meyer + * @package Basics\DataStructures + * + * @template AllowedType of mixed + */ +trait StrictSplDatastructureTrait +{ + use TypeChecker { + setAllowedTypes as protected; + } + + /** + * Add/insert a new item at the specified offset. + * + * @param int $offset The offset where the new item is to be inserted + * @param AllowedType $value The new item for the offset + * + * @return void + * + * @throws InvalidArgumentException if `$value` is not of allowed type + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function add(int $offset, mixed $value): void + { + $this->offsetSet($offset, $value); + } + + /** + * Append items at the end of the list. + * + * @param AllowedType ...$values One or more items to append + * + * @return void + * + * @throws InvalidArgumentException if any `$values` is not of allowed type + * + * @api + */ + public function append(mixed ...$values): void + { + /** @var array $values */ + foreach ($values as $count => $value) { + if (!$this->hasAllowedType($value)) { + throw new InvalidArgumentException( + sprintf( + 'Parameter %d must be an allowed type, %s given.', + $count + 1, + get_debug_type($value) + ) + ); + } + } + foreach ($values as $value) { + parent::push($value); + } + } + + /** + * Clear the list of any items. + * + * @return void + * + * @api + */ + public function clear(): void + { + while (!$this->isEmpty()) { + $this->pop(); + } + $this->rewind(); + } + + /** + * Get the item at the specified index. + * + * @param int $offset The item's index + * + * @return AllowedType The item + * + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function get(int $offset): mixed + { + return $this->offsetGet($offset); + } + + /** + * Check if this can be considered a list. + * + * @return true Always TRUE (this exists only for compatibility reasons) + * + * @api + */ + public function isList(): bool + { + return true; + } + + /** + * Set the item at the specified offset. + * + * @param ?int $offset The offset being set or NULL to append + * @param AllowedType $value The new item for the offset + * + * @return void + * + * @throws InvalidArgumentException if `$value` is not of allowed type + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (!$this->hasAllowedType($value)) { + throw new InvalidArgumentException( + sprintf( + 'Parameter 2 must be an allowed type, %s given.', + get_debug_type($value) + ) + ); + } + /** @psalm-suppress PossiblyNullArgument */ + parent::offsetSet($offset, $value); + } + + /** + * Prepend items at the start of the list. + * + * @param AllowedType ...$values One or more items to prepend + * + * @return void + * + * @throws InvalidArgumentException if `$value` is not of allowed type + * + * @api + */ + public function prepend(mixed ...$values): void + { + /** @var array $values */ + foreach ($values as $count => $value) { + if (!$this->hasAllowedType($value)) { + throw new InvalidArgumentException( + sprintf( + 'Parameter %d must be an allowed type, %s given.', + $count + 1, + get_debug_type($value) + ) + ); + } + } + foreach ($values as $value) { + parent::unshift($value); + } + } + + /** + * Push an item at the end of the list. + * + * @param AllowedType $value The item to push + * + * @return void + * + * @throws InvalidArgumentException if `$value` is not of allowed type + * + * @api + */ + public function push(mixed $value): void + { + if (!$this->hasAllowedType($value)) { + throw new InvalidArgumentException( + sprintf( + 'Parameter 1 must be an allowed type, %s given.', + get_debug_type($value) + ) + ); + } + parent::push($value); + } + + /** + * Remove an item from the list. + * + * @param int $offset The item's index + * + * @return void + * + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function remove(int $offset): void + { + $this->offsetUnset($offset); + } + + /** + * Get string representation of $this. + * + * @return string The string representation + * + * @internal + */ + public function serialize(): string + { + return serialize($this->__serialize()); + } + + /** + * Set an item at the specified index. + * + * @param int $offset The item's index + * @param AllowedType $value The item + * + * @return void + * + * @throws InvalidArgumentException if `$value` is not of allowed type + * + * @api + */ + public function set(int $offset, mixed $value): void + { + $this->offsetSet($offset, $value); + } + + /** + * Return array representation of list. + * + * @return array Array of list items + * + * @api + */ + public function toArray(): array + { + return iterator_to_array($this, true); + } + + /** + * Turn list into a type-sensitive collection. + * + * @return StrictCollection A type-sensitive collection of the list's items + * + * @api + */ + public function toStrictCollection(): StrictCollection + { + $strictCollection = new StrictCollection($this->getAllowedTypes()); + foreach ($this->toArray() as $offset => $value) { + $strictCollection[$offset] = $value; + } + return $strictCollection; + } + + /** + * Restore $this from string representation. + * + * @param string $data The string representation + * + * @return void + * + * @internal + */ + public function unserialize($data): void + { + /** @var mixed[] $dataArray */ + $dataArray = unserialize($data); + $this->__unserialize($dataArray); + } + + /** + * Prepend the list with an item. + * + * @param AllowedType $value The item to unshift + * + * @return void + * + * @throws InvalidArgumentException if `$value` is not of allowed type + * + * @api + */ + public function unshift(mixed $value): void + { + if (!$this->hasAllowedType($value)) { + throw new InvalidArgumentException( + sprintf( + 'Parameter 1 must be an allowed type, %s given.', + get_debug_type($value) + ) + ); + } + parent::unshift($value); + } + + /** + * Create a type-sensitive, traversable list of items. + * + * @param string[] $allowedTypes Allowed data types of items (optional) + * + * If empty, all types are allowed. + * Possible values are: + * - "array" + * - "bool" + * - "callable" + * - "countable" + * - "float" or "double" + * - "int" or "integer" or "long" + * - "iterable" + * - "null" + * - "numeric" + * - "object" or FQCN + * - "resource" + * - "scalar" + * - "string" + * + * @return void + * + * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string + */ + public function __construct(array $allowedTypes = []) + { + $this->setAllowedTypes($allowedTypes); + } + + /** + * Get debug information for $this. + * + * @return mixed[] The debug information + * + * @internal + */ + public function __debugInfo(): array + { + return $this->__serialize(); + } + + /** + * Get array representation of $this. + * + * @return mixed[] The array representation + * + * @internal + */ + public function __serialize(): array + { + return [ + 'StrictSplDatastructure::allowedTypes' => $this->getAllowedTypes(), + 'StrictSplDatastructure::dllist' => $this->toArray(), + 'StrictSplDatastructure::flags' => $this->getIteratorMode() + ]; + } + + /** + * Restore $this from array representation. + * + * @param mixed[] $data The array representation + * + * @return void + * + * @internal + * + * @psalm-suppress MethodSignatureMismatch + */ + public function __unserialize(array $data): void + { + /** @var string[] $allowedTypes */ + $allowedTypes = $data['StrictSplDatastructure::allowedTypes']; + $this->setAllowedTypes($allowedTypes); + /** @var array $values */ + $values = $data['StrictSplDatastructure::dllist']; + $this->append(...$values); + /** @var int $flags */ + $flags = $data['StrictSplDatastructure::flags']; + $this->setIteratorMode($flags); + } +} diff --git a/doc/files/src/DataStructures/StrictStack.php.txt b/doc/files/src/DataStructures/StrictStack.php.txt index 357897e..8ec5cda 100644 --- a/doc/files/src/DataStructures/StrictStack.php.txt +++ b/doc/files/src/DataStructures/StrictStack.php.txt @@ -23,24 +23,17 @@ declare(strict_types=1); namespace OCC\Basics\DataStructures; -use ArrayAccess; -use Countable; -use InvalidArgumentException; -use Iterator; -use RangeException; +use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; +use OCC\Basics\DataStructures\Traits\StrictSplDatastructureTrait; use RuntimeException; -use Serializable; - -use function sprintf; +use SplStack; /** * A type-sensitive, taversable stack (LIFO). * - * Extends [\SplDoublyLinkedList](https://www.php.net/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. It - * also restricts the iterator direction to last-in, first-out (LIFO) exactly - * like [\SplStack](https://www.php.net/splstack). + * Extends [\SplStack](https://www.php.net/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. * * @author Sebastian Meyer * @package Basics\DataStructures @@ -48,12 +41,13 @@ use function sprintf; * @api * * @template AllowedType of mixed - * @extends StrictList - * @implements ArrayAccess - * @implements Iterator + * @extends SplStack */ -class StrictStack extends StrictList implements ArrayAccess, Countable, Iterator, Serializable +class StrictStack extends SplStack { + /** @use StrictSplDatastructureTrait */ + use StrictSplDatastructureTrait; + /** * Add an item to the stack. * @@ -61,13 +55,13 @@ class StrictStack extends StrictList implements ArrayAccess, Countable, Iterator * * @return void * - * @throws InvalidArgumentException if `$value` is not of allowed type + * @throws InvalidDataTypeException if `$value` is not of allowed type * * @api */ public function stack(mixed $value): void { - parent::push($value); + $this->push($value); } /** @@ -75,77 +69,12 @@ class StrictStack extends StrictList implements ArrayAccess, Countable, Iterator * * @return AllowedType The unstacked item * + * @throws RuntimeException if the list is empty + * * @api */ public function unstack(): mixed { - return parent::pop(); - } - - /** - * Set the mode of iteration. - * - * @param int $mode The new iterator mode (2 or 3) - * - * There are two orthogonal sets of modes that can be set. - * - * The direction of iteration (fixed for StrictStack): - * - StrictStack::IT_MODE_LIFO (stack style) - * - * The behavior of the iterator (either one or the other): - * - StrictStack::IT_MODE_DELETE (delete items) - * - StrictStack::IT_MODE_KEEP (keep items) - * - * The default mode is: IT_MODE_LIFO | IT_MODE_KEEP - * - * @return int The set of flags and modes of iteration - * - * @throws RangeException if an invalid `$mode` is given - * @throws RuntimeException if trying to change iterator direction - * - * @api - */ - final public function setIteratorMode(int $mode): int - { - if ($mode < 2) { - throw new RuntimeException( - sprintf( - 'Changing the iterator direction of %s is prohibited.', - static::class - ) - ); - } - return parent::setIteratorMode($mode); - } - - /** - * Create a type-sensitive, traversable stack of items. - * - * @param string[] $allowedTypes Allowed data types of items (optional) - * - * If empty, all types are allowed. - * Possible values are: - * - "array" - * - "bool" - * - "callable" - * - "countable" - * - "float" or "double" - * - "int" or "integer" or "long" - * - "iterable" - * - "null" - * - "numeric" - * - "object" or FQCN - * - "resource" - * - "scalar" - * - "string" - * - * @return void - * - * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string - */ - public function __construct(array $allowedTypes = []) - { - parent::__construct($allowedTypes); - $this->setIteratorMode(2); + return $this->pop(); } } diff --git a/doc/files/src/DataStructures/Traits/StrictSplDatastructureTrait.php.txt b/doc/files/src/DataStructures/Traits/StrictSplDatastructureTrait.php.txt new file mode 100644 index 0000000..982223a --- /dev/null +++ b/doc/files/src/DataStructures/Traits/StrictSplDatastructureTrait.php.txt @@ -0,0 +1,422 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\Basics\DataStructures\Traits; + +use InvalidArgumentException; +use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; +use OCC\Basics\DataStructures\StrictCollection; +use OCC\Basics\Traits\TypeChecker; +use OutOfRangeException; + +use function get_debug_type; +use function iterator_to_array; +use function serialize; +use function sprintf; +use function unserialize; + +/** + * 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](https://www.php.net/spl.datastructures) + * by type-checking to only allow specified data types on the list. + * + * @author Sebastian Meyer + * @package Basics\DataStructures + * + * @template AllowedType of mixed + */ +trait StrictSplDatastructureTrait +{ + use TypeChecker { + setAllowedTypes as protected; + } + + /** + * Add/insert a new item at the specified offset. + * + * @param int $offset The offset where the new item is to be inserted + * @param AllowedType $value The new item for the offset + * + * @return void + * + * @throws InvalidDataTypeException if `$value` is not of allowed type + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function add(int $offset, mixed $value): void + { + $this->offsetSet($offset, $value); + } + + /** + * Append items at the end of the list. + * + * @param AllowedType ...$values One or more items to append + * + * @return void + * + * @throws InvalidDataTypeException if any `$values` is not of allowed type + * + * @api + */ + public function append(mixed ...$values): void + { + /** @var array $values */ + foreach ($values as $count => $value) { + if (!$this->hasAllowedType($value)) { + throw new InvalidDataTypeException( + sprintf( + 'Parameter %d must be an allowed type, %s given.', + $count + 1, + get_debug_type($value) + ) + ); + } + } + foreach ($values as $value) { + parent::push($value); + } + } + + /** + * Clear the list of any items. + * + * @return void + * + * @api + */ + public function clear(): void + { + while (!$this->isEmpty()) { + $this->pop(); + } + $this->rewind(); + } + + /** + * Get the item at the specified index. + * + * @param int $offset The item's index + * + * @return AllowedType The item + * + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function get(int $offset): mixed + { + return $this->offsetGet($offset); + } + + /** + * Check if this can be considered a list. + * + * @return true Always TRUE (this exists only for compatibility reasons) + * + * @api + */ + public function isList(): bool + { + return true; + } + + /** + * Set the item at the specified offset. + * + * @param ?int $offset The offset being set or NULL to append + * @param AllowedType $value The new item for the offset + * + * @return void + * + * @throws InvalidDataTypeException if `$value` is not of allowed type + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function offsetSet(mixed $offset, mixed $value): void + { + if (!$this->hasAllowedType($value)) { + throw new InvalidDataTypeException( + sprintf( + 'Parameter 2 must be an allowed type, %s given.', + get_debug_type($value) + ) + ); + } + /** @psalm-suppress PossiblyNullArgument */ + parent::offsetSet($offset, $value); + } + + /** + * Prepend items at the start of the list. + * + * @param AllowedType ...$values One or more items to prepend + * + * @return void + * + * @throws InvalidDataTypeException if `$value` is not of allowed type + * + * @api + */ + public function prepend(mixed ...$values): void + { + /** @var array $values */ + foreach ($values as $count => $value) { + if (!$this->hasAllowedType($value)) { + throw new InvalidDataTypeException( + sprintf( + 'Parameter %d must be an allowed type, %s given.', + $count + 1, + get_debug_type($value) + ) + ); + } + } + foreach ($values as $value) { + parent::unshift($value); + } + } + + /** + * Push an item at the end of the list. + * + * @param AllowedType $value The item to push + * + * @return void + * + * @throws InvalidDataTypeException if `$value` is not of allowed type + * + * @api + */ + public function push(mixed $value): void + { + if (!$this->hasAllowedType($value)) { + throw new InvalidDataTypeException( + sprintf( + 'Parameter 1 must be an allowed type, %s given.', + get_debug_type($value) + ) + ); + } + parent::push($value); + } + + /** + * Remove an item from the list. + * + * @param int $offset The item's index + * + * @return void + * + * @throws OutOfRangeException when `$offset` is out of bounds + * + * @api + */ + public function remove(int $offset): void + { + $this->offsetUnset($offset); + } + + /** + * Get string representation of $this. + * + * @return string The string representation + * + * @internal + */ + public function serialize(): string + { + return serialize($this->__serialize()); + } + + /** + * Set an item at the specified index. + * + * @param int $offset The item's index + * @param AllowedType $value The item + * + * @return void + * + * @throws InvalidDataTypeException if `$value` is not of allowed type + * + * @api + */ + public function set(int $offset, mixed $value): void + { + $this->offsetSet($offset, $value); + } + + /** + * Return array representation of list. + * + * @return array Array of list items + * + * @api + */ + public function toArray(): array + { + return iterator_to_array($this, true); + } + + /** + * Turn list into a type-sensitive collection. + * + * @return StrictCollection A type-sensitive collection of the list's items + * + * @api + */ + public function toStrictCollection(): StrictCollection + { + $strictCollection = new StrictCollection($this->getAllowedTypes()); + foreach ($this->toArray() as $offset => $value) { + $strictCollection[$offset] = $value; + } + return $strictCollection; + } + + /** + * Restore $this from string representation. + * + * @param string $data The string representation + * + * @return void + * + * @internal + */ + public function unserialize($data): void + { + /** @var mixed[] $dataArray */ + $dataArray = unserialize($data); + $this->__unserialize($dataArray); + } + + /** + * Prepend the list with an item. + * + * @param AllowedType $value The item to unshift + * + * @return void + * + * @throws InvalidDataTypeException if `$value` is not of allowed type + * + * @api + */ + public function unshift(mixed $value): void + { + if (!$this->hasAllowedType($value)) { + throw new InvalidDataTypeException( + sprintf( + 'Parameter 1 must be an allowed type, %s given.', + get_debug_type($value) + ) + ); + } + parent::unshift($value); + } + + /** + * Create a type-sensitive, traversable list of items. + * + * @param string[] $allowedTypes Allowed data types of items (optional) + * + * If empty, all types are allowed. + * Possible values are: + * - "array" + * - "bool" + * - "callable" + * - "countable" + * - "float" or "double" + * - "int" or "integer" or "long" + * - "iterable" + * - "null" + * - "numeric" + * - "object" or FQCN + * - "resource" + * - "scalar" + * - "string" + * + * @return void + * + * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string + */ + public function __construct(array $allowedTypes = []) + { + $this->setAllowedTypes($allowedTypes); + } + + /** + * Get debug information for $this. + * + * @return mixed[] The debug information + * + * @internal + */ + public function __debugInfo(): array + { + return $this->__serialize(); + } + + /** + * Get array representation of $this. + * + * @return mixed[] The array representation + * + * @internal + */ + public function __serialize(): array + { + return [ + 'StrictSplDatastructure::allowedTypes' => $this->getAllowedTypes(), + 'StrictSplDatastructure::dllist' => $this->toArray(), + 'StrictSplDatastructure::flags' => $this->getIteratorMode() + ]; + } + + /** + * Restore $this from array representation. + * + * @param mixed[] $data The array representation + * + * @return void + * + * @internal + * + * @psalm-suppress MethodSignatureMismatch + */ + public function __unserialize(array $data): void + { + /** @var string[] $allowedTypes */ + $allowedTypes = $data['StrictSplDatastructure::allowedTypes']; + $this->setAllowedTypes($allowedTypes); + /** @var array $values */ + $values = $data['StrictSplDatastructure::dllist']; + $this->append(...$values); + /** @var int $flags */ + $flags = $data['StrictSplDatastructure::flags']; + $this->setIteratorMode($flags); + } +} diff --git a/doc/files/src/Traits/TypeChecker.php.txt b/doc/files/src/Traits/TypeChecker.php.txt new file mode 100644 index 0000000..9a2042a --- /dev/null +++ b/doc/files/src/Traits/TypeChecker.php.txt @@ -0,0 +1,150 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\Basics\Traits; + +use InvalidArgumentException; + +use function array_map; +use function array_sum; +use function array_values; +use function count; +use function function_exists; +use function in_array; +use function is_a; +use function is_array; +use function is_bool; +use function is_callable; +use function is_countable; +use function is_double; +use function is_float; +use function is_int; +use function is_integer; +use function is_iterable; +use function is_long; +use function is_null; +use function is_numeric; +use function is_resource; +use function is_scalar; +use function is_string; +use function is_object; +use function ltrim; + +/** + * 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. + * + * @author Sebastian Meyer + * @package Basics\Traits + * + * @api + */ +trait TypeChecker +{ + /** + * The allowed data types. + * + * @var string[] + * + * @internal + */ + protected array $_allowedTypes = []; + + /** + * Get allowed data types. + * + * @return string[] The list of allowed data types + * + * @api + */ + public function getAllowedTypes(): array + { + return $this->_allowedTypes; + } + + /** + * Check if a value's data type is allowed. + * + * @param mixed $value The value to check + * + * @return bool Whether the value's data type is allowed + * + * @api + */ + public function hasAllowedType(mixed $value): bool + { + if (count($this->getAllowedTypes()) === 0) { + return true; + } + foreach ($this->getAllowedTypes() as $type) { + $function = 'is_' . $type; + if (function_exists($function) && $function($value)) { + return true; + } + /** @var class-string $fqcn */ + $fqcn = ltrim($type, '\\'); + if (is_object($value) && is_a($value, $fqcn)) { + return true; + } + } + return false; + } + + /** + * Check if a data type is allowed. + * + * @param string $type The type to check + * + * @return bool Whether the data type is allowed + * + * @api + */ + public function isAllowedType(string $type): bool + { + return in_array($type, $this->getAllowedTypes(), true); + } + + /** + * Set allowed data types. + * + * @param string[] $allowedTypes Allowed data types + * + * @return void + * + * @throws InvalidArgumentException if any value of `$allowedTypes` is not a string + * + * @api + */ + public function setAllowedTypes(array $allowedTypes = []): void + { + if (array_sum(array_map('is_string', $allowedTypes)) !== count($allowedTypes)) { + throw new InvalidArgumentException( + 'Allowed types must be array of strings or empty array.' + ); + } + $this->_allowedTypes = array_values($allowedTypes); + } +} diff --git a/doc/graphs/classes.html b/doc/graphs/classes.html index ec4f91d..8cb5de0 100644 --- a/doc/graphs/classes.html +++ b/doc/graphs/classes.html @@ -64,6 +64,24 @@

                  Overview

                  +

                  User Guide diff --git a/doc/guides/changelog.html b/doc/guides/changelog.html index b2a7442..6fe3a39 100644 --- a/doc/guides/changelog.html +++ b/doc/guides/changelog.html @@ -77,6 +77,24 @@

                  Overview

                  +

                  User Guide @@ -153,7 +171,12 @@

                  Changelog

                  - +
                  +
                  + +
                  +
                  +

                  v2.0.0

                  @@ -197,7 +220,14 @@ function _magicSet{PascalCasePropertyName}(mixed $value): void
                • Added new trait OverloadingSetter
                • -
                • Extended API for all datastructures
                • +
                • Added new trait TypeChecker +
                • + +
                • Extended API for all datastructures (see StrictSplDatastructureTrait +)
                • + +
                • Introduced InvalidDataTypeException + for strict datastructures
                • Extended documentation
                • diff --git a/doc/guides/index.html b/doc/guides/index.html index fb669ee..a401e0d 100644 --- a/doc/guides/index.html +++ b/doc/guides/index.html @@ -2,8 +2,7 @@ - - PHP Basics + PHP Basics @@ -78,6 +77,24 @@

                  Overview

                  +

                  User Guide @@ -154,7 +171,40 @@

                  Documentation

                  - + +

                  diff --git a/doc/guides/overview/datastructures.html b/doc/guides/overview/datastructures.html new file mode 100644 index 0000000..9531241 --- /dev/null +++ b/doc/guides/overview/datastructures.html @@ -0,0 +1,289 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + + +
                  +

                  PHP Basics

                  + + + + + + +
                  + +
                  +
                  + + + + +
                  +
                  +

                  Typed Datastructures

                  + + + +

                  All datastructures in this package have in common that you can control the types of items they 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 +.

                  +

                  Examples:

                  // create a collection of strings
                  +$stringCollection = new StrictCollection(['string']);
                  +
                  +// create a queue of PSR-15 middlewares
                  +$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 +controlled type.

                  +

                  A StrictCollection can be accessed like an array, but not traversed because it has no particular order. Technically +speaking, StrictCollection implements \ArrayAccess, \Countable and \Serializable, but no \Traversable interface.

                  +
                  + +
                  +

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

                  +
                  +
                  + +
                  + +
                  +

                  StrictList

                  + +
                  +
                  +

                  StrictList

                  +
                  +
                  + +

                  A type-sensitive, taversable list of items.

                  +

                  Extends \SplDoublyLinkedList with an option to restrict the allowed data +types for list items.

                  +
                  + +
                  +

                  StrictQueue

                  + +
                  +
                  +

                  StrictQueue

                  +
                  +
                  + +

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

                  +

                  Extends \SplDoublyLinkedList with an option to restrict the allowed data +types for list items.

                  +
                  + +
                  +

                  StrictStack

                  + +
                  +
                  +

                  StrictStack

                  +
                  +
                  + +

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

                  +

                  Extends \SplDoublyLinkedList with an option to restrict the allowed data +types for list items.

                  +
                  + +
                  + +
                  +
                  +
                  +
                  +

                  Search results

                  + +
                  +
                  +
                    +
                    +
                    +
                    +
                    + + +
                    + + + + + + + + diff --git a/doc/guides/overview/errorhandlers.html b/doc/guides/overview/errorhandlers.html new file mode 100644 index 0000000..c1aa4b3 --- /dev/null +++ b/doc/guides/overview/errorhandlers.html @@ -0,0 +1,225 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + + +
                    +

                    PHP Basics

                    + + + + + + +
                    + +
                    +
                    + + + + +
                    +
                    +

                    Error and Exception Handlers

                    + +
                    + +
                    + +
                    +

                    ThrowErrorException

                    + +

                    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.

                    +

                    > Usage: set_error_handler(new ThrowErrorException());

                    +
                    + +
                    +

                    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());

                    +
                    + +
                    + +
                    +
                    +
                    +
                    +

                    Search results

                    + +
                    +
                    +
                      +
                      +
                      +
                      +
                      + + +
                      + + + + + + + + diff --git a/doc/guides/overview/index.html b/doc/guides/overview/index.html index 31beab0..51e9d41 100644 --- a/doc/guides/overview/index.html +++ b/doc/guides/overview/index.html @@ -77,6 +77,24 @@

                      Overview

                      +

                      User Guide @@ -153,6 +171,64 @@

                      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 +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.

                      + +

                      diff --git a/doc/guides/overview/interfaces.html b/doc/guides/overview/interfaces.html new file mode 100644 index 0000000..d257f28 --- /dev/null +++ b/doc/guides/overview/interfaces.html @@ -0,0 +1,235 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + + +
                      +

                      PHP Basics

                      + + + + + + +
                      + +
                      +
                      + + + + +
                      +
                      +

                      Interface Traits

                      + + + +
                      +

                      ArrayAccessTrait

                      + +

                      A generic implementation of the ArrayAccess interface.

                      +

                      Internally it accesses the protected $_data array.

                      +
                      + +
                      +

                      CountableTrait

                      + +

                      A generic implementation of the Countable interface.

                      +

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

                      +
                      + +
                      +

                      IteratorAggregateTrait

                      + +

                      A generic implementation of the IteratorAggregate interface.

                      +

                      Internally it iterates over the protected $_data array.

                      +
                      + +
                      +

                      IteratorTrait

                      + +

                      A generic implementation of the Iterator interface.

                      +

                      Internally it iterates over the protected $_data array.

                      +
                      + +
                      + +
                      +
                      +
                      +
                      +

                      Search results

                      + +
                      +
                      +
                        +
                        +
                        +
                        +
                        + + +
                        + + + + + + + + diff --git a/doc/guides/overview/traits.html b/doc/guides/overview/traits.html new file mode 100644 index 0000000..0d1e5d8 --- /dev/null +++ b/doc/guides/overview/traits.html @@ -0,0 +1,272 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + + +
                        +

                        PHP Basics

                        + + + + + + +
                        + +
                        +
                        + + + + +
                        +
                        +

                        Traits

                        + + + +
                        +

                        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 letter).

                        +

                        > 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.

                        +
                        + +
                        +

                        OverloadingGetter

                        + +

                        Overloads a class with readable magic properties.

                        +

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

                        +

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

                        +
                        + +
                        +

                        OverloadingSetter

                        + +

                        Overloads a class with writable magic properties.

                        +

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

                        +

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

                        +
                        + +
                        +

                        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 letter).

                        +

                        > 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.

                        +
                        + +
                        +

                        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 (irrespective of the given arguments).

                        +

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

                        +
                        + +
                        +

                        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 check if a value's data type matches +at least one of these types.

                        +
                        + +
                        + +
                        +
                        +
                        +
                        +

                        Search results

                        + +
                        +
                        +
                          +
                          +
                          +
                          +
                          + + +
                          + + + + + + + + diff --git a/doc/guides/usage/index.html b/doc/guides/usage/index.html index f101f71..5f31f4a 100644 --- a/doc/guides/usage/index.html +++ b/doc/guides/usage/index.html @@ -77,6 +77,24 @@

                          Overview

                          +

                          User Guide @@ -153,6 +171,10 @@

                          User Guide

                          +

                          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.

                          T

                          diff --git a/doc/js/searchIndex.js b/doc/js/searchIndex.js index 7f20207..0e06f03 100644 --- a/doc/js/searchIndex.js +++ b/doc/js/searchIndex.js @@ -1,6 +1,11 @@ Search.appendIndex( [ { + "fqsen": "\\OCC\\Basics\\DataStructures\\Exceptions\\InvalidDataTypeException", + "name": "InvalidDataTypeException", + "summary": "Common\u0020exception\u0020for\u0020type\u002Dsensitive\u0020datastructures.", + "url": "classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html" + }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection", "name": "StrictCollection", "summary": "A\u0020type\u002Dsensitive,\u0020unsorted\u0020collection.", @@ -8,7 +13,7 @@ Search.appendIndex( }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003Aadd\u0028\u0029", "name": "add", - "summary": "Add\/insert\u0020a\u0020new\u0020item\u0020at\u0020the\u0020specified\u0020index.", + "summary": "Add\/insert\u0020a\u0020item\u0020at\u0020the\u0020specified\u0020index.", "url": "classes/OCC-Basics-DataStructures-StrictCollection.html#method_add" }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003Aclear\u0028\u0029", @@ -20,16 +25,6 @@ Search.appendIndex( "name": "get", "summary": "Get\u0020the\u0020item\u0020at\u0020the\u0020specified\u0020index.", "url": "classes/OCC-Basics-DataStructures-StrictCollection.html#method_get" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003AgetAllowedTypes\u0028\u0029", - "name": "getAllowedTypes", - "summary": "Get\u0020allowed\u0020data\u0020types\u0020for\u0020collection\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictCollection.html#method_getAllowedTypes" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003AisAllowedType\u0028\u0029", - "name": "isAllowedType", - "summary": "Check\u0020if\u0020the\u0020item\u0027s\u0020data\u0020type\u0020is\u0020allowed\u0020in\u0020the\u0020collection.", - "url": "classes/OCC-Basics-DataStructures-StrictCollection.html#method_isAllowedType" }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003AisEmpty\u0028\u0029", "name": "isEmpty", @@ -60,11 +55,6 @@ Search.appendIndex( "name": "set", "summary": "Set\u0020an\u0020item\u0020at\u0020the\u0020specified\u0020index.", "url": "classes/OCC-Basics-DataStructures-StrictCollection.html#method_set" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003AsetAllowedTypes\u0028\u0029", - "name": "setAllowedTypes", - "summary": "Set\u0020allowed\u0020data\u0020types\u0020of\u0020collection\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictCollection.html#method_setAllowedTypes" }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictCollection\u003A\u003AtoArray\u0028\u0029", "name": "toArray", @@ -90,201 +80,16 @@ Search.appendIndex( "name": "StrictList", "summary": "A\u0020type\u002Dsensitive,\u0020taversable\u0020list.", "url": "classes/OCC-Basics-DataStructures-StrictList.html" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aadd\u0028\u0029", - "name": "add", - "summary": "Add\/insert\u0020a\u0020new\u0020item\u0020at\u0020the\u0020specified\u0020offset.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_add" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aappend\u0028\u0029", - "name": "append", - "summary": "Append\u0020items\u0020at\u0020the\u0020end\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_append" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Abottom\u0028\u0029", - "name": "bottom", - "summary": "Peek\u0020at\u0020the\u0020item\u0020at\u0020the\u0020beginning\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_bottom" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aclear\u0028\u0029", - "name": "clear", - "summary": "Clear\u0020the\u0020list\u0020of\u0020any\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_clear" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Acount\u0028\u0029", - "name": "count", - "summary": "Get\u0020the\u0020number\u0020of\u0020items\u0020on\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_count" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Acurrent\u0028\u0029", - "name": "current", - "summary": "Get\u0020the\u0020current\u0020list\u0020item.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_current" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aget\u0028\u0029", - "name": "get", - "summary": "Get\u0020the\u0020item\u0020at\u0020the\u0020specified\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_get" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AgetAllowedTypes\u0028\u0029", - "name": "getAllowedTypes", - "summary": "Get\u0020allowed\u0020data\u0020types\u0020for\u0020list\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_getAllowedTypes" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AgetIteratorMode\u0028\u0029", - "name": "getIteratorMode", - "summary": "Get\u0020the\u0020mode\u0020of\u0020iteration.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_getIteratorMode" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AisAllowedType\u0028\u0029", - "name": "isAllowedType", - "summary": "Check\u0020if\u0020the\u0020item\u0027s\u0020data\u0020type\u0020is\u0020allowed\u0020on\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_isAllowedType" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AisEmpty\u0028\u0029", - "name": "isEmpty", - "summary": "Check\u0020if\u0020list\u0020is\u0020empty.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_isEmpty" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AisList\u0028\u0029", - "name": "isList", - "summary": "Check\u0020if\u0020this\u0020can\u0020be\u0020considered\u0020a\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_isList" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Akey\u0028\u0029", - "name": "key", - "summary": "Get\u0020the\u0020current\u0020list\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_key" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Anext\u0028\u0029", - "name": "next", - "summary": "Move\u0020the\u0020cursor\u0020to\u0020the\u0020next\u0020list\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_next" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AoffsetExists\u0028\u0029", - "name": "offsetExists", - "summary": "Check\u0020if\u0020the\u0020specified\u0020index\u0020exists\u0020and\u0020is\u0020not\u0020empty.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_offsetExists" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AoffsetGet\u0028\u0029", - "name": "offsetGet", - "summary": "Get\u0020the\u0020item\u0020from\u0020the\u0020specified\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_offsetGet" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AoffsetSet\u0028\u0029", - "name": "offsetSet", - "summary": "Set\u0020the\u0020item\u0020at\u0020the\u0020specified\u0020offset.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_offsetSet" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AoffsetUnset\u0028\u0029", - "name": "offsetUnset", - "summary": "Unset\u0020the\u0020item\u0020at\u0020the\u0020specified\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_offsetUnset" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Apop\u0028\u0029", - "name": "pop", - "summary": "Pops\u0020an\u0020item\u0020from\u0020the\u0020end\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_pop" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aprepend\u0028\u0029", - "name": "prepend", - "summary": "Prepend\u0020items\u0020at\u0020the\u0020start\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_prepend" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aprev\u0028\u0029", - "name": "prev", - "summary": "Move\u0020the\u0020cursor\u0020to\u0020the\u0020previous\u0020list\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_prev" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Apush\u0028\u0029", - "name": "push", - "summary": "Push\u0020an\u0020item\u0020at\u0020the\u0020end\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_push" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aremove\u0028\u0029", - "name": "remove", - "summary": "Remove\u0020an\u0020item\u0020from\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_remove" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Arewind\u0028\u0029", - "name": "rewind", - "summary": "Rewind\u0020the\u0020iterator\u0027s\u0020cursor.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_rewind" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aset\u0028\u0029", - "name": "set", - "summary": "Set\u0020an\u0020item\u0020at\u0020the\u0020specified\u0020index.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_set" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AsetAllowedTypes\u0028\u0029", - "name": "setAllowedTypes", - "summary": "Set\u0020allowed\u0020data\u0020types\u0020of\u0020list\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_setAllowedTypes" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AsetIteratorMode\u0028\u0029", - "name": "setIteratorMode", - "summary": "Set\u0020the\u0020mode\u0020of\u0020iteration.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_setIteratorMode" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Ashift\u0028\u0029", - "name": "shift", - "summary": "Shift\u0020an\u0020item\u0020from\u0020the\u0020beginning\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_shift" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AtoArray\u0028\u0029", - "name": "toArray", - "summary": "Return\u0020array\u0020representation\u0020of\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_toArray" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003AtoStrictCollection\u0028\u0029", - "name": "toStrictCollection", - "summary": "Turn\u0020list\u0020into\u0020a\u0020type\u002Dsensitive\u0020collection.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_toStrictCollection" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Atop\u0028\u0029", - "name": "top", - "summary": "Peek\u0020at\u0020the\u0020item\u0020at\u0020the\u0020end\u0020of\u0020the\u0020list.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_top" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Aunshift\u0028\u0029", - "name": "unshift", - "summary": "Prepend\u0020the\u0020list\u0020with\u0020an\u0020item.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_unshift" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003Avalid\u0028\u0029", - "name": "valid", - "summary": "Check\u0020if\u0020current\u0020cursor\u0020position\u0020is\u0020valid.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method_valid" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictList\u003A\u003A__construct\u0028\u0029", - "name": "__construct", - "summary": "Create\u0020a\u0020type\u002Dsensitive,\u0020traversable\u0020list\u0020of\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictList.html#method___construct" }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictQueue", "name": "StrictQueue", "summary": "A\u0020type\u002Dsensitive,\u0020taversable\u0020queue\u0020\u0028FIFO\u0029.", "url": "classes/OCC-Basics-DataStructures-StrictQueue.html" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictQueue\u003A\u003Adequeue\u0028\u0029", - "name": "dequeue", - "summary": "Dequeue\u0020an\u0020item\u0020from\u0020the\u0020queue.", - "url": "classes/OCC-Basics-DataStructures-StrictQueue.html#method_dequeue" }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictQueue\u003A\u003Aenqueue\u0028\u0029", "name": "enqueue", "summary": "Add\u0020an\u0020item\u0020to\u0020the\u0020queue.", "url": "classes/OCC-Basics-DataStructures-StrictQueue.html#method_enqueue" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictQueue\u003A\u003AsetIteratorMode\u0028\u0029", - "name": "setIteratorMode", - "summary": "Set\u0020the\u0020mode\u0020of\u0020iteration.", - "url": "classes/OCC-Basics-DataStructures-StrictQueue.html#method_setIteratorMode" - }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictQueue\u003A\u003A__construct\u0028\u0029", - "name": "__construct", - "summary": "Create\u0020a\u0020type\u002Dsensitive,\u0020traversable\u0020queue\u0020of\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictQueue.html#method___construct" }, { "fqsen": "\\OCC\\Basics\\DataStructures\\StrictStack", "name": "StrictStack", @@ -301,15 +106,80 @@ Search.appendIndex( "summary": "Unstack\u0020an\u0020item\u0020from\u0020the\u0020stack.", "url": "classes/OCC-Basics-DataStructures-StrictStack.html#method_unstack" }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictStack\u003A\u003AsetIteratorMode\u0028\u0029", - "name": "setIteratorMode", - "summary": "Set\u0020the\u0020mode\u0020of\u0020iteration.", - "url": "classes/OCC-Basics-DataStructures-StrictStack.html#method_setIteratorMode" + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait", + "name": "StrictSplDatastructureTrait", + "summary": "The\u0020common\u0020interface\u0020of\u0020all\u0020type\u002Dsensitive,\u0020SPL\u002Dbased\u0020datastructures.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html" }, { - "fqsen": "\\OCC\\Basics\\DataStructures\\StrictStack\u003A\u003A__construct\u0028\u0029", + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aadd\u0028\u0029", + "name": "add", + "summary": "Add\/insert\u0020a\u0020new\u0020item\u0020at\u0020the\u0020specified\u0020offset.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_add" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aappend\u0028\u0029", + "name": "append", + "summary": "Append\u0020items\u0020at\u0020the\u0020end\u0020of\u0020the\u0020list.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_append" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aclear\u0028\u0029", + "name": "clear", + "summary": "Clear\u0020the\u0020list\u0020of\u0020any\u0020items.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_clear" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aget\u0028\u0029", + "name": "get", + "summary": "Get\u0020the\u0020item\u0020at\u0020the\u0020specified\u0020index.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_get" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003AisList\u0028\u0029", + "name": "isList", + "summary": "Check\u0020if\u0020this\u0020can\u0020be\u0020considered\u0020a\u0020list.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_isList" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003AoffsetSet\u0028\u0029", + "name": "offsetSet", + "summary": "Set\u0020the\u0020item\u0020at\u0020the\u0020specified\u0020offset.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_offsetSet" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aprepend\u0028\u0029", + "name": "prepend", + "summary": "Prepend\u0020items\u0020at\u0020the\u0020start\u0020of\u0020the\u0020list.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_prepend" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Apush\u0028\u0029", + "name": "push", + "summary": "Push\u0020an\u0020item\u0020at\u0020the\u0020end\u0020of\u0020the\u0020list.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_push" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aremove\u0028\u0029", + "name": "remove", + "summary": "Remove\u0020an\u0020item\u0020from\u0020the\u0020list.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_remove" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aset\u0028\u0029", + "name": "set", + "summary": "Set\u0020an\u0020item\u0020at\u0020the\u0020specified\u0020index.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_set" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003AtoArray\u0028\u0029", + "name": "toArray", + "summary": "Return\u0020array\u0020representation\u0020of\u0020list.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_toArray" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003AtoStrictCollection\u0028\u0029", + "name": "toStrictCollection", + "summary": "Turn\u0020list\u0020into\u0020a\u0020type\u002Dsensitive\u0020collection.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_toStrictCollection" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003Aunshift\u0028\u0029", + "name": "unshift", + "summary": "Prepend\u0020the\u0020list\u0020with\u0020an\u0020item.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method_unshift" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits\\StrictSplDatastructureTrait\u003A\u003A__construct\u0028\u0029", "name": "__construct", - "summary": "Create\u0020a\u0020type\u002Dsensitive,\u0020traversable\u0020stack\u0020of\u0020items.", - "url": "classes/OCC-Basics-DataStructures-StrictStack.html#method___construct" + "summary": "Create\u0020a\u0020type\u002Dsensitive,\u0020traversable\u0020list\u0020of\u0020items.", + "url": "classes/OCC-Basics-DataStructures-Traits-StrictSplDatastructureTrait.html#method___construct" }, { "fqsen": "\\OCC\\Basics\\ErrorHandlers\\ThrowErrorException", "name": "ThrowErrorException", @@ -490,11 +360,41 @@ Search.appendIndex( "name": "__clone", "summary": "This\u0020is\u0020a\u0020singleton\u0020class,\u0020thus\u0020cloning\u0020is\u0020prohibited.", "url": "classes/OCC-Basics-Traits-Singleton.html#method___clone" + }, { + "fqsen": "\\OCC\\Basics\\Traits\\TypeChecker", + "name": "TypeChecker", + "summary": "A\u0020generic\u0020data\u0020type\u0020checker.", + "url": "classes/OCC-Basics-Traits-TypeChecker.html" + }, { + "fqsen": "\\OCC\\Basics\\Traits\\TypeChecker\u003A\u003AgetAllowedTypes\u0028\u0029", + "name": "getAllowedTypes", + "summary": "Get\u0020allowed\u0020data\u0020types.", + "url": "classes/OCC-Basics-Traits-TypeChecker.html#method_getAllowedTypes" + }, { + "fqsen": "\\OCC\\Basics\\Traits\\TypeChecker\u003A\u003AhasAllowedType\u0028\u0029", + "name": "hasAllowedType", + "summary": "Check\u0020if\u0020a\u0020value\u0027s\u0020data\u0020type\u0020is\u0020allowed.", + "url": "classes/OCC-Basics-Traits-TypeChecker.html#method_hasAllowedType" + }, { + "fqsen": "\\OCC\\Basics\\Traits\\TypeChecker\u003A\u003AisAllowedType\u0028\u0029", + "name": "isAllowedType", + "summary": "Check\u0020if\u0020a\u0020data\u0020type\u0020is\u0020allowed.", + "url": "classes/OCC-Basics-Traits-TypeChecker.html#method_isAllowedType" + }, { + "fqsen": "\\OCC\\Basics\\Traits\\TypeChecker\u003A\u003AsetAllowedTypes\u0028\u0029", + "name": "setAllowedTypes", + "summary": "Set\u0020allowed\u0020data\u0020types.", + "url": "classes/OCC-Basics-Traits-TypeChecker.html#method_setAllowedTypes" }, { "fqsen": "\\", "name": "\\", "summary": "", "url": "namespaces/default.html" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Exceptions", + "name": "Exceptions", + "summary": "", + "url": "namespaces/occ-basics-datastructures-exceptions.html" }, { "fqsen": "\\OCC\\Basics\\DataStructures", "name": "DataStructures", @@ -510,6 +410,11 @@ Search.appendIndex( "name": "OCC", "summary": "", "url": "namespaces/occ.html" + }, { + "fqsen": "\\OCC\\Basics\\DataStructures\\Traits", + "name": "Traits", + "summary": "", + "url": "namespaces/occ-basics-datastructures-traits.html" }, { "fqsen": "\\OCC\\Basics\\ErrorHandlers", "name": "ErrorHandlers", diff --git a/doc/namespaces/default.html b/doc/namespaces/default.html index 7e1c2ad..d70e504 100644 --- a/doc/namespaces/default.html +++ b/doc/namespaces/default.html @@ -76,6 +76,24 @@

                          Overview

                          +

                          User Guide diff --git a/doc/namespaces/occ-basics-datastructures-exceptions.html b/doc/namespaces/occ-basics-datastructures-exceptions.html new file mode 100644 index 0000000..2fc5cb5 --- /dev/null +++ b/doc/namespaces/occ-basics-datastructures-exceptions.html @@ -0,0 +1,345 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
                          +

                          PHP Basics

                          + + + + + + +
                          + +
                          +
                          + + + + +
                          +
                          + + +
                          +

                          Exceptions

                          + + +

                          + Table of Contents + + +

                          + + + + +

                          + Classes + + +

                          +
                          +
                          InvalidDataTypeException
                          Common exception for type-sensitive datastructures.
                          + + + + + + + + + + + +
                          +
                          +
                          +
                          +
                          
                          +        
                          + +
                          +
                          + + + +
                          +
                          +
                          + +
                          + On this page + +
                            +
                          • Table Of Contents
                          • +
                          • + +
                          • + + +
                          +
                          + +
                          +
                          +
                          +
                          +
                          +

                          Search results

                          + +
                          +
                          +
                            +
                            +
                            +
                            +
                            + + +
                            + + + + + + + + diff --git a/doc/namespaces/occ-basics-datastructures-traits.html b/doc/namespaces/occ-basics-datastructures-traits.html new file mode 100644 index 0000000..a3d2177 --- /dev/null +++ b/doc/namespaces/occ-basics-datastructures-traits.html @@ -0,0 +1,345 @@ + + + + + PHP Basics + + + + + + + + + + + + + + + + + + + + + +
                            +

                            PHP Basics

                            + + + + + + +
                            + +
                            +
                            + + + + +
                            +
                            + + +
                            +

                            Traits

                            + + +

                            + Table of Contents + + +

                            + + + + + +

                            + Traits + + +

                            +
                            +
                            StrictSplDatastructureTrait
                            The common interface of all type-sensitive, SPL-based datastructures.
                            + + + + + + + + + + +
                            +
                            +
                            +
                            +
                            
                            +        
                            + +
                            +
                            + + + +
                            +
                            +
                            + +
                            + On this page + +
                              +
                            • Table Of Contents
                            • +
                            • + +
                            • + + +
                            +
                            + +
                            +
                            +
                            +
                            +
                            +

                            Search results

                            + +
                            +
                            +
                              +
                              +
                              +
                              +
                              + + +
                              + + + + + + + + diff --git a/doc/namespaces/occ-basics-datastructures.html b/doc/namespaces/occ-basics-datastructures.html index 07c5e8f..dd0634e 100644 --- a/doc/namespaces/occ-basics-datastructures.html +++ b/doc/namespaces/occ-basics-datastructures.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide @@ -166,6 +184,15 @@

                              +

                              + Namespaces + + +

                              +
                              +
                              Exceptions
                              +
                              Traits
                              +

                              diff --git a/doc/namespaces/occ-basics-errorhandlers.html b/doc/namespaces/occ-basics-errorhandlers.html index dca3451..21e6429 100644 --- a/doc/namespaces/occ-basics-errorhandlers.html +++ b/doc/namespaces/occ-basics-errorhandlers.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/namespaces/occ-basics-interfaces.html b/doc/namespaces/occ-basics-interfaces.html index 16acbf2..9df6480 100644 --- a/doc/namespaces/occ-basics-interfaces.html +++ b/doc/namespaces/occ-basics-interfaces.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/namespaces/occ-basics-traits.html b/doc/namespaces/occ-basics-traits.html index e15f93a..648c223 100644 --- a/doc/namespaces/occ-basics-traits.html +++ b/doc/namespaces/occ-basics-traits.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide @@ -175,7 +193,7 @@

                              -
                              Getter
                              Reads data from inaccessible properties by using magic methods.
                              OverloadingGetter
                              Overloads a class with readable magic properties.
                              OverloadingSetter
                              Overloads a class with writable magic properties.
                              Setter
                              Writes data to inaccessible properties by using magic methods.
                              Singleton
                              Allows just a single instance of the class using this trait.
                              +
                              Getter
                              Reads data from inaccessible properties by using magic methods.
                              OverloadingGetter
                              Overloads a class with readable magic properties.
                              OverloadingSetter
                              Overloads a class with writable magic properties.
                              Setter
                              Writes data to inaccessible properties by using magic methods.
                              Singleton
                              Allows just a single instance of the class using this trait.
                              TypeChecker
                              A generic data type checker.
                              diff --git a/doc/namespaces/occ-basics.html b/doc/namespaces/occ-basics.html index 5694a09..00b65a6 100644 --- a/doc/namespaces/occ-basics.html +++ b/doc/namespaces/occ-basics.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/namespaces/occ.html b/doc/namespaces/occ.html index 9ce3c48..b791008 100644 --- a/doc/namespaces/occ.html +++ b/doc/namespaces/occ.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/packages/Basics-DataStructures.html b/doc/packages/Basics-DataStructures.html index 11e8cfc..bf3365e 100644 --- a/doc/packages/Basics-DataStructures.html +++ b/doc/packages/Basics-DataStructures.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide @@ -173,8 +191,15 @@

                              -
                              StrictCollection
                              A type-sensitive, unsorted collection.
                              StrictList
                              A type-sensitive, taversable list.
                              StrictQueue
                              A type-sensitive, taversable queue (FIFO).
                              StrictStack
                              A type-sensitive, taversable stack (LIFO).
                              +
                              InvalidDataTypeException
                              Common exception for type-sensitive datastructures.
                              StrictCollection
                              A type-sensitive, unsorted collection.
                              StrictList
                              A type-sensitive, taversable list.
                              StrictQueue
                              A type-sensitive, taversable queue (FIFO).
                              StrictStack
                              A type-sensitive, taversable stack (LIFO).
                              +

                              + Traits + + +

                              +
                              +
                              StrictSplDatastructureTrait
                              The common interface of all type-sensitive, SPL-based datastructures.
                              @@ -289,7 +314,8 @@
                            • +
                            • Traits
                            • + diff --git a/doc/packages/Basics-ErrorHandlers.html b/doc/packages/Basics-ErrorHandlers.html index f2c9cf4..9258cf5 100644 --- a/doc/packages/Basics-ErrorHandlers.html +++ b/doc/packages/Basics-ErrorHandlers.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/packages/Basics-Interfaces.html b/doc/packages/Basics-Interfaces.html index d27f811..d92ed72 100644 --- a/doc/packages/Basics-Interfaces.html +++ b/doc/packages/Basics-Interfaces.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/packages/Basics-Traits.html b/doc/packages/Basics-Traits.html index ffb5b6d..2b259eb 100644 --- a/doc/packages/Basics-Traits.html +++ b/doc/packages/Basics-Traits.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide @@ -174,7 +192,7 @@

                              -
                              Getter
                              Reads data from inaccessible properties by using magic methods.
                              OverloadingGetter
                              Overloads a class with readable magic properties.
                              OverloadingSetter
                              Overloads a class with writable magic properties.
                              Setter
                              Writes data to inaccessible properties by using magic methods.
                              Singleton
                              Allows just a single instance of the class using this trait.
                              +
                              Getter
                              Reads data from inaccessible properties by using magic methods.
                              OverloadingGetter
                              Overloads a class with readable magic properties.
                              OverloadingSetter
                              Overloads a class with writable magic properties.
                              Setter
                              Writes data to inaccessible properties by using magic methods.
                              Singleton
                              Allows just a single instance of the class using this trait.
                              TypeChecker
                              A generic data type checker.
                              diff --git a/doc/packages/Basics.html b/doc/packages/Basics.html index 34b853b..193741c 100644 --- a/doc/packages/Basics.html +++ b/doc/packages/Basics.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/packages/default.html b/doc/packages/default.html index c36deb0..2b35a35 100644 --- a/doc/packages/default.html +++ b/doc/packages/default.html @@ -76,6 +76,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/reports/deprecated.html b/doc/reports/deprecated.html index cd152be..ffaf0e5 100644 --- a/doc/reports/deprecated.html +++ b/doc/reports/deprecated.html @@ -77,6 +77,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/reports/errors.html b/doc/reports/errors.html index beef8c4..1eeda37 100644 --- a/doc/reports/errors.html +++ b/doc/reports/errors.html @@ -77,6 +77,24 @@

                              Overview

                              +

                              User Guide diff --git a/doc/reports/markers.html b/doc/reports/markers.html index aa4fa05..0b65c24 100644 --- a/doc/reports/markers.html +++ b/doc/reports/markers.html @@ -77,6 +77,24 @@

                              Overview

                              +

                              User Guide