2017 © Pedro Peláez
 

library complex-types

Adds strongly typed lists and maps

image

trentonmaki/complex-types

Adds strongly typed lists and maps

  • Thursday, September 3, 2015
  • by huulktya
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ComplexPrimitiveTypes

Complex list and map types for PHP, (*1)

API

The TypedMap and TypedList API support almost the same interface as an Array (see (ArrayObject)[http://php.net/manual/en/class.arrayobject.php] for an example of this) the differences are in the key values these two types allow and the icompatability with the array_* functions, (*2)

Usage

Simple subclass TypedList or TypedMap for each kind of list or map you want, then write the isType() or keyType() and valueType() methods., (*3)

Example:, (*4)

class StringList extends TypedList
    {

      /**
       * @param mixed $val
       * @return bool
       */
      protected function isType($val)
      {
          return is_string($val);
      }
  }

You can now use StringList as you would a normal array. If someone attempts to put a non string in your list, an exception will be thrown immediately., (*5)

The Versions

03/09 2015

dev-master

9999999-dev

Adds strongly typed lists and maps

  Sources   Download

MIT

The Requires

  • php ^5.3

 

The Development Requires

by MakiCode

19/08 2015

1.1.0

1.1.0.0

Adds strongly typed lists and maps

  Sources   Download

MIT

The Requires

  • php ^5.3

 

The Development Requires

by MakiCode

19/08 2015

1.0.0

1.0.0.0

Adds strongly typed lists and maps

  Sources   Download

MIT

The Requires

  • php ^5.3

 

The Development Requires

by MakiCode