Add a pattern to the default excludes unless it is already a
default exclude.

@param  string $s A string to add as an exclude pattern.
@return boolean   <code>true</code> if the string was added;
<code>false</code> if it already existed.
164134
public static function addDefaultExclude($s)
    {
        if (!in_array($s, self::$defaultExcludeList)) {
            $return = true;
            self::$defaultExcludeList[] = $s;
        } else {
            $return = false;
        }

        return $return;
    }
401494
public function matches($pattern)
    {
        $this->isString();

        $this->doCheck(function ($value) use ($pattern) {
            $this->throwExceptionIfFalse(
                preg_match($pattern, $value),
                'String "%s" does not match "%s"', $value, $pattern
            );
        });

        return $this;
    }
646903
protected function skipByPattern()
    {
        $skip = $this->config->get('pattern-skip-version', false);

        return \is_string($skip)
            ? trim($skip, '/')
            : false;
    }
1087106
public function addSecs($s)
    {
        if (is_int($s) === false) {
            throw new MWrongTypeException("\$s", "int", gettype($s));
        }

        $mseconds = $this->mseconds;
        $mseconds += ($s * 1000);

        $return = new MTime(0, 0, 0, $mseconds);

        return $return;
    }
808950
public function addPattern($name, $pattern)
    {
        if (!$this->hasPattern($name)) {
            $this->setPattern($name, $pattern);
        }

        return $this;
    }
494184
function addPattern($pattern, $label = true) {
            $count = count($this->_patterns);
            $this->_patterns[$count] = $pattern;
            $this->_labels[$count] = $label;
            $this->_regex = null;
        }
1236074
public function filterSubstring($s)
    {
        //convert to ascii -> translate strange chars
        $s = $this->convertToAscii($s);
        //trim spaces
        $s = $this->trimString($s);
        //replace delimiters with another character
        $s = $this->replaceDelimiters($s);
        //lower chars
        $s = $this->toLowerChars($s);
        //delete chars except a-z0-9
        $s = $this->trimSpecialsChars($s);
        //replace double dashes with single one
        $s = $this->replaceDoubleDelimiterReplacementWithSingle($s);
        //trim dashes on beginning/end of the string
        $s = $this->trimStartAndEndSpaceReplacement($s);
        return $s;
    }
925766
public function set_excluded($state) {
        if (empty($this->excluded) and $state) {
            $this->excluded = time();
            $this->update();
            return true;

        } else if (!empty($this->excluded) and !$state) {
            $this->excluded = 0;
            $this->update();
            return true;
        }
        return false;
    }
422739
public function addslashes($s) {
        // do not use php addslashes() because it depends on PHP quote settings!
        $s = str_replace('\\','\\\\',$s);
        $s = str_replace("\0","\\\0", $s);
        $s = str_replace("'",  "\\'", $s);
        return $s;
    }
1104977
public static function isBoolean($s)
    {
        if (is_bool($s)) {
            return true; // it already is boolean
        }

        if ($s === "" || $s === null || !is_string($s)) {
            return false; // not a valid string for testing
        }

        $test = strtolower(trim($s));

        return in_array($test, array_merge(self::$FALSE_VALUES, self::$TRUE_VALUES), true);
    }
702699
private function isExcludedFromVerbatim($file)
    {
        foreach ($this->copyVerbatimExcludePatterns as $pattern) {
            if (Str::is($pattern, $file)) {
                return true;
            }
        }

        return false;
    }
913746
public function addPattern($pattern)
    {
        $this->doAddPattern($this->convertPattern($pattern));
        $this->hasPattern = true;
    }
984408
public function startsWith($pattern)
  {
    return (substr($this->string, 0, strlen($pattern)) == $pattern) ? TRUE : FALSE;
  }
1332536
protected function _addFilter($sQ)
    {
        if ($sQ && ($sFilter = $this->_getFilter())) {
            $sQ .= ((stristr($sQ, 'where') === false) ? 'where' : ' and ') . $sFilter;
        }

        return $sQ;
    }
1167445
public static function unescape($s)
    {
        $out = '';
        /** @noinspection ForeachInvariantsInspection */
        for ($count = 0, $n = \strlen($s); $count < $n; $count++) {
            if ($s[$count] !== '\\') {
                $out .= $s[$count];
            } else {
                // A backslash at the end of the string - ignore it
                if ($count === ($n - 1)) {
                    break;
                }

                switch ($s[++$count]) {
                    case ')':
                    case '(':
                    case '\\':
                        $out .= $s[$count];
                        break;

                    case 'f':
                        $out .= "\x0C";
                        break;

                    case 'b':
                        $out .= "\x08";
                        break;

                    case 't':
                        $out .= "\x09";
                        break;

                    case 'r':
                        $out .= "\x0D";
                        break;

                    case 'n':
                        $out .= "\x0A";
                        break;

                    case "\r":
                        if ($count !== $n - 1 && $s[$count + 1] === "\n") {
                            $count++;
                        }
                        break;

                    case "\n":
                        break;

                    default:
                        $actualChar = \ord($s[$count]);
                        // ascii 48 = number 0
                        // ascii 57 = number 9
                        if ($actualChar >= 48 &&
                            $actualChar <= 57) {
                            $oct = '' . $s[$count];

                            /** @noinspection NotOptimalIfConditionsInspection */
                            if ($count + 1 < $n &&
                                \ord($s[$count + 1]) >= 48 &&
                                \ord($s[$count + 1]) <= 57
                            ) {
                                $count++;
                                $oct .= $s[$count];

                                /** @noinspection NotOptimalIfConditionsInspection */
                                if ($count + 1 < $n &&
                                    \ord($s[$count + 1]) >= 48 &&
                                    \ord($s[$count + 1]) <= 57
                                ) {
                                    $oct .= $s[++$count];
                                }
                            }

                            $out .= \chr(\octdec($oct));
                        } else {
                            // If the character is not one of those defined, the backslash is ignored
                            $out .= $s[$count];
                        }
                }
            }
        }
        return $out;
    }
1088835
public function notMatch($pattern) {
        if (!$this->_isValid) {
            return $this;
        }
        if (preg_match($pattern, $this->_unsafeVar)) {
            $this->_isValid = false;
        }
        return $this;
    }
863441
public function getStyle(string $s): array
    {
        if (!isset($this->wt_report->styles[$s])) {
            $s                           = $this->getCurrentStyle();
            $this->wt_report->styles[$s] = $s;
        }

        return $this->wt_report->styles[$s];
    }