From 1c4f7ab3b838b23afb2ee4dab14acbf75956e952 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 22 Mar 2022 12:24:31 +0300 Subject: * add phpunit as a dev dependency * add some basic tests for UrlHelper::rewrite_relative() * fix UrlHelper::rewrite_relative() to work better on non-absolute relative URL paths --- .../Prophecy/Argument/Token/NotInArrayToken.php | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/NotInArrayToken.php (limited to 'vendor/phpspec/prophecy/src/Prophecy/Argument/Token/NotInArrayToken.php') diff --git a/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/NotInArrayToken.php b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/NotInArrayToken.php new file mode 100644 index 000000000..6aed8aa50 --- /dev/null +++ b/vendor/phpspec/prophecy/src/Prophecy/Argument/Token/NotInArrayToken.php @@ -0,0 +1,75 @@ + + * Marcello Duarte + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Prophecy\Argument\Token; + +/** + * Check if values is not in array + * + * @author Vinícius Alonso + */ +class NotInArrayToken implements TokenInterface +{ + private $token = array(); + private $strict; + + /** + * @param array $arguments tokens + * @param bool $strict + */ + public function __construct(array $arguments, $strict = true) + { + $this->token = $arguments; + $this->strict = $strict; + } + + /** + * Return scores 8 score if argument is in array. + * + * @param $argument + * + * @return bool|int + */ + public function scoreArgument($argument) + { + if (count($this->token) === 0) { + return false; + } + + if (!\in_array($argument, $this->token, $this->strict)) { + return 8; + } + + return false; + } + + /** + * Returns false. + * + * @return boolean + */ + public function isLast() + { + return false; + } + + /** + * Returns string representation for token. + * + * @return string + */ + public function __toString() + { + $arrayAsString = implode(', ', $this->token); + return "[{$arrayAsString}]"; + } +} + -- cgit v1.2.3