Fixed issues after running make code_sniffer

This commit is contained in:
Keith Carangelo 2021-09-08 15:46:51 -04:00
parent 6202038c65
commit c6f27b1ade

View file

@ -347,7 +347,7 @@ public function filterTags($tags, bool $casesensitive = false, string $visibilit
return startsWith($tag, '~') ? substr($tag, 1) : null; return startsWith($tag, '~') ? substr($tag, 1) : null;
}, $inputTags)); }, $inputTags));
$re_or = implode('|', array_map([$this, 'tag2match_term'], $orTags)); $re_or = implode('|', array_map([$this, 'tag2matchterm'], $orTags));
if ($re_or) { if ($re_or) {
$re_or = '(' . $re_or . ')'; $re_or = '(' . $re_or . ')';
$re .= $this->term2match($re_or, false); $re .= $this->term2match($re_or, false);
@ -472,7 +472,9 @@ public static function tagsStrToArray(string $tags, bool $casesensitive): array
/** /**
* generate a regex fragment out of a tag * generate a regex fragment out of a tag
* *
* @param string $tag to generate regexs from. may start with '-' to negate, contain '*' as wildcard. Tags starting with '~' are treated separately as an 'OR' clause. * @param string $tag to generate regexs from. may start with '-'
* to negate, contain '*' as wildcard. Tags starting with '~' are
* treated separately as an 'OR' clause.
* *
* @return string generated regex fragment * @return string generated regex fragment
*/ */
@ -492,7 +494,7 @@ protected function tag2regex(string $tag): string
$tag = substr($tag, 1); // use offset to start after '-' character $tag = substr($tag, 1); // use offset to start after '-' character
$negate = true; $negate = true;
} }
$term = $this->tag2match_term( $tag ); $term = $this->tag2matchterm($tag);
return $this->term2match($term, $negate); return $this->term2match($term, $negate);
} }
@ -500,11 +502,14 @@ protected function tag2regex(string $tag): string
/** /**
* generate a regex match term fragment out of a tag * generate a regex match term fragment out of a tag
* *
* @param string $tag to to generate regexs from. This function assumes any leading flags ('-', '~') have been stripped. The wildcard flag '*' is expanded by this function and any other regex characters are escaped. * @param string $tag to to generate regexs from. This function
* assumes any leading flags ('-', '~') have been stripped. The
* wildcard flag '*' is expanded by this function and any other
* regex characters are escaped.
* *
* @return string generated regex match term fragment * @return string generated regex match term fragment
*/ */
protected function tag2match_term(string $tag): string protected function tag2matchterm(string $tag): string
{ {
$tagsSeparator = $this->conf->get('general.tags_separator', ' '); $tagsSeparator = $this->conf->get('general.tags_separator', ' ');
$len = strlen($tag); $len = strlen($tag);
@ -537,7 +542,7 @@ protected function tag2match_term(string $tag): string
/** /**
* generate a regex fragment out of a match term * generate a regex fragment out of a match term
* *
* @param string $term is the match term already generated by tag2match_term * @param string $term is the match term already generated by tag2matchterm
* @param bool $negate if true create a negative lookahead * @param bool $negate if true create a negative lookahead
* *
* @return string generated regex fragment * @return string generated regex fragment