/**
  * @param array|string $values
  * @throws \Optimus\Exception\InvalidArgumentException
  */
 function __construct($values)
 {
     if (is_string($values)) {
         $values = preg_split('/\\s/', $values);
     } elseif (!is_array($values)) {
         throw new InvalidArgumentException('HasClassConstraint only accepts a single array or string argument');
     }
     if (count($values) !== count(array_filter($values))) {
         throw new InvalidArgumentException('Class name cannot be empty');
     }
     parent::__construct('class', $values);
 }
 /**
  * @test
  */
 public function testCheck_returnsFalse_whenAttributeExistsButDoesNotMatchPattern()
 {
     $document = $this->getDocument();
     $element = $document->getElementById('wrapper');
     $constraint = new HasAttributeConstraint('class');
     $constraint->setPattern('/(first|last)/');
     $this->assertFalse($constraint->check($element));
 }