shumik / bracket-checker
Check string for correct brackets opening/closing
v1.0.7
2018-02-09 13:36 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is not auto-updated.
Last update: 2024-11-10 05:29:59 UTC
README
Install:
composer require shumik/bracket-checker
Example:
use \BracketChecker\BracketChecker;
require_once 'vendor/autoload.php';
$checker = new BracketChecker();
$checker->setString("()()(()(()())))");
try {
echo $checker->check() ? 'valid string' : 'invalid string';
} catch (InvalidArgumentException $e) {
echo 'Invalid string format';
}
Tests:
vendor/bin/phpunit --bootstrap vendor/autoload.php vendor/shumik/bracket-checker/tests/BracketCheckerTest.php