CyberfusionIO / cyberfusion-cluster-api-client

Cyberfusion Core API client
https://core-api.cyberfusion.io
MIT License
5 stars 3 forks source link

Add path validator, update to Cluster API version 1.144 #5

Closed WilliamDEdwards closed 2 years ago

WilliamDEdwards commented 2 years ago

Changes

Branched off https://github.com/CyberfusionNL/cyberfusion-cluster-api-client/pull/3

Checks

WilliamDEdwards commented 2 years ago

At the moment, there's no built-in way to validate each item in a list. I've added todos for lists for which each item should be validated as a path.

dvdheiden commented 2 years ago

I've added the ->each() option to the validation. Just provide multiple values to the validator and call ->each().

In this example, it will ensure both test.js and app.js end with .js:

$result = Validator::value(['test.js', 'app.js'])
    ->each()
    ->endsWith('.js')
    ->validate();

See tests/Support/ValidatorTest.php for more examples.

WilliamDEdwards commented 2 years ago

I've added the ->each() option to the validation. Just provide multiple values to the validator and call ->each().

In this example, it will ensure both test.js and app.js end with .js:

$result = Validator::value(['test.js', 'app.js'])
    ->each()
    ->endsWith('.js')
    ->validate();

See tests/Support/ValidatorTest.php for more examples.

I've solved the todos by using the new ->each() option.