dev-master
9999999-dev https://github.com/codecounter/VersionMatcher
MIT
The Requires
- php >=5.3.0
by Code Counter
Wallogit.com
2017 © Pedro Peláez
Compare versions with logic opertation. (Actually, it's a project to test ci/cd), (*2)
{
...
"require": {
"codecounter/versionmatcher": "0.1.0"
}
}
require "/path/to/VersionMatcher/autoload.php"
// produce `false`
\CodeCounter\VersionMatcher::test('ver >= 1.2.0', array(
'ver' => '1.1.0'
));
// produce `true`
\CodeCounter\VersionMatcher::test('ver >= 1.2.0 && ver < 1.6.0', array(
'ver' => '1.3.0'
));
$matcher = new \CodeCounter\VersionMatcher(array(
'android' => '1.3.0',
'ios' => ''
));
// produce `true`
$matcher->match('ios >= 1.4.0 || android >= 1.3.0');
// produce `false`
$matcher->match('ios >= 1.4.0 || android < 1.2.0');
For detailed usage, please view tests directory., (*3)
cd devcp docker-compose.example.yml docker-compose.yml, modify it if necessarydocker-compose up -ddocker-compose exec php bash, ssh to the containercd /var/wwwthen, you can run unit test by phpunit, or code sniffer by phpcs., (*4)
php tests/coverage-check.php after phpunit, this script can exit stdout with 1
when coverage < 90%, for ci notification., (*5)
This library is under MIT license., (*6)
MIT