Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule "Age" to validation. #150

Closed
wants to merge 5 commits into from
Closed

Commits on Jan 19, 2015

  1. Add rule "Age" to validation.

    Instead of adding a MaximumAge rule, this creates the Age rule which
    incorporates both rules: minimum and maximum age. Maximum age is optional.
    malukenho committed Jan 19, 2015
    Copy the full SHA
    77c723c View commit details
    Browse the repository at this point in the history
  2. Move files to conform PSR-4.

    Fixup this commit.
    Jefersson Nathan authored and malukenho committed Jan 19, 2015
    Copy the full SHA
    dc1d59e View commit details
    Browse the repository at this point in the history
  3. MinimumAge test using Age rule.

    This needs a fix, the "format" parameters accepted by "minimumAge"
    rule is not supported by the new validator. It was supposed to be
    compatible and do the exactly same thing as "minimumAge".
    
    It would be cool to keep the same API as the "minimumAge", example:
    
    	<?php
    		// As it was before
    		v::minimumAge(18, 'Y-m-d')->validate('1990-01-01'); // true
    
    		// Needs to work that way
    		v::age(18, 'Y-m-d')->validate('1990-01-01'); // true
    		v::age(18, 65, 'Y-m-d')->validate('1990-01-01'); //true
    	?>
    
    It could work that way as the `format` will always be something
    acceptable by `strtotime()` function. And an `age` (an small integer)
    can also be a string (Ex: "18") but is not a valid format. So, if the
    second parameter is given, and is not an `is_numeric()`, it is a format.
    Jefersson Nathan authored and malukenho committed Jan 19, 2015
    Copy the full SHA
    2a9782a View commit details
    Browse the repository at this point in the history
  4. Fix EOL EOF

    malukenho committed Jan 19, 2015
    Copy the full SHA
    3e4e79e View commit details
    Browse the repository at this point in the history
  5. Translate tabs to space

    malukenho committed Jan 19, 2015
    Copy the full SHA
    9ee22b2 View commit details
    Browse the repository at this point in the history