Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemorroj committed Dec 31, 2019
1 parent 201b753 commit 0e5221a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Tag/Spoiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function getAttributes()
$attr->add('class', 'bb_spoiler');
$attr->set('style', 'display: none');

$id = \uniqid('xbbcode');
$id = \uniqid('xbbcode', true);
$attr->set('id', $id);

return $attr;
Expand Down
20 changes: 10 additions & 10 deletions src/Xbbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ public function __construct($webPath = '', array $allowed = null)
// In case if $allowed is not an array, assuming that everything is allowed
if ($allowed) {
foreach ($this->getTags() as $key => $value) {
if (!\in_array($key, $allowed)) {
if (!\in_array($key, $allowed, true)) {
unset($this->tags[$key]);
}
}
Expand Down Expand Up @@ -1146,7 +1146,7 @@ protected function getToken()
} else {
break;
}
$this->cursor += 1;
++$this->cursor;
}

if (isset($this->tags[\strtolower($token)])) {
Expand Down Expand Up @@ -1730,7 +1730,7 @@ protected function mustCloseTag($current, $next)

$mustClose = false;
if (isset($this->ends[$currentBehaviour])) {
$mustClose = \in_array($nextBehaviour, $this->ends[$currentBehaviour]);
$mustClose = \in_array($nextBehaviour, $this->ends[$currentBehaviour], true);
}

return $mustClose;
Expand Down Expand Up @@ -1765,7 +1765,7 @@ protected function isPermissiblyChild($parent, $child)
}
$permissibly = true;
if (isset($this->children[$parent_behaviour])) {
$permissibly = \in_array($child_behaviour, $this->children[$parent_behaviour]);
$permissibly = \in_array($child_behaviour, $this->children[$parent_behaviour], true);
}

return $permissibly;
Expand Down Expand Up @@ -1866,7 +1866,7 @@ protected function normalizeBracket(array $syntax)
unset($open_tags[$ult_key]);
break;
}
if (!\in_array($val['name'], $open_tags)) {
if (!\in_array($val['name'], $open_tags, true)) {
$type = (-1 < $structure_key) ? $structure[$structure_key]['type'] : false;
if ('text' === $type) {
$structure[$structure_key]['str'] .= $val['str'];
Expand Down Expand Up @@ -1960,7 +1960,7 @@ protected function parseTree()
}
$normalized[++$normal_key] = $val;
$normalized[$normal_key]['level'] = $level;
$this->statistics['count_tags'] += 1;
++$this->statistics['count_tags'];
break;
case 'open':
$this->includeTag($val['name']);
Expand All @@ -1985,7 +1985,7 @@ protected function parseTree()
$normalized[$normal_key]['level'] = $level++;
$ult_key = \count($open_tags);
$open_tags[$ult_key] = $val['name'];
$this->statistics['count_tags'] += 1;
++$this->statistics['count_tags'];
break;
case 'close':
$not_normal = isset($not_tags[$val['level']]) && $not_tags[$val['level']] = $val['name'];
Expand All @@ -2007,7 +2007,7 @@ protected function parseTree()
$normalized[$normal_key]['level'] = --$level;
$ult_key = \count($open_tags) - 1;
unset($open_tags[$ult_key]);
$this->statistics['count_tags'] += 1;
++$this->statistics['count_tags'];
break;
}
}
Expand Down Expand Up @@ -2070,7 +2070,7 @@ protected function parseTree()
break;
}
if ($val['level'] > $this->statistics['count_level']) {
$this->statistics['count_level'] += 1;
++$this->statistics['count_level'];
}
}

Expand Down Expand Up @@ -2280,7 +2280,7 @@ public function getHtml(array $elems = null)
$elem['str'] = $this->insertMnemonics($elem['str']);
for ($i = 0; $i < $rbr; ++$i) {
$elem['str'] = \ltrim($elem['str']);
if ('<br />' === \substr($elem['str'], 0, 6)) {
if (0 === \strpos($elem['str'], '<br />')) {
$elem['str'] = \substr_replace($elem['str'], '', 0, 6);
}
}
Expand Down

0 comments on commit 0e5221a

Please sign in to comment.