/**
  * {@inheritDoc}
  * @param array|\Traversable $traversable
  */
 public function matches($traversable)
 {
     Assert::isTraversable($traversable);
     $result = true;
     foreach ($traversable as $value) {
         if (!$value instanceof $this->expectedInstanceOf) {
             $result = false;
             break;
         }
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * @covers Brickoo\Component\Common\Assert::isTraversable
  * @expectedException \InvalidArgumentException
  */
 public function testIsTraversableThrowsArgumentException()
 {
     Assert::isTraversable("wrongType");
 }
 /**
  * {@inheritDoc}
  * @param array|\Traversable $traversable
  */
 public function matches($traversable)
 {
     Assert::isTraversable($traversable);
     $result = array_diff($this->expectedKeys, $this->getTraversableKeys($traversable));
     return empty($result);
 }