anikin-elets / correct-brackets
Return true if the line is correct - all brackets are correctly opened and closed, or false otherwise
2.0.2
2018-05-03 12:11 UTC
Requires
- php: ~7.1
Requires (Dev)
- phpunit/phpunit: ~7.0.3
This package is not auto-updated.
Last update: 2025-06-23 03:46:53 UTC
README
Тестовая библиотека
Возвращает true, если переданная строка корректна т.е. все открытые скобки корректно открыты и закрыты, или же false в противном случае.
Install via Composer:
composer require anikin-elets/correct-brackets
Usage
$line = '()()( )()()'; $allowedChars = ['(', ')', '\r', '\n', '\t', '\s']; $bracketLibrary = new \Library\Command\BracketCommand($line, $allowedChars); try { $isCorrect = $bracketLibrary->execute(); } catch (\Library\Exceptions\InvalidArgumentException $e) { echo sprintf("ERROR: %s", $e->getMessage()); }