Check for silenced call to functions.

@param String $text
The text of the token to test
196984
private function _checkSilenced($text) {
		if ($this->_isActive('checkSilencedError')) {
			if (!$this->_config->isException('checkSilencedError', $text)) {
				$previousToken = $this->tokenizer->peekPrvsToken();
				if ($previousToken->id === T_AROBAS) {
					$this->_writeError('checkSilencedError', $this->_getMessage('SILENCED_ERROR'));
				}
			}
		}
	}
524068
protected function _replaceTags(&$text)
    {
        if (!empty($this->_stripped_tags)) {
            $text = str_replace($this->_stripped_tags[0], $this->_stripped_tags[1], $text);
        }
    }
1117137
private function addTranslatable($text)
    {
        if (strlen($text) > 1 && !isset($this->translatables[$text])) {
            $this->translatables[$text] = '';
        }
    }
1092025
private function is_silenced($path) {
		foreach ($this->silenced_paths as $silenced_path) {
			if (preg_match($silenced_path, $path)) {
				return true;
			}
		}

		return false;
	}
56963
public function setText(string $text): void
    {
        $this->text = $text;

        if ( ! is_null($this->encode)) {
            $text = $this->encode->convert($text);

            // remember the conversion
            $this->convertedText = $text;
        }
    }
84390
private function _checkWhiteSpaceBefore($text) {
		if ($this->_isActive('checkWhiteSpaceBefore')) {

			if (!$this->_config->isException('checkWhiteSpaceBefore', $text)) {

				if (!$this->tokenizer->checkPreviousToken(T_WHITESPACE)) {
					$msg = $this->_getMessage('SPACE_BEFORE_TOKEN', $text);
					$this->_writeError('checkWhiteSpaceBefore', $msg);
				}
			}
		}
	}
1369253
function check($text)
    {
        $this->init();

        if (!$this->enchant_dictionary) {
            return array();
        }

        // tokenize
        $text = preg_split($this->separator, $text, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE);

        $diff       = 0;
        $matches    = array();

        foreach ($text as $w) {
            $word = trim($w[0]);
            $pos  = $w[1] - $diff;
            $len  = mb_strlen($word);

            // skip exceptions
            if ($this->dictionary->is_exception($word)) {
            }
            else if (!enchant_dict_check($this->enchant_dictionary, $word)) {
                $suggestions = enchant_dict_suggest($this->enchant_dictionary, $word);

                if (is_array($suggestions) && count($suggestions) > self::MAX_SUGGESTIONS) {
                    $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);
                }

                $matches[] = array($word, $pos, $len, null, $suggestions);
            }

            $diff += (strlen($word) - $len);
        }

        $this->matches = $matches;
        return $matches;
    }
717367
public function restore_noise($text)
    {
        global $debugObject;
        if (is_object($debugObject)) {
            $debugObject->debugLogEntry(1);
        }

        while (($pos = strpos($text, '___noise___')) !== false) {
            // Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us...
            if (strlen($text) > $pos + 15) {
                $key = '___noise___' . $text[$pos + 11] . $text[$pos + 12] . $text[$pos + 13] . $text[$pos + 14] . $text[$pos + 15];
                if (is_object($debugObject)) {
                    $debugObject->debugLog(2, 'located key of: ' . $key);
                }

                if (isset($this->noise[$key])) {
                    $text = substr($text, 0, $pos) . $this->noise[$key] . substr($text, $pos + 16);
                } else {
                    // do this to prevent an infinite loop.
                    $text = substr($text, 0, $pos) . 'UNDEFINED NOISE FOR KEY: ' . $key . substr($text, $pos + 16);
                }
            } else {
                // There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem.
                $text = substr($text, 0, $pos) . 'NO NUMERIC NOISE KEY' . substr($text, $pos + 11);
            }
        }
        return $text;
    }
136028
public function theOutputShouldContain(PyStringNode $text)
    {
        PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
    }
1092582
public function e($text, $context = array())
    {
        $this->log->error($text, $context);
        $this->emit(self::SIGNAL_ERROR_ENTERED);
    }
231715
protected function removeComments($text) {
$look = array(
'url(', '//', '/*', '"', "'"
);

$out = '';
$min = null;
while (true) {
// find the next item
foreach ($look as $token) {
$pos = strpos($text, $token);
if ($pos !== false) {
if (!isset($min) || $pos < $min[1]) $min = array($token, $pos);
}
}

if (is_null($min)) break;

$count = $min[1];
$skip = 0;
$newlines = 0;
switch ($min[0]) {
case 'url(':
if (preg_match('/url\(.*?\)/', $text, $m, 0, $count))
$count += strlen($m[0]) - strlen($min[0]);
break;
case '"':
case "'":
if (preg_match('/'.$min[0].'.*?(?<!\\\\)'.$min[0].'/', $text, $m, 0, $count))
$count += strlen($m[0]) - 1;
break;
case '//':
$skip = strpos($text, "\n", $count);
if ($skip === false) $skip = strlen($text) - $count;
else $skip -= $count;
break;
case '/*':
if (preg_match('/\/\*.*?\*\//s', $text, $m, 0, $count)) {
$skip = strlen($m[0]);
$newlines = substr_count($m[0], "\n");
}
break;
}

if ($skip == 0) $count += strlen($min[0]);

$out .= substr($text, 0, $count).str_repeat("\n", $newlines);
$text = substr($text, $count + $skip);

$min = null;
}

return $out.$text;
}
375432
private function _checkWhiteSpaceAfter($text) {
		if ($this->_isActive('checkWhiteSpaceAfter')) {
			if (!$this->_config->isException('checkWhiteSpaceAfter', $text)) {

				if (!$this->tokenizer->checkNextToken(T_WHITESPACE)) {
					// In case of new line or a PHP closing tag it's OK
					if (!($this->tokenizer->checkNextToken(T_NEW_LINE) || $this->tokenizer->checkNextToken(T_CLOSE_TAG))) {
						$msg = $this->_getMessage('SPACE_AFTER_TOKEN', $text);
						$this->_writeError('checkWhiteSpaceAfter', $msg);
					}
				}
			}
		}
	}
210577
protected function onFormatText(string &$text): void
    {
        $lines = preg_split("/\r\n|\n|\r/", $text);
        $result = [];

        $lastEmptyLinesCount = 0;
        $hasFoundNonEmptyLines = false;

        foreach ($lines as $line) {
            if (($this->textFormatOptions & TextFormatOptions::TRIM) !== 0) {
                $line = trim($line);
            }
            if (($this->textFormatOptions & TextFormatOptions::COMPACT) !== 0) {
                $line = preg_replace('/\s+/', ' ', $line);
            }

            if ($line === '') {
                if (($this->textFormatOptions & TextFormatOptions::COMPACT_LINES) !== 0 && $lastEmptyLinesCount > 0) {
                    continue;
                }
                if (($this->textFormatOptions & TextFormatOptions::TRIM_LINES) !== 0 && !$hasFoundNonEmptyLines) {
                    continue;
                }

                $lastEmptyLinesCount++;
            } else {
                $lastEmptyLinesCount = 0;
                $hasFoundNonEmptyLines = true;
            }

            $result[] = $line;
        }

        if (($this->textFormatOptions & TextFormatOptions::TRIM_LINES) !== 0 && $lastEmptyLinesCount > 0) {
            // Trim the last empty lines (we did not know until now that those were at the end).
            array_splice($result, -$lastEmptyLinesCount);
        }

        $text = implode("\r\n", $result);
    }
249057
private function _checkNoWhiteSpaceBefore($text) {
		if ($this->_isActive('noSpaceBeforeToken')) {

			if (!$this->_config->isException('noSpaceBeforeToken', $text)) {

				if ($this->tokenizer->checkPreviousToken(T_WHITESPACE)) {

					// To avoid false positives when using a space indentation system,
					// check that we are on the same line as the previous valid token
					$prevValid = $this->tokenizer->peekPrvsValidToken();
					$currentToken = $this->tokenizer->getCurrentToken();
					if ($prevValid->line === $currentToken->line) {
						$msg = $this->_getMessage('NO_SPACE_BEFORE_TOKEN', $text);
						$this->_writeError('noSpaceBeforeToken', $msg);
					}
				}
			}
		}
	}
1176146
protected function parseCustomAliases($text)
	{
		if (empty($this->config['customRegexp']))
		{
			return;
		}

		$matchPos = 0;
		if (isset($this->config['customQuickMatch']))
		{
			$matchPos = strpos($text, $this->config['customQuickMatch']);
			if ($matchPos === false)
			{
				return;
			}
		}

		preg_match_all($this->config['customRegexp'], $text, $matches, PREG_OFFSET_CAPTURE, $matchPos);
		foreach ($matches[0] as list($alias, $tagPos))
		{
			if (isset($this->parser->registeredVars['Emoji.aliases'][$alias]))
			{
				$hex = $this->getHexSequence($this->parser->registeredVars['Emoji.aliases'][$alias]);
				$this->addTag($tagPos, strlen($alias), $hex);
			}
		}
	}
1192910
public function iWaitUntilISeeText($text){
        $page = $this->getSession()->getPage();
        $session = $this->getSession();
        $this->spin(function($page) use ($page, $session, $text) {
            $element = $page->find(
                'xpath',
                $session->getSelectorsHandler()->selectorToXpath("xpath", ".//*[contains(text(), '$text')]")
            );

            if(empty($element)) {
                return false;
            } else {
                return ($element->isVisible());
            }
        });
    }
637672
public function iShouldSee($text)
    {
        if (false === strpos($this->output . $this->errorOutput, $text)) {
            throw new \Exception(sprintf('Could not find %s in the console output', $text));
        }
    }