Skip to content

Feat: Char validator#48

Merged
Meldiron merged 4 commits intomasterfrom
feat-chars-validator
Feb 10, 2022
Merged

Feat: Char validator#48
Meldiron merged 4 commits intomasterfrom
feat-chars-validator

Conversation

@Meldiron
Copy link
Contributor

@Meldiron Meldiron commented Feb 8, 2022

No description provided.

*
* @package Utopia\Validator
*/
class Char extends Validator
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
class Char extends Validator
class Chars extends Validator

Make sense?

@kodumbeats
Copy link
Contributor

To my 👀, this looks to be the Text validator plus a whitelist of chars. Any reason we couldn't just add this functionality there?

new Text(255, [ ...Text::ALPHABET_LOWER, ...Text::ALPHABET_UPPER, ...Text::NUMBERS ]

Where the constructor has a default, empty value for a whitelist
public function __construct(int $length, array $whitelist = []){}

@Meldiron
Copy link
Contributor Author

@eldadfux @kodumbeats I decided to go with Brandon solution of merging this into a Text validator. Whitelist is optional and ignored if it's an empty array (who would want no allowed characters anyway).

Please revisit the PR 😇

@Meldiron Meldiron merged commit 7d9b283 into master Feb 10, 2022
@Meldiron Meldiron deleted the feat-chars-validator branch February 10, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants