mparulski/collection-type

The library Collection/Map and subtypes with checking the types for PHP

v0.5.0 2015-06-20 16:51 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:55:51 UTC


README

================

License Latest Stable Version Total Downloads

CollectionType is a library that provides Collection and Map with their subtypes which are checking types of data set for PHP.

Requirements

  • PHP 5.5.0 or higher

Installation

CollectionType officially supports only installation through Composer. For Composer documentation, please refer to getcomposer.org.

Install the module:

$ php composer.phar require mparulski/collection-type:0.*

Example:

use CollectionType\Collection\CollectionSet\HashSet;
use CollectionType\TypeValidator\ObjectTypeValidator;
    
$set = new HashSet(new IntegerTypeValidator());
    
$set->add(1);
$set->add(5);

// throw exception
$set->add(7.2);

Documentation

Documentation is available in the /docs folder.

LICENSE

Copyright (c) 2015 Michał Parulski http://opensource.org/licenses/MIT

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals and is licensed under the MIT license.