Server IP : 173.249.157.85 / Your IP : 3.145.0.168 Web Server : Apache System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 User : econtech ( 1005) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/econtech/www/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/
Current File : /home/econtech/www/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Arrays/IsArrayContaining.php
<?php
namespace Hamcrest\Arrays;
/*
Copyright (c) 2009 hamcrest.org
*/
use Hamcrest\Description;
use Hamcrest\Matcher;
use Hamcrest\TypeSafeMatcher;
use Hamcrest\Util;
/**
* Matches if an array contains an item satisfying a nested matcher.
*/
class IsArrayContaining extends TypeSafeMatcher
{
private $_elementMatcher;
public function __construct(Matcher $elementMatcher)
{
parent::__construct(self::TYPE_ARRAY);
$this->_elementMatcher = $elementMatcher;
}
protected function matchesSafely($array)
{
foreach ($array as $element) {
if ($this->_elementMatcher->matches($element)) {
return true;
}
}
return false;
}
protected function describeMismatchSafely($array, Description $mismatchDescription)
{
$mismatchDescription->appendText('was ')->appendValue($array);
}
public function describeTo(Description $description)
{
$description
->appendText('an array containing ')
->appendDescriptionOf($this->_elementMatcher)
;
}
/**
* Evaluates to true if any item in an array satisfies the given matcher.
*
* @param mixed $item as a {@link Hamcrest\Matcher} or a value.
*
* @return \Hamcrest\Arrays\IsArrayContaining
* @factory hasValue
*/
public static function hasItemInArray($item)
{
return new self(Util::wrapValueWithIsEqual($item));
}
}