Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
6 / 6
Wikimedia\CSS\Grammar\NonEmpty
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
6 / 6
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 generateMatches
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
4 / 4
<?php
/**
 * @file
 * @license https://opensource.org/licenses/Apache-2.0 Apache-2.0
 */
namespace Wikimedia\CSS\Grammar;
use Wikimedia\CSS\Objects\ComponentValueList;
/**
 * Matcher that requires its sub-Matcher has only non-empty matches ("!" multipier)
 * @see https://www.w3.org/TR/2016/CR-css-values-3-20160929/#mult-req
 */
class NonEmpty extends Matcher {
    /** @var Matcher */
    protected $matcher;
    /**
     * @param Matcher $matcher
     */
    public function __construct( Matcher $matcher ) {
        $this->matcher = $matcher;
    }
    /** @inheritDoc */
    protected function generateMatches( ComponentValueList $values, $start, array $options ) {
        foreach ( $this->matcher->generateMatches( $values, $start, $options ) as $match ) {
            if ( $match->getLength() !== 0 ) {
                yield $this->makeMatch( $values, $start, $match->getNext(), $match );
            }
        }
    }
}