From d6940c3cc8eebd72627d42a0c0b3139f951716f4 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Wed, 11 Jun 2014 10:05:54 +0200 Subject: PSR-0 vendor namespace --- bin/entities.php | 2 +- composer.json | 4 ++-- src/HTML5.php | 20 +++++++++++--------- src/HTML5/Elements.php | 22 +++++++++++----------- src/HTML5/Entities.php | 2 +- src/HTML5/Exception.php | 2 +- src/HTML5/InstructionProcessor.php | 12 ++++++------ src/HTML5/Parser/CharacterReference.php | 6 +++--- src/HTML5/Parser/DOMTreeBuilder.php | 6 +++--- src/HTML5/Parser/EventHandler.php | 2 +- src/HTML5/Parser/FileInputStream.php | 2 +- src/HTML5/Parser/InputStream.php | 2 +- src/HTML5/Parser/ParseError.php | 2 +- src/HTML5/Parser/Scanner.php | 4 ++-- src/HTML5/Parser/StringInputStream.php | 2 +- src/HTML5/Parser/Tokenizer.php | 8 ++++---- src/HTML5/Parser/TreeBuildingRules.php | 4 ++-- src/HTML5/Parser/UTF8Utils.php | 2 +- src/HTML5/Serializer/HTML5Entities.php | 4 ++-- src/HTML5/Serializer/OutputRules.php | 14 +++++++------- src/HTML5/Serializer/RulesInterface.php | 12 ++++++------ src/HTML5/Serializer/Traverser.php | 2 +- test/HTML5/ElementsTest.php | 7 ++++--- test/HTML5/Html5Test.php | 2 +- test/HTML5/Parser/CharacterReferenceTest.php | 6 +++--- test/HTML5/Parser/DOMTreeBuilderTest.php | 14 +++++++------- test/HTML5/Parser/EventStack.php | 6 +++--- test/HTML5/Parser/EventStackError.php | 2 +- test/HTML5/Parser/FileInputStreamTest.php | 8 ++++---- test/HTML5/Parser/InstructionProcessorMock.php | 4 ++-- test/HTML5/Parser/ScannerTest.php | 10 +++++----- test/HTML5/Parser/StringInputStreamTest.php | 8 ++++---- test/HTML5/Parser/TokenizerTest.php | 14 +++++++------- test/HTML5/Parser/TreeBuildingRulesTest.php | 16 ++++++++-------- test/HTML5/Serializer/OutputRulesTest.php | 14 +++++++------- test/HTML5/Serializer/TraverserTest.php | 18 +++++++++--------- test/HTML5/TestCase.php | 5 +++-- 37 files changed, 137 insertions(+), 133 deletions(-) diff --git a/bin/entities.php b/bin/entities.php index 39f2b45..0fbd6ec 100644 --- a/bin/entities.php +++ b/bin/entities.php @@ -16,7 +16,7 @@ foreach ($json as $name => $obj) { } print 'errors = array(); $events = new DOMTreeBuilder(); $scanner = new Scanner($input); @@ -159,7 +161,7 @@ class HTML5 * Lower-level loading function. This requires an input stream instead * of a string, file, or resource. */ - public function parseFragment(\HTML5\Parser\InputStream $input) { + public function parseFragment(\Masterminds\HTML5\Parser\InputStream $input) { $events = new DOMTreeBuilder(TRUE); $scanner = new Scanner($input); $parser = new Tokenizer($scanner, $events); diff --git a/src/HTML5/Elements.php b/src/HTML5/Elements.php index 678b3ac..31e9e4c 100644 --- a/src/HTML5/Elements.php +++ b/src/HTML5/Elements.php @@ -2,12 +2,12 @@ /** * Provide general element functions. */ -namespace HTML5; +namespace Masterminds\HTML5; /** - * This class provides general information about HTML5 elements, - * including syntactic and semantic issues. Parsers and serializers can - * use this class as a reference point for information about the rules + * This class provides general information about HTML5 elements, + * including syntactic and semantic issues. Parsers and serializers can + * use this class as a reference point for information about the rules * of various HTML5 elements. * * @todo consider using a bitmask table lookup. There is enough overlap in @@ -39,8 +39,8 @@ class Elements { // "pre", "listing" // "form" // "plaintext" - /** - * Indicates that if a previous event is for a P tag, that element + /** + * Indicates that if a previous event is for a P tag, that element * should be considered closed. */ const AUTOCLOSE_P = 16; @@ -82,7 +82,7 @@ class Elements { "command" => 9, // NORMAL | VOID_TAG //"data" => 1, // This is highly experimental and only part of the whatwg spec (not w3c). See https://developer.mozilla.org/en-US/docs/HTML/Element/data "datalist" => 1, - "dd" => 65, // NORMAL | BLOCK_TAG + "dd" => 65, // NORMAL | BLOCK_TAG "del" => 1, "details" => 17, // NORMAL | AUTOCLOSE_P, "dfn" => 1, @@ -189,7 +189,7 @@ class Elements { * * In our case we are only concerned with presentation MathML and not content * MathML. There is a nice list of this subset at https://developer.mozilla.org/en-US/docs/MathML/Element. - * + * * @var array */ public static $mathml = array( @@ -520,8 +520,8 @@ class Elements { * * This includes html5 elements along with other allowed embedded content * such as svg and mathml. - * - * @param string $name + * + * @param string $name * The name of the element. * * @return bool @@ -594,7 +594,7 @@ class Elements { * Normalize a MathML attribute name to its proper case and form. * * Note, all MathML element names are lowercase. - * + * * @param string $name * The name of the attribute. * diff --git a/src/HTML5/Entities.php b/src/HTML5/Entities.php index e5de9e2..2174f0d 100644 --- a/src/HTML5/Entities.php +++ b/src/HTML5/Entities.php @@ -1,5 +1,5 @@ processor = $proc; } diff --git a/src/HTML5/Parser/EventHandler.php b/src/HTML5/Parser/EventHandler.php index 4034938..4a99aa6 100644 --- a/src/HTML5/Parser/EventHandler.php +++ b/src/HTML5/Parser/EventHandler.php @@ -1,5 +1,5 @@ out = $output; } - public function setTraverser(\HTML5\Serializer\Traverser $traverser) { + public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser) { $this->traverser = $traverser; return $this; @@ -208,7 +208,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { * @param string $text * The string to put into the output. * - * @return HTML5\Serializer\Traverser + * @return Masterminds\HTML5\Serializer\Traverser * $this so it can be used in chaining. */ protected function wr($text) { @@ -219,7 +219,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { /** * Write a new line character. * - * @return HTML5\Serializer\Traverser + * @return Masterminds\HTML5\Serializer\Traverser * $this so it can be used in chaining. */ protected function nl() { @@ -274,7 +274,7 @@ class OutputRules implements \HTML5\Serializer\RulesInterface { // If a version earlier than 5.4 html5 entities are not entirely handled. // This manually handles them. else { - return strtr($text, \HTML5\Serializer\HTML5Entities::$map); + return strtr($text, \Masterminds\HTML5\Serializer\HTML5Entities::$map); } } diff --git a/src/HTML5/Serializer/RulesInterface.php b/src/HTML5/Serializer/RulesInterface.php index 18ac8ca..86f44af 100644 --- a/src/HTML5/Serializer/RulesInterface.php +++ b/src/HTML5/Serializer/RulesInterface.php @@ -3,14 +3,14 @@ * @file * The interface definition for Rules to generate output. */ -namespace HTML5\Serializer; +namespace Masterminds\HTML5\Serializer; /** * To create a new rule set for writing output the RulesInterface needs to be * implemented. The resulting class can be specified in the options with the * key of rules. * - * For an example implementation see \HTML5\Serializer\OutputRules. + * For an example implementation see \Masterminds\HTML5\Serializer\OutputRules. */ interface RulesInterface { @@ -31,12 +31,12 @@ interface RulesInterface { * * Note, only one traverser can be used by the rules. * - * @param \HTML5\Serializer\Traverser $traverser + * @param \Masterminds\HTML5\Serializer\Traverser $traverser * The traverser used in the rules. - * @return \HTML5\Serializer\RulesInterface + * @return \Masterminds\HTML5\Serializer\RulesInterface * $this for the current object. */ - public function setTraverser(\HTML5\Serializer\Traverser $traverser); + public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser); /** * Write a document element (\DOMDocument). @@ -91,7 +91,7 @@ interface RulesInterface { /** * Write a processor instruction. * - * To learn about processor instructions see \HTML5\InstructionProcessor + * To learn about processor instructions see \Masterminds\HTML5\InstructionProcessor * * Instead of returning the result write it to the output stream ($output) * that was passed into the constructor. diff --git a/src/HTML5/Serializer/Traverser.php b/src/HTML5/Serializer/Traverser.php index 0794458..bcb9814 100644 --- a/src/HTML5/Serializer/Traverser.php +++ b/src/HTML5/Serializer/Traverser.php @@ -1,5 +1,5 @@ html5Elements as $element) { $this->assertTrue(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element); diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index db8f302..12c421a 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -1,5 +1,5 @@ assertEquals('&', CharacterReference::lookupName('amp')); $this->assertEquals('<', CharacterReference::lookupName('lt')); diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php index ab5378a..52dad30 100644 --- a/test/HTML5/Parser/DOMTreeBuilderTest.php +++ b/test/HTML5/Parser/DOMTreeBuilderTest.php @@ -3,18 +3,18 @@ * @file * Test the Tree Builder. */ -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use HTML5\Elements; -use HTML5\Parser\StringInputStream; -use HTML5\Parser\Scanner; -use HTML5\Parser\Tokenizer; -use HTML5\Parser\DOMTreeBuilder; +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\DOMTreeBuilder; /** * These tests are functional, not necessarily unit tests. */ -class DOMTreeBuilderTest extends \HTML5\Tests\TestCase { +class DOMTreeBuilderTest extends \Masterminds\HTML5\Tests\TestCase { /** * Convenience function for parsing. diff --git a/test/HTML5/Parser/EventStack.php b/test/HTML5/Parser/EventStack.php index acbe3f5..050cb5a 100644 --- a/test/HTML5/Parser/EventStack.php +++ b/test/HTML5/Parser/EventStack.php @@ -1,8 +1,8 @@ assertInstanceOf('\HTML5\Parser\FileInputStream', $s); + $this->assertInstanceOf('\Masterminds\HTML5\Parser\FileInputStream', $s); } public function testNext() { diff --git a/test/HTML5/Parser/InstructionProcessorMock.php b/test/HTML5/Parser/InstructionProcessorMock.php index 86572c7..b668d26 100644 --- a/test/HTML5/Parser/InstructionProcessorMock.php +++ b/test/HTML5/Parser/InstructionProcessorMock.php @@ -1,7 +1,7 @@ assertInstanceOf('\HTML5\Parser\Scanner', $s); + $this->assertInstanceOf('\Masterminds\HTML5\Parser\Scanner', $s); } public function testNext() { diff --git a/test/HTML5/Parser/StringInputStreamTest.php b/test/HTML5/Parser/StringInputStreamTest.php index 8d46bf2..5148e45 100644 --- a/test/HTML5/Parser/StringInputStreamTest.php +++ b/test/HTML5/Parser/StringInputStreamTest.php @@ -1,9 +1,9 @@ assertInstanceOf('\HTML5\Parser\StringInputStream', $s); + $this->assertInstanceOf('\Masterminds\HTML5\Parser\StringInputStream', $s); } public function testNext() { diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index 0990204..27c3535 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -1,12 +1,12 @@ createTokenizer(''<!-- not a comment -->'); - $tok->setTextMode(\HTML5\Elements::TEXT_RCDATA, 'title'); + $tok->setTextMode(\Masterminds\HTML5\Elements::TEXT_RCDATA, 'title'); $tok->parse(); $this->assertEventEquals('text', "'", $events->get(1)); } diff --git a/test/HTML5/Parser/TreeBuildingRulesTest.php b/test/HTML5/Parser/TreeBuildingRulesTest.php index b285073..ff07a0a 100644 --- a/test/HTML5/Parser/TreeBuildingRulesTest.php +++ b/test/HTML5/Parser/TreeBuildingRulesTest.php @@ -3,21 +3,21 @@ * @file * Test the Tree Builder's special-case rules. */ -namespace HTML5\Tests\Parser; +namespace Masterminds\HTML5\Tests\Parser; -use HTML5\Elements; -use HTML5\Parser\TreeBuildingRules; -use HTML5\Parser\Tokenizer; -use HTML5\Parser\Scanner; -use HTML5\Parser\StringInputStream; -use HTML5\Parser\DOMTreeBuilder; +use Masterminds\HTML5\Elements; +use Masterminds\HTML5\Parser\TreeBuildingRules; +use Masterminds\HTML5\Parser\Tokenizer; +use Masterminds\HTML5\Parser\Scanner; +use Masterminds\HTML5\Parser\StringInputStream; +use Masterminds\HTML5\Parser\DOMTreeBuilder; /** * These tests are functional, not necessarily unit tests. */ -class TreeBuildingRulesTest extends \HTML5\Tests\TestCase { +class TreeBuildingRulesTest extends \Masterminds\HTML5\Tests\TestCase { const HTML_STUB = 'test%s'; diff --git a/test/HTML5/Serializer/OutputRulesTest.php b/test/HTML5/Serializer/OutputRulesTest.php index 8e610fd..daae43a 100644 --- a/test/HTML5/Serializer/OutputRulesTest.php +++ b/test/HTML5/Serializer/OutputRulesTest.php @@ -1,11 +1,11 @@ @@ -31,14 +31,14 @@ class OutputRulesTest extends \HTML5\Tests\TestCase { * \ReflectionMethod for the specified method */ function getProtectedMethod($name) { - $class = new \ReflectionClass('\HTML5\Serializer\OutputRules'); + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\OutputRules'); $method = $class->getMethod($name); $method->setAccessible(true); return $method; } function getTraverserProtectedProperty($name) { - $class = new \ReflectionClass('\HTML5\Serializer\Traverser'); + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\Traverser'); $property = $class->getProperty($name); $property->setAccessible(true); return $property; diff --git a/test/HTML5/Serializer/TraverserTest.php b/test/HTML5/Serializer/TraverserTest.php index c63ea2b..2fecc9c 100644 --- a/test/HTML5/Serializer/TraverserTest.php +++ b/test/HTML5/Serializer/TraverserTest.php @@ -1,11 +1,11 @@ @@ -31,7 +31,7 @@ class TraverserTest extends \HTML5\Tests\TestCase { * \ReflectionMethod for the specified method */ function getProtectedMethod($name) { - $class = new \ReflectionClass('\HTML5\Serializer\Traverser'); + $class = new \ReflectionClass('\Masterminds\HTML5\Serializer\Traverser'); $method = $class->getMethod($name); $method->setAccessible(true); return $method; @@ -60,12 +60,12 @@ class TraverserTest extends \HTML5\Tests\TestCase { $t = new Traverser($dom, $stream, $r, $html5->getOptions()); - $this->assertInstanceOf('\HTML5\Serializer\Traverser', $t); + $this->assertInstanceOf('\Masterminds\HTML5\Serializer\Traverser', $t); } function testFragment() { $html = 'foo
bar
'; - $input = new \HTML5\Parser\StringInputStream($html); + $input = new \Masterminds\HTML5\Parser\StringInputStream($html); $dom = $this->html5->parseFragment($input); $this->assertInstanceOf('\DOMDocumentFragment', $dom); @@ -80,7 +80,7 @@ class TraverserTest extends \HTML5\Tests\TestCase { function testProcessorInstruction() { $html = ''; - $input = new \HTML5\Parser\StringInputStream($html); + $input = new \Masterminds\HTML5\Parser\StringInputStream($html); $dom = $this->html5->parseFragment($input); $this->assertInstanceOf('\DOMDocumentFragment', $dom); diff --git a/test/HTML5/TestCase.php b/test/HTML5/TestCase.php index 7e98498..56d2eae 100644 --- a/test/HTML5/TestCase.php +++ b/test/HTML5/TestCase.php @@ -1,6 +1,7 @@ test'; const DOC_CLOSE = ''; @@ -11,7 +12,7 @@ class TestCase extends \PHPUnit_Framework_TestCase { public function getInstance(array $options = array()) { - return new \HTML5($options); + return new HTML5($options); } protected function wrap($fragment) { -- cgit v1.2.3