webignition / html-validation-error-normaliser
将HTML验证错误转换为正常形式
1.0
2018-06-29 13:27 UTC
Requires
- php: >=5.6.0
Requires (Dev)
README
你是否曾发现自己面对一串HTML验证错误信息,心想“这些《'required attribute 'type' not specified'》和《'required attribute 'alt' not specified'》错误有些相似,它们有正常形式吗?”
我的建议:走出家门。培养一个爱好。
如果做不到这一点,这个包就是为你准备的!恭喜你。
使用示例
<?php use webignition\HtmlValidationErrorNormaliser\HtmlValidationErrorNormaliser; class ExampleTest extends \PHPUnit_Framework_TestCase { protected function testDemonstrateNormaliser() { $htmlErrorString = 'document type does not allow element "style" here'; $normaliser = new HtmlValidationErrorNormaliser(); $this->assertEquals( 'document type does not allow element "%0" here', $normaliser->normalise($htmlErrorString)->getNormalisedError()->getNormalForm() ); $this->assertEquals( array('style'), $normaliser->normalise($htmlErrorString)->getNormalisedError()->getParameters() ); } }