2017 © Pedro Peláez
 

library const-validator

Simple tester for validating value given by constant.

image

besanek/const-validator

Simple tester for validating value given by constant.

  • Tuesday, September 3, 2013
  • by besanek
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ConstValidator

Validating parameters defined by constants., (*1)

Simple example

Because simple example is better than a thousand words., (*2)

User entity (without PHPDoc, constructor, getters, etc.):, (*3)

```php <?php, (*4)

use ConstValidator\Validator as Constant;, (*5)

class UserEntity {, (*6)

private $role;

public function setRole($role)
{
    if(!Constant::validate("UserEntity::ROLE_*", $role)){
        throw new Exception("Invalid role");
    }
    $this->role = $role;
}

const ROLE_MEMBER    = 'member';
const ROLE_MODERATOR = 'moderator';
const ROLE_ADMIN     = 'admin';

}, (*7)

The Versions

03/09 2013

dev-master

9999999-dev

Simple tester for validating value given by constant.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Development Requires

validator const constant tester