<?phpnamespaceHamcrest\Core;
/*
Copyright (c) 2009 hamcrest.org
*/useHamcrest\Description;
useHamcrest\Util;
/**
* Calculates the logical disjunction of multiple matchers. Evaluation is
* shortcut, so subsequent matchers are not called if an earlier matcher
* returns <code>true</code>.
*/classAnyOfextendsShortcutCombination{
publicfunction__construct(array$matchers)
{
parent::__construct($matchers);
}
publicfunctionmatches($item)
{
return$this->matchesWithShortcut($item, true);
}
publicfunctiondescribeTo(Description $description)
{
$this->describeToWithOperator($description, 'or');
}
/**
* Evaluates to true if ANY of the passed in matchers evaluate to true.
*
* @factory ...
*/publicstaticfunctionanyOf(/* args... */)
{
$args = func_get_args();
returnnewself(Util::createMatcherArray($args));
}
/**
* Evaluates to false if ANY of the passed in matchers evaluate to true.
*
* @factory ...
*/publicstaticfunctionnoneOf(/* args... */)
{
$args = func_get_args();
returnIsNot::not(
newself(Util::createMatcherArray($args))
);
}
}