Skip to content

Commit

Permalink
Merge pull request #9 from ntd/scrutinizer-patch-1
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
ntd committed Aug 4, 2016
2 parents ea0a0bd + 5bc2a28 commit 641102e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions code/Tocifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function &_newNode($id, $text, $level)
}

// Consider this node a potential dangling parent
$this->_dangling[$level] =& $node;
$this->_dangling[$level] = & $node;

return $node;
}
Expand All @@ -96,7 +96,7 @@ private function &_newNode($id, $text, $level)
*/
private function _processDocument($doc)
{
$this->_tree =& $this->_newNode(self::$prefix, '', 0);
$this->_tree = & $this->_newNode(self::$prefix, '', 0);
$n = 1;

$xpath = new DOMXPath($doc);
Expand All @@ -105,16 +105,16 @@ private function _processDocument($doc)
foreach ($xpath->query($query) as $h) {
$text = $this->_getPlainText($h);
$level = (int) substr($h->tagName, 1);
$id = self::$prefix . $n;
$id = self::$prefix.$n;
++$n;

// Build the tree
$parent =& $this->_getParent($level);
$node =& $this->_newNode($id, $text, $level);
if (! isset($parent['children'])) {
$parent = & $this->_getParent($level);
$node = & $this->_newNode($id, $text, $level);
if (!isset($parent['children'])) {
$parent['children'] = array();
}
$parent['children'][] =& $node;
$parent['children'][] = & $node;

call_user_func($this->_augment_callback, $doc, $h, $id);
}
Expand All @@ -132,7 +132,7 @@ private function _processDocument($doc)
*/
private function _dumpBranch($node, $indent = '')
{
echo $indent . $node['title'] . "\n";
echo $indent.$node['title']."\n";
if (isset($node['children'])) {
foreach ($node['children'] as &$child) {
$this->_dumpBranch($child, "$indent\t");
Expand Down Expand Up @@ -197,7 +197,7 @@ public function setAugmentCallback($callback)
public function process()
{
// Check if $this->_raw_html is valid
if (! is_string($this->_raw_html) || empty($this->_raw_html)) {
if (!is_string($this->_raw_html) || empty($this->_raw_html)) {
return false;
}

Expand All @@ -208,7 +208,7 @@ public function process()

// Parse the HTML into a DOMDocument tree
$doc = new DOMDocument();
if (! @$doc->loadHTML($html)) {
if (!@$doc->loadHTML($html)) {
return false;
}

Expand Down

0 comments on commit 641102e

Please sign in to comment.