Passed
Pull Request — master (#1)
by
unknown
04:51
created
plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMText.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class DOMText extends \DOMText
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 }
Please login to merge, or discard this patch.
vendor/andreskrey/Readability/Nodes/DOM/DOMEntityReference.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class DOMEntityReference extends \DOMEntityReference
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 }
Please login to merge, or discard this patch.
af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMNotation.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class DOMNotation extends \DOMNotation
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 }
Please login to merge, or discard this patch.
af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMComment.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class DOMComment extends \DOMComment
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 }
Please login to merge, or discard this patch.
vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentFragment.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class DOMDocumentFragment extends \DOMDocumentFragment
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 }
Please login to merge, or discard this patch.
af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMNodeList.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -14,69 +14,69 @@
 block discarded – undo
14 14
  */
15 15
 class DOMNodeList implements \Countable, \IteratorAggregate
16 16
 {
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $items = [];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $items = [];
21 21
 
22
-    /**
23
-     * @var int
24
-     */
25
-    protected $length = 0;
22
+	/**
23
+	 * @var int
24
+	 */
25
+	protected $length = 0;
26 26
 
27
-    /**
28
-     * To allow access to length in the same way that DOMNodeList allows.
29
-     *
30
-     * {@inheritdoc}
31
-     */
32
-    public function __get($name)
33
-    {
34
-        switch ($name) {
35
-            case 'length':
36
-                return $this->length;
37
-            default:
38
-                trigger_error(sprintf('Undefined property: %s::%s', static::class, $name));
39
-        }
40
-    }
27
+	/**
28
+	 * To allow access to length in the same way that DOMNodeList allows.
29
+	 *
30
+	 * {@inheritdoc}
31
+	 */
32
+	public function __get($name)
33
+	{
34
+		switch ($name) {
35
+			case 'length':
36
+				return $this->length;
37
+			default:
38
+				trigger_error(sprintf('Undefined property: %s::%s', static::class, $name));
39
+		}
40
+	}
41 41
 
42
-    /**
43
-     * @param DOMNode|DOMElement|DOMComment $node
44
-     *
45
-     * @return DOMNodeList
46
-     */
47
-    public function add($node)
48
-    {
49
-        $this->items[] = $node;
50
-        $this->length++;
42
+	/**
43
+	 * @param DOMNode|DOMElement|DOMComment $node
44
+	 *
45
+	 * @return DOMNodeList
46
+	 */
47
+	public function add($node)
48
+	{
49
+		$this->items[] = $node;
50
+		$this->length++;
51 51
 
52
-        return $this;
53
-    }
52
+		return $this;
53
+	}
54 54
 
55
-    /**
56
-     * @param int $offset
57
-     *
58
-     * @return DOMNode|DOMElement|DOMComment
59
-     */
60
-    public function item(int $offset)
61
-    {
62
-        return $this->items[$offset];
63
-    }
55
+	/**
56
+	 * @param int $offset
57
+	 *
58
+	 * @return DOMNode|DOMElement|DOMComment
59
+	 */
60
+	public function item(int $offset)
61
+	{
62
+		return $this->items[$offset];
63
+	}
64 64
 
65
-    /**
66
-     * @return int|void
67
-     */
68
-    public function count(): int
69
-    {
70
-        return $this->length;
71
-    }
65
+	/**
66
+	 * @return int|void
67
+	 */
68
+	public function count(): int
69
+	{
70
+		return $this->length;
71
+	}
72 72
 
73
-    /**
74
-     * To make it compatible with iterator_to_array() function.
75
-     *
76
-     * {@inheritdoc}
77
-     */
78
-    public function getIterator(): \ArrayIterator
79
-    {
80
-        return new \ArrayIterator($this->items);
81
-    }
73
+	/**
74
+	 * To make it compatible with iterator_to_array() function.
75
+	 *
76
+	 * {@inheritdoc}
77
+	 */
78
+	public function getIterator(): \ArrayIterator
79
+	{
80
+		return new \ArrayIterator($this->items);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
     public function __get($name)
33 33
     {
34 34
         switch ($name) {
35
-            case 'length':
36
-                return $this->length;
37
-            default:
38
-                trigger_error(sprintf('Undefined property: %s::%s', static::class, $name));
35
+        case 'length':
36
+            return $this->length;
37
+        default:
38
+            trigger_error(sprintf('Undefined property: %s::%s', static::class, $name));
39 39
         }
40 40
     }
41 41
 
Please login to merge, or discard this patch.
af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocument.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@
 block discarded – undo
6 6
 
7 7
 class DOMDocument extends \DOMDocument
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 
11
-    public function __construct($version, $encoding)
12
-    {
13
-        parent::__construct($version, $encoding);
11
+	public function __construct($version, $encoding)
12
+	{
13
+		parent::__construct($version, $encoding);
14 14
 
15
-        $this->registerNodeClass('DOMAttr', DOMAttr::class);
16
-        $this->registerNodeClass('DOMCdataSection', DOMCdataSection::class);
17
-        $this->registerNodeClass('DOMCharacterData', DOMCharacterData::class);
18
-        $this->registerNodeClass('DOMComment', DOMComment::class);
19
-        $this->registerNodeClass('DOMDocument', self::class);
20
-        $this->registerNodeClass('DOMDocumentFragment', DOMDocumentFragment::class);
21
-        $this->registerNodeClass('DOMDocumentType', DOMDocumentType::class);
22
-        $this->registerNodeClass('DOMElement', DOMElement::class);
23
-        $this->registerNodeClass('DOMEntity', DOMEntity::class);
24
-        $this->registerNodeClass('DOMEntityReference', DOMEntityReference::class);
25
-        $this->registerNodeClass('DOMNode', DOMNode::class);
26
-        $this->registerNodeClass('DOMNotation', DOMNotation::class);
27
-        $this->registerNodeClass('DOMProcessingInstruction', DOMProcessingInstruction::class);
28
-        $this->registerNodeClass('DOMText', DOMText::class);
29
-    }
15
+		$this->registerNodeClass('DOMAttr', DOMAttr::class);
16
+		$this->registerNodeClass('DOMCdataSection', DOMCdataSection::class);
17
+		$this->registerNodeClass('DOMCharacterData', DOMCharacterData::class);
18
+		$this->registerNodeClass('DOMComment', DOMComment::class);
19
+		$this->registerNodeClass('DOMDocument', self::class);
20
+		$this->registerNodeClass('DOMDocumentFragment', DOMDocumentFragment::class);
21
+		$this->registerNodeClass('DOMDocumentType', DOMDocumentType::class);
22
+		$this->registerNodeClass('DOMElement', DOMElement::class);
23
+		$this->registerNodeClass('DOMEntity', DOMEntity::class);
24
+		$this->registerNodeClass('DOMEntityReference', DOMEntityReference::class);
25
+		$this->registerNodeClass('DOMNode', DOMNode::class);
26
+		$this->registerNodeClass('DOMNotation', DOMNotation::class);
27
+		$this->registerNodeClass('DOMProcessingInstruction', DOMProcessingInstruction::class);
28
+		$this->registerNodeClass('DOMText', DOMText::class);
29
+	}
30 30
 }
Please login to merge, or discard this patch.
af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMEntity.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class DOMEntity extends \DOMEntity
8 8
 {
9
-    use NodeTrait;
9
+	use NodeTrait;
10 10
 }
Please login to merge, or discard this patch.
plugins/af_readability/vendor/andreskrey/Readability/Nodes/NodeUtility.php 1 patch
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -12,126 +12,126 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class NodeUtility
14 14
 {
15
-    /**
16
-     * Collection of regexps to check the node usability.
17
-     *
18
-     * @var array
19
-     */
20
-    public static $regexps = [
21
-        'unlikelyCandidates' => '/-ad-|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i',
22
-        'okMaybeItsACandidate' => '/and|article|body|column|main|shadow/i',
23
-        'extraneous' => '/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i',
24
-        'byline' => '/byline|author|dateline|writtenby|p-author/i',
25
-        'replaceFonts' => '/<(\/?)font[^>]*>/gi',
26
-        'normalize' => '/\s{2,}/',
27
-        'videos' => '/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i',
28
-        'nextLink' => '/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i',
29
-        'prevLink' => '/(prev|earl|old|new|<|«)/i',
30
-        'whitespace' => '/^\s*$/',
31
-        'hasContent' => '/\S$/',
32
-        'positive' => '/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i',
33
-        'negative' => '/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i',
34
-        // \x{00A0} is the unicode version of &nbsp;
35
-        'onlyWhitespace' => '/\x{00A0}|\s+/u'
36
-    ];
37
-
38
-    /**
39
-     * Imported from the Element class on league\html-to-markdown.
40
-     *
41
-     * @param $node
42
-     *
43
-     * @return DOMElement
44
-     */
45
-    public static function nextElement($node)
46
-    {
47
-        $next = $node;
48
-        while ($next
49
-            && $next->nodeType !== XML_ELEMENT_NODE
50
-            && $next->isWhitespace()) {
51
-            $next = $next->nextSibling;
52
-        }
53
-
54
-        return $next;
55
-    }
56
-
57
-    /**
58
-     * Changes the node tag name. Since tagName on DOMElement is a read only value, this must be done creating a new
59
-     * element with the new tag name and importing it to the main DOMDocument.
60
-     *
61
-     * @param DOMNode $node
62
-     * @param string $value
63
-     * @param bool $importAttributes
64
-     *
65
-     * @return DOMNode
66
-     */
67
-    public static function setNodeTag($node, $value, $importAttributes = true)
68
-    {
69
-        $new = new DOMDocument('1.0', 'utf-8');
70
-        $new->appendChild($new->createElement($value));
71
-
72
-        $children = $node->childNodes;
73
-        /** @var $children \DOMNodeList $i */
74
-        for ($i = 0; $i < $children->length; $i++) {
75
-            $import = $new->importNode($children->item($i), true);
76
-            $new->firstChild->appendChild($import);
77
-        }
78
-
79
-        if ($importAttributes) {
80
-            // Import attributes from the original node.
81
-            foreach ($node->attributes as $attribute) {
82
-                $new->firstChild->setAttribute($attribute->nodeName, $attribute->nodeValue);
83
-            }
84
-        }
85
-
86
-        // The import must be done on the firstChild of $new, since $new is a DOMDocument and not a DOMElement.
87
-        $import = $node->ownerDocument->importNode($new->firstChild, true);
88
-        $node->parentNode->replaceChild($import, $node);
89
-
90
-        return $import;
91
-    }
92
-
93
-    /**
94
-     * Removes the current node and returns the next node to be parsed (child, sibling or parent).
95
-     *
96
-     * @param DOMNode $node
97
-     *
98
-     * @return DOMNode
99
-     */
100
-    public static function removeAndGetNext($node)
101
-    {
102
-        $nextNode = self::getNextNode($node, true);
103
-        $node->parentNode->removeChild($node);
104
-
105
-        return $nextNode;
106
-    }
107
-
108
-    /**
109
-     * Remove the selected node.
110
-     *
111
-     * @param $node DOMElement
112
-     *
113
-     * @return void
114
-     **/
115
-    public static function removeNode($node)
116
-    {
117
-        $parent = $node->parentNode;
118
-        if ($parent) {
119
-            $parent->removeChild($node);
120
-        }
121
-    }
122
-
123
-    /**
124
-     * Returns the next node. First checks for children (if the flag allows it), then for siblings, and finally
125
-     * for parents.
126
-     *
127
-     * @param DOMNode $originalNode
128
-     * @param bool $ignoreSelfAndKids
129
-     *
130
-     * @return DOMNode
131
-     */
132
-    public static function getNextNode($originalNode, $ignoreSelfAndKids = false)
133
-    {
134
-        /*
15
+	/**
16
+	 * Collection of regexps to check the node usability.
17
+	 *
18
+	 * @var array
19
+	 */
20
+	public static $regexps = [
21
+		'unlikelyCandidates' => '/-ad-|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i',
22
+		'okMaybeItsACandidate' => '/and|article|body|column|main|shadow/i',
23
+		'extraneous' => '/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i',
24
+		'byline' => '/byline|author|dateline|writtenby|p-author/i',
25
+		'replaceFonts' => '/<(\/?)font[^>]*>/gi',
26
+		'normalize' => '/\s{2,}/',
27
+		'videos' => '/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i',
28
+		'nextLink' => '/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i',
29
+		'prevLink' => '/(prev|earl|old|new|<|«)/i',
30
+		'whitespace' => '/^\s*$/',
31
+		'hasContent' => '/\S$/',
32
+		'positive' => '/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i',
33
+		'negative' => '/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i',
34
+		// \x{00A0} is the unicode version of &nbsp;
35
+		'onlyWhitespace' => '/\x{00A0}|\s+/u'
36
+	];
37
+
38
+	/**
39
+	 * Imported from the Element class on league\html-to-markdown.
40
+	 *
41
+	 * @param $node
42
+	 *
43
+	 * @return DOMElement
44
+	 */
45
+	public static function nextElement($node)
46
+	{
47
+		$next = $node;
48
+		while ($next
49
+			&& $next->nodeType !== XML_ELEMENT_NODE
50
+			&& $next->isWhitespace()) {
51
+			$next = $next->nextSibling;
52
+		}
53
+
54
+		return $next;
55
+	}
56
+
57
+	/**
58
+	 * Changes the node tag name. Since tagName on DOMElement is a read only value, this must be done creating a new
59
+	 * element with the new tag name and importing it to the main DOMDocument.
60
+	 *
61
+	 * @param DOMNode $node
62
+	 * @param string $value
63
+	 * @param bool $importAttributes
64
+	 *
65
+	 * @return DOMNode
66
+	 */
67
+	public static function setNodeTag($node, $value, $importAttributes = true)
68
+	{
69
+		$new = new DOMDocument('1.0', 'utf-8');
70
+		$new->appendChild($new->createElement($value));
71
+
72
+		$children = $node->childNodes;
73
+		/** @var $children \DOMNodeList $i */
74
+		for ($i = 0; $i < $children->length; $i++) {
75
+			$import = $new->importNode($children->item($i), true);
76
+			$new->firstChild->appendChild($import);
77
+		}
78
+
79
+		if ($importAttributes) {
80
+			// Import attributes from the original node.
81
+			foreach ($node->attributes as $attribute) {
82
+				$new->firstChild->setAttribute($attribute->nodeName, $attribute->nodeValue);
83
+			}
84
+		}
85
+
86
+		// The import must be done on the firstChild of $new, since $new is a DOMDocument and not a DOMElement.
87
+		$import = $node->ownerDocument->importNode($new->firstChild, true);
88
+		$node->parentNode->replaceChild($import, $node);
89
+
90
+		return $import;
91
+	}
92
+
93
+	/**
94
+	 * Removes the current node and returns the next node to be parsed (child, sibling or parent).
95
+	 *
96
+	 * @param DOMNode $node
97
+	 *
98
+	 * @return DOMNode
99
+	 */
100
+	public static function removeAndGetNext($node)
101
+	{
102
+		$nextNode = self::getNextNode($node, true);
103
+		$node->parentNode->removeChild($node);
104
+
105
+		return $nextNode;
106
+	}
107
+
108
+	/**
109
+	 * Remove the selected node.
110
+	 *
111
+	 * @param $node DOMElement
112
+	 *
113
+	 * @return void
114
+	 **/
115
+	public static function removeNode($node)
116
+	{
117
+		$parent = $node->parentNode;
118
+		if ($parent) {
119
+			$parent->removeChild($node);
120
+		}
121
+	}
122
+
123
+	/**
124
+	 * Returns the next node. First checks for children (if the flag allows it), then for siblings, and finally
125
+	 * for parents.
126
+	 *
127
+	 * @param DOMNode $originalNode
128
+	 * @param bool $ignoreSelfAndKids
129
+	 *
130
+	 * @return DOMNode
131
+	 */
132
+	public static function getNextNode($originalNode, $ignoreSelfAndKids = false)
133
+	{
134
+		/*
135 135
          * Traverse the DOM from node to node, starting at the node passed in.
136 136
          * Pass true for the second parameter to indicate this node itself
137 137
          * (and its kids) are going away, and we want the next node over.
@@ -139,42 +139,42 @@  discard block
 block discarded – undo
139 139
          * Calling this in a loop will traverse the DOM depth-first.
140 140
          */
141 141
 
142
-        // First check for kids if those aren't being ignored
143
-        if (!$ignoreSelfAndKids && $originalNode->firstChild) {
144
-            return $originalNode->firstChild;
145
-        }
146
-
147
-        // Then for siblings...
148
-        if ($originalNode->nextSibling) {
149
-            return $originalNode->nextSibling;
150
-        }
151
-
152
-        // And finally, move up the parent chain *and* find a sibling
153
-        // (because this is depth-first traversal, we will have already
154
-        // seen the parent nodes themselves).
155
-        do {
156
-            $originalNode = $originalNode->parentNode;
157
-        } while ($originalNode && !$originalNode->nextSibling);
158
-
159
-        return ($originalNode) ? $originalNode->nextSibling : $originalNode;
160
-    }
161
-
162
-    /**
163
-     * Remove all empty DOMNodes from DOMNodeLists.
164
-     *
165
-     * @param \DOMNodeList $list
166
-     *
167
-     * @return DOMNodeList
168
-     */
169
-    public static function filterTextNodes(\DOMNodeList $list)
170
-    {
171
-        $newList = new DOMNodeList();
172
-        foreach ($list as $node) {
173
-            if ($node->nodeType !== XML_TEXT_NODE || mb_strlen(trim($node->nodeValue))) {
174
-                $newList->add($node);
175
-            }
176
-        }
177
-
178
-        return $newList;
179
-    }
142
+		// First check for kids if those aren't being ignored
143
+		if (!$ignoreSelfAndKids && $originalNode->firstChild) {
144
+			return $originalNode->firstChild;
145
+		}
146
+
147
+		// Then for siblings...
148
+		if ($originalNode->nextSibling) {
149
+			return $originalNode->nextSibling;
150
+		}
151
+
152
+		// And finally, move up the parent chain *and* find a sibling
153
+		// (because this is depth-first traversal, we will have already
154
+		// seen the parent nodes themselves).
155
+		do {
156
+			$originalNode = $originalNode->parentNode;
157
+		} while ($originalNode && !$originalNode->nextSibling);
158
+
159
+		return ($originalNode) ? $originalNode->nextSibling : $originalNode;
160
+	}
161
+
162
+	/**
163
+	 * Remove all empty DOMNodes from DOMNodeLists.
164
+	 *
165
+	 * @param \DOMNodeList $list
166
+	 *
167
+	 * @return DOMNodeList
168
+	 */
169
+	public static function filterTextNodes(\DOMNodeList $list)
170
+	{
171
+		$newList = new DOMNodeList();
172
+		foreach ($list as $node) {
173
+			if ($node->nodeType !== XML_TEXT_NODE || mb_strlen(trim($node->nodeValue))) {
174
+				$newList->add($node);
175
+			}
176
+		}
177
+
178
+		return $newList;
179
+	}
180 180
 }
Please login to merge, or discard this patch.