Completed
Push — master ( e74d94...4f7e5e )
by Thomas
03:05
created

src/FluentDOM/Serializer/Html.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Serialize a DOM into an Html string.
4
 *
5
 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
6
 * @copyright Copyright (c) 2009-2017 FluentDOM Contributors
7
 */
8
9
namespace FluentDOM\Serializer {
10
11
  use FluentDOM\Utility\StringCastable;
12
13 View Code Duplication
  class Html implements StringCastable {
1 ignored issue
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
    /**
15
     * @var \DOMNode
16
     */
17
    protected $_node;
18
19
    /**
20
     * @param \DOMNode $node
21
     */
22 1
    public function __construct(\DOMNode $node) {
23 1
      $this->_node = $node;
24 1
    }
25
26
    /**
27
     * @return string
28
     */
29 1
    public function __toString(): string {
30 1
      return $this->_node instanceof \DOMDocument
31 1
        ? $this->_node->saveHTML()
32 1
        : $this->_node->ownerDocument->saveHTML($this->_node);
33
    }
34
  }
35
}