2017 © Pedro Peláez
 

library ascertain

Simple validator, not doing much harm

image

m6w6/ascertain

Simple validator, not doing much harm

  • Tuesday, October 22, 2013
  • by m6w6
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ascertain

Build Status, (*1)

Harmless validation., (*2)

$user->assert()
    ->that("name")
        ->isNotNothing("a name is required")
        ->isLen(4, "must be at least 4 characters long")
    ->that("email")
        ->isEmail("is not valid")
    ->that("homepage")
        ->when($user->hasHomepage())
        ->isUrl("seems not to be a valid URL");

# ...

class User implements \ascertain\Testable
{
    use \ascertain\Validator;

    protected $id;
    protected $name;
    protected $email;
    protected $homepage;

    function hasHomepage() {
        return isset($this->homepage);
    }

    function export() {
        return array(
            "name"     => $this->name,
            "email"    => $this->email,
            "homepage" => $this->homepage.
        );
    }
}

The Versions

22/10 2013

dev-master

9999999-dev http://github.com/m6w6/ascertain

Simple validator, not doing much harm

  Sources   Download

BSD-2-Clause

by Michael Wallner

validator