/** * Get regular expression matching the value. * * Return a regular sub expression, which matches all possible values of * this value type. The regular expression should NOT contain any named * sub-patterns, since it might be repeatedly embedded in some box parser. * * @return string */ public function getRegularExpression() { $widthParser = new ezcDocumentPcssStyleMeasureValue(); $styleParser = new ezcDocumentPcssStyleLineValue(); $colorParser = new ezcDocumentPcssStyleColorValue(); return '(?:' . '(?:' . $widthParser->getRegularExpression() . '\\s*)?' . '(?:' . $styleParser->getRegularExpression() . '\\s*)?' . '(?:' . $colorParser->getRegularExpression() . ')?' . ')'; }
/** * @dataProvider getLineStyleValues */ public function testLineValueHandler($input, $expectation, $string = '') { $value = new ezcDocumentPcssStyleLineValue(); $value->parse($input); $this->assertEquals($expectation, $value->value, 'Invalid style style value read.', 0.01); $this->assertEquals($string, (string) $value, 'Invalid style style string serialization.'); }