/** * Matcher condition. * * @param mixed $actual * * @throws \InvalidArgumentException If $actual variable not an array or instance of Traversable. * @return bool */ protected function condition($actual) { if (!(is_array($actual) || $actual instanceof \Traversable)) { throw new \InvalidArgumentException('Actual variable must be an array or instance of Traversable.'); } foreach ($actual as $value) { if ($this->expected->condition($value) === true) { return true; } } return false; }
/** * Make custom assert. * * @param mixed $actual * @param AbstractMatcher $matcher * @param string $message */ public static function that($actual, AbstractMatcher $matcher, $message = '') { self::$count++; $matcher->match($actual, $message); }