2017 © Pedro Peláez
 

library foundation

A collection of classes that make the foundation of all ThinFrame components

image

thinframe/foundation

A collection of classes that make the foundation of all ThinFrame components

  • Wednesday, July 23, 2014
  • by unusorin
  • Repository
  • 2 Watchers
  • 0 Stars
  • 10,064 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 2 % Grown

The README.md

ThinFrame Foundation

Is a collection of classes that make the foundation of all ThinFrame components., (*1)

Build Status Latest Stable Version Latest Unstable Version License, (*2)

Index

  1. TypeCheck
  2. AbstractEnum

TypeCheck

TypeHinting for primary types, (*3)

Sample usage:, (*4)

<?php
use ThinFrame\Foundation\Constant\DataType;
use ThinFrame\Foundation\Helper\TypeCheck;

function myAwesomeFunction($stringVariable, \Exception $exception, $boolVariable)
{
    //if any of the above arguments doesn't respect the type an invalid argument exception will be thrown
    TypeCheck::doCheck(DataType::STRING, DataType::SKIP, DataType::BOOLEAN);
}

If any of the function arguments doesn't match the given type, and InvalidArgumentException will be thrown. Argument types are specified in order of the declaration (check ThinFrame\Foundation\Constants\DataType for possible data types. DataType::SKIP is used to skip the validation of a argument., (*5)

AbstractEnum

Enum implementation for PHP. An enumeration is defined using constants and it also can be instantiated., (*6)

<?php
use ThinFrame\Foundation\DataType\AbstractEnum;

class WeekDay extends AbstractEnum
{
    const MONDAY    = 1;
    const TUESDAY   = 2;
    const WEDNESDAY = 3;
    const THURSDAY  = 4;
    const FRIDAY    = 5;
    const SATURDAY  = 6;
    const SUNDAY    = 7;
}

//constructor will accept only valid enum values
$weekDay = new WeekDay(WeekDay::SUNDAY);

$weekDay->equals(WeekDay::SUNDAY); // true
$weekDay->equals(WeekDay::MONDAY); // false (captain obvious)

WeekDay::getMap(); //Map with enum key=>value pairs

WeekDay::isValid(5); //true
WeekDay::isValid(9); //false

WeekDay::type(); //callback that will validate a given enum value. Used for TypeCheck

Installation:

  • via Composer: "thinframe/foundation":"0.3.*"

Contribuitors

License

  • MIT

The Versions

23/07 2014

0.4.x-dev

0.4.9999999.9999999-dev http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

foundation thinframe

26/05 2014

dev-master

9999999-dev http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe

26/05 2014

v0.3.0

0.3.0.0 http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe

26/05 2014

dev-develop

dev-develop http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe

20/05 2014

dev-phpspec

dev-phpspec http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe

26/01 2014

v0.2.1

0.2.1.0 http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe

07/12 2013

v0.2.0

0.2.0.0 http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe

11/11 2013

dev-tests

dev-tests http://thinframe.net

A collection of classes that make the foundation of all ThinFrame components

  Sources   Download

MIT

The Requires

 

The Development Requires

foundation thinframe