Файл: gapps/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ShortcutCombination.php
Строк: 19
<?php
namespace HamcrestCore;
/*
Copyright (c) 2009 hamcrest.org
*/
use HamcrestBaseMatcher;
use HamcrestDescription;
use HamcrestUtil;
abstract class ShortcutCombination extends BaseMatcher
{
/**
* @var array<HamcrestMatcher>
*/
private $_matchers;
public function __construct(array $matchers)
{
Util::checkAllAreMatchers($matchers);
$this->_matchers = $matchers;
}
protected function matchesWithShortcut($item, $shortcut)
{
/** @var $matcher HamcrestMatcher */
foreach ($this->_matchers as $matcher) {
if ($matcher->matches($item) == $shortcut) {
return $shortcut;
}
}
return !$shortcut;
}
public function describeToWithOperator(Description $description, $operator)
{
$description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers);
}
}