2017 © Pedro Peláez
 

library assure

Data correction and validation

image

clean/assure

Data correction and validation

  • Friday, August 12, 2016
  • by romannowicki
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5,359 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 14 % Grown

The README.md

clean/assure

Build Status Code Climate Test Coverage Issue Count Latest Stable Version Total Downloads License, (*1)

This package extends global namespace with assure method than can be used to correct and validate mixed data types., (*2)

Mainly used to support duck typing of primitive types in function parameters to simplify interface usage eg.:, (*3)

class Foo
{
    public function filterById($id)
    {
        assure($name, ['arrayOfIntegers']);
        // after assure we can trust that name is an array of integers
        // otherwise exception will be raised
    }
}

$foo = new Foo();
$foo->filterById(1)
$foo->filterById('1')
$foo->filterById(['1', 2])

Installation

via Composer, (*4)

Example of Usage

// if value is not integer and cannot be transform to integer assure with throw exception
// correct values: '1', 1, 1.3
// invalid values: 'a', NULL, false, array()
assure($value, 'integer');

// if not integer OR string with integers separated by commas assure will throw exception
// correct values: '1', '1,2,3,4,5';
// invalid values: 'a', '1,2,a,4,b';
assure($value, ['integer', 'commaSeparatedIntegers']); 

Documentation

http://cleanassure.readthedocs.org, (*5)

The Versions

12/08 2016

dev-master

9999999-dev

Data correction and validation

  Sources   Download

MIT

The Development Requires

10/08 2016

3.0.0

3.0.0.0

Data correction and validation

  Sources   Download

MIT

The Development Requires

12/04 2016

2.0.2

2.0.2.0

Data correction and validation

  Sources   Download

MIT

The Development Requires

03/05 2015

2.0.1

2.0.1.0

Data correction and validation

  Sources   Download

Apache-2.0

The Development Requires

03/05 2015

2.0.0

2.0.0.0

Data correction and validation

  Sources   Download

Apache-2.0

The Development Requires

01/11 2014

1.0.0

1.0.0.0

  Sources   Download