Predicate-String
The predicates on string subject
Code example
The predicate: Subject is prefixed with 'Hello' and has 11 characters or is empty string
use Predicate as P;
$p = (new P\HasLength(11))->and(new P\StartsWith('Hello'))->or(new P\IsEmpty());
$p('Hello'); // → false
$p('World'); // → false
$p('Hello World'); // → true
$p(''); // → true
Documentation
See the documentation of API at gh-pages.
Installation
Install this package using the composer command:
$ composer require "predicate/predicate-string"
Tests
To run the tests execute the command:
$ php vendor/bin/phpunit
Build
To start the build process run the command:
$ php vendor/bin/phing
License
The MIT License (MIT)
Copyright (c) 2016 Krzysztof Piasecki