<?php namespace Hamcrest\Core; /* Copyright (c) 2009 hamcrest.org */ use Hamcrest\Description; use Hamcrest\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>. */ class AnyOf extends ShortcutCombination { public function __construct(array $matchers) { parent::__construct($matchers); } public function matches($item) { return $this->matchesWithShortcut($item, true); } public function describeTo(Description $description) { $this->describeToWithOperator($description, 'or'); } /** * Evaluates to true if ANY of the passed in matchers evaluate to true. * * @factory ... */ public static function anyOf(/* args... */) { $args = func_get_args(); return new self(Util::createMatcherArray($args)); } /** * Evaluates to false if ANY of the passed in matchers evaluate to true. * * @factory ... */ public static function noneOf(/* args... */) { $args = func_get_args(); return IsNot::not( new self(Util::createMatcherArray($args)) ); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
AllOf.php | File | 1.42 KB | 0644 |
|
AnyOf.php | File | 1.23 KB | 0644 |
|
CombinableMatcher.php | File | 1.74 KB | 0644 |
|
DescribedAs.php | File | 1.81 KB | 0644 |
|
Every.php | File | 1.31 KB | 0644 |
|
HasToString.php | File | 1.24 KB | 0644 |
|
Is.php | File | 1.32 KB | 0644 |
|
IsAnything.php | File | 875 B | 0644 |
|
IsCollectionContaining.php | File | 2.11 KB | 0644 |
|
IsEqual.php | File | 835 B | 0644 |
|
IsIdentical.php | File | 708 B | 0644 |
|
IsInstanceOf.php | File | 1.66 KB | 0644 |
|
IsNot.php | File | 826 B | 0644 |
|
IsNull.php | File | 976 B | 0644 |
|
IsSame.php | File | 1.07 KB | 0644 |
|
IsTypeOf.php | File | 1.64 KB | 0644 |
|
Set.php | File | 2.35 KB | 0644 |
|
ShortcutCombination.php | File | 920 B | 0644 |
|