Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Added Explode validator documentation #209

Merged
merged 2 commits into from
Feb 1, 2018

Conversation

renanliberato
Copy link
Contributor

I've wrote the basic documentation for Explode validator.

It came useful for me lately so I'd like to contribute with it.

It fixes both #171 and #137 , which are duplicates.


The following options are supported for `Zend\Validator\Explode`:

- `valueDelimiter`: Defines the delimiter used to explode the value to an array. It defaults to `,`. If working with an array, this option isn't used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renanliberato

If working with an array, this option isn't used.

We should clarify that the given "value" is meant here.

]);

$value = [1, 4, 6, 8];
$return = $valid->isValid($value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$valid is wrong here.

I would change the example:

$explodeValidator->isValid([1, 4, 6]);    // returns true
$explodeValidator->isValid([1, 4, 6, 8]); // returns false


$value = [1, 4, 6, 8];
$return = $valid->isValid($value);
// returns false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be deleted.

// returns false
```

The above example returns `true` if all $value items are between 1 and 6.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be deleted, because is covered now in the example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add another example which demonstrate the usage of valueDelimiter. Thanks!

Improved valueDelimiter description.
Fixed array example
Added explode string example.
@renanliberato
Copy link
Contributor Author

Hi @froschdesign ,

I added the valueDelimiter example and improved the valueDelimiter description.

I also appreciated your suggestions and incorporated them into the chapter.

@weierophinney weierophinney merged commit 9507252 into zendframework:master Feb 1, 2018
weierophinney added a commit that referenced this pull request Feb 1, 2018
Added Explode validator documentation
weierophinney added a commit that referenced this pull request Feb 1, 2018
weierophinney added a commit that referenced this pull request Feb 1, 2018
weierophinney added a commit that referenced this pull request Feb 1, 2018
@weierophinney
Copy link
Member

Thanks, @renanlibrato!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants