Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Apr 8, 2017
1 parent aa83adc commit 088d950
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ $validation = new Validation([

# or

use ICanBoogie\Validate\Validator;

$validation = new Validation([
'name' => [
Validator\Required::class => [],
Expand All @@ -167,6 +165,9 @@ failed, an empty array otherwise.
<?php

use ICanBoogie\Validate\Reader\RequestAdapter;
use ICanBoogie\Validate\Validation;

/* @var $validation Validation */

$errors = $validation->validate(new RequestAdapter($_POST));

Expand Down Expand Up @@ -194,9 +195,12 @@ The validation errors may be retrieved from the exception using its `errors` pro
```php
<?php

use ICanBoogie\Validate\Validation;
use ICanBoogie\Validate\ValidationFailed;
use ICanBoogie\Validate\Reader\RequestAdapter;

/* @var $validation Validation */

try
{
$validation->assert(new RequestAdapter($_POST));
Expand Down Expand Up @@ -242,10 +246,10 @@ $validation = new Validation([
Required::class => [
Required::OPTION_MESSAGE => "An email address must be supplied if your wish to register.",
Required::OPTION_IF => function(Context $context) {
return $context->value('name')
return $context->value('name');
},
Required::OPTION_UNLESS => function(Context $context) {
return !$context->value('register')
return !$context->value('register');
},
Required::OPTION_STOP_ON_ERROR => true // already defined by Require
],
Expand Down

0 comments on commit 088d950

Please sign in to comment.