shumik/bracket-checker

Check string for correct brackets opening/closing

v1.0.7 2018-02-09 13:36 UTC

This package is not auto-updated.

Last update: 2024-05-12 03:06:49 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