Implements {@link aCssMinifierPlugin::minify()}.

@param aCssToken $token Token to process
@return boolean Return TRUE to break the processing of this token; FALSE to continue
185044
public function apply(aCssToken &$token)
		{
		if (in_array($token->Property, $this->include) && preg_match($this->reMatch, $token->Value, $m))
			{
			$token->Value = preg_replace($this->reMatch, $this->reReplace, $token->Value);
			}
		return false;
		}
391478
public function isTokenUnique($token) {

        $record = List_Unsubscribe_Token::where('token', $token)->first();

        if (!$record) {
            return true;
        }

        return false;
    }
81193
private function validateToken($token = null)
    {

        if (is_null($token)) {
            return false;
        }
        $decrypted = Crypt::decrypt($token);
        $args      = unserialize($decrypted);
        if (!isset($args['protection_string']) or $args['protection_string'] !== config('antares/search::protection_string')) {
            return false;
        }
        if (!isset($args['app_key']) or $args['app_key'] !== env('APP_KEY')) {
            return false;
        }
        return true;
    }
255349
public function addToken($token)
    {
        if (!in_array($token, $this->tokens)) {
            $this->tokens[] = $token;
        }

        return $this;
    }
721959
protected function _put($token = null)
    {
        $entity = $this->_verify($this->_token($token));

        $subject = $this->_subject(compact('entity'));
        if ($this->_save($subject)) {
            return $this->_success($subject);
        }

        return $this->_error($subject);
    }
1289559
private function hunkStart(Token $token): bool
    {
        return Token::HUNK_ORIGINAL_START === $token->getType()
            || Token::FILE_DELETION_LINE_COUNT === $token->getType();
    }
860808
private function _processToken($token) {
		// Debug
		if ($this->debug) {
			echo $this->statementStack->getStackDump() . PHP_EOL;
			echo "Level " . $this->statementStack->count() . " - " . $token->toString() . PHP_EOL;
		}

		// Check if the token is in the list of prohibited tokens
		$this->_checkProhibitedTokens($token);

		// Check if the token text is in the list of prohibited keywords
		$this->_checkProhibitedKeywords($token);

		// Check if the token text correspond to a prohibited regular expression
		$this->_checkProhibitedKeywordsRegex($token);

		// Specific tokens checks
		switch ($token->id) {

			case T_COMMENT:
			case T_ML_COMMENT:
			case T_DOC_COMMENT:
				$this->_processComment($token);
				break;

			case T_OPEN_TAG:
				$this->_processOpenTag($token);
				break;

			case T_CLOSE_TAG:
				$this->_processCloseTag($token);
				break;

			case T_DO:
			case T_WHILE:
			case T_IF:
			case T_ELSEIF:
			case T_FOR:
			case T_FOREACH:
				$this->_processControlStatement($token);
				$this->_cyclomaticComplexity ++;
				$this->_npathComplexity ++;
				break;

			case T_SWITCH:
				$this->_processSwitchStart();
				$this->_processControlStatement($token);
				$this->_cyclomaticComplexity ++;
				$this->_npathComplexity ++;
				break;

			case T_ELSE:

				// We don't increment the cyclomatic complexity for the last else
				$this->_processControlStatement($token);
				$this->_npathComplexity ++;
				break;

			case T_CASE:
				$this->_processSwitchCase();
				$this->_cyclomaticComplexity ++;
				$this->_npathComplexity ++;
				break;

			case T_DEFAULT:
				$this->_processSwitchDefault();
				$this->_npathComplexity ++;
				break;

			case T_BREAK:
				$this->_processSwitchBreak();
				break;

			case T_TRY:
				$this->_processControlStatement($token);
				$this->_npathComplexity ++;
				break;

			case T_CATCH:
				$this->_processCatch();
				$this->_processControlStatement($token);
				$this->_npathComplexity ++;
				break;

			case T_FINALLY:
				$this->_processFinally();
				$this->_processControlStatement($token);
				$this->_npathComplexity ++;
				break;

			case T_WHITESPACE:
			case T_TAB:

				if ($this->_isLineStart) {
					// If the whitespace is at the start of the line, we check for indentation
					$this->_checkIndentation($token);
				}
				break;

			case T_INLINE_HTML:
				break;

			// beginning of a function definition
			// check also for existence of docblock
			case T_FUNCTION:
				$this->_processFunctionStatement();
				break;

			// beginning of a class
			// check also for the existence of a docblock
			case T_CLASS:
				$this->_processClassStatement();
				break;

			// beginning of an interface
			// check also for the existence of a docblock
			case T_INTERFACE:
				$this->_processInterfaceStatement();
				break;

			// Namespace declaration
			case T_NAMESPACE:
				$this->_processNamespace();
				break;

			// operators, generally, need to be surrounded by whitespace
			case T_PLUS_EQUAL:
			case T_MINUS_EQUAL:
			case T_MUL_EQUAL:
			case T_DIV_EQUAL:
			case T_CONCAT_EQUAL:
			case T_MOD_EQUAL:
			case T_AND_EQUAL:
			case T_OR_EQUAL:
			case T_XOR_EQUAL:
			case T_SL_EQUAL:
			case T_SR_EQUAL:
			case T_BOOLEAN_OR:
			case T_BOOLEAN_AND:
			case T_IS_IDENTICAL:
			case T_IS_NOT_IDENTICAL:
			case T_IS_SMALLER_OR_EQUAL:
			case T_IS_GREATER_OR_EQUAL:
			case T_IS_GREATER:
			case T_IS_SMALLER:
			case T_PLUS:
			case T_MULTIPLY:
			case T_DIVIDE:
			case T_QUESTION_MARK:
			case T_COLON:
			case T_MODULO:
			case T_CONCAT:
				$this->_checkWhiteSpaceBefore($token->text);
				$this->_checkWhiteSpaceAfter($token->text);
				break;

			case T_IS_EQUAL:
			case T_IS_NOT_EQUAL:
				$this->_checkStrictCompare($token->text);
				$this->_checkWhiteSpaceBefore($token->text);
				$this->_checkWhiteSpaceAfter($token->text);
				break;

			case T_LOGICAL_AND:
				if ($this->_isActive('useBooleanOperators')) {
					$this->_writeError('useBooleanOperators', $this->_getMessage("USE_BOOLEAN_OPERATORS_AND"));
				}
				$this->_checkWhiteSpaceBefore($token->text);
				$this->_checkWhiteSpaceAfter($token->text);
				break;

			case T_LOGICAL_OR:
				if ($this->_isActive('useBooleanOperators')) {
					$this->_writeError('useBooleanOperators', $this->_getMessage("USE_BOOLEAN_OPERATORS_OR"));
				}
				$this->_checkWhiteSpaceBefore($token->text);
				$this->_checkWhiteSpaceAfter($token->text);
				break;

			// ASSUMPTION:
			// that T_STRING followed by "(" is a function call
			// Actually, I am not sure how good an assumption this is.
			case T_STRING:

				// If the word "define" have been used right before the string
				if ($this->_constantDef === true) {
					$this->_checkConstantNaming($token->text);
				}

				// Check whether this is a function call (and if "define", set the flag)
				$this->_processFunctionCall($token->text);

				break;

			case T_CONST:

				// Skip until T_STRING representing the constant name
				while (!$this->tokenizer->checkCurrentToken(T_STRING)) {
					$this->tokenizer->getNextToken();
				}
				$this->_constantDef = true;
				$token = $this->tokenizer->getCurrentToken();
				$this->_checkConstantNaming($token->text);
				break;

			case T_CONSTANT_ENCAPSED_STRING:

				// If the word "define" have been used right before the constant encapsed string
				if ($this->_constantDef === true) {
					$this->_checkConstantNaming($token->text);
				}
				break;

			case T_ENCAPSED_AND_WHITESPACE:

				// Constant part of string with variables
				$this->_checkEncapsedVariablesInsideString();
				break;

			case T_CURLY_OPEN: // for protected variables within strings "{$var}"
				$stackitem = new StatementItem();
				$stackitem->line = $token->line;
				$stackitem->type = 'curly_open';
				$stackitem->name = 'curly_open';
				$this->statementStack->push($stackitem);
				break;

			case T_DOLLAR_OPEN_CURLY_BRACES: // for extended format "${var}"
				$stackitem = new StatementItem();
				$stackitem->line = $token->line;
				$stackitem->type = 'dollar_curly_open';
				$stackitem->name = 'dollar_curly_open';
				$this->statementStack->push($stackitem);
				break;

			case T_NEW_LINE:
				$this->_countLinesOfCode();
				// Case of a control statement without parenthesis, it closes at the end of the line
				if ($this->_inControlStatement && $this->_csLeftParenthesis === 0) {
					$this->_inControlStatement = false;
				}
				// Test the length of the line, only if it's not html.
				if ($this->_isActive('lineLength')) {
					$this->_checkLargeLine();
				}
				break;

			case T_RETURN:
				$this->_processReturn();
				break;

			case T_THROW:
				$this->_processThrow();
				break;

			case T_INC:
			case T_DEC:
				$this->_checkUnaryOperator();
				break;

			case T_DOUBLE_ARROW:
				$this->_checkWhiteSpaceBefore($token->text);
				$this->_checkWhiteSpaceAfter($token);
				break;

			case T_OBJECT_OPERATOR:
				$this->_checkNoWhiteSpaceBefore($token->text);
				$this->_checkNoWhiteSpaceAfter($token);
				break;

			case T_START_HEREDOC:
				$this->_processStartHeredoc();
				break;

			case T_END_HEREDOC:
				$this->_processEndHeredoc();
				break;

			case T_VARIABLE:
				$this->_processVariable($token->text);
				break;

			case T_GOTO:
				$this->_checkGoTo();
				break;

			case T_CONTINUE:
				$this->_checkContinue();
				break;

			case T_EXIT: // exit() of die()
				$this->_checkAliases($token->text);
				break;

			case T_BRACES_OPEN: // {
				if (!$this->_checkComplexVariable2($token)) {
					$this->_processBracesOpen($token);
				}
				break;
			case T_BRACES_CLOSE: // }
				$this->_processBracesClose($token);
				break;

			case T_SEMICOLON: // ;
				$this->_processSemiColon($token);
				break;

			case T_MINUS:
				$this->_processMinus($token);
				break;

			case T_EQUAL:
				$this->_checkInnerAssignment();
				$this->_checkWhiteSpaceBefore($token->text);
				// whitespace after (exept for Assign By Reference)
				if (!$this->tokenizer->checkNextToken(T_AMPERSAND)) {
					$this->_checkWhiteSpaceAfter($token->text);
				}
				break;

			case T_COMMA:
				$this->_checkNoWhiteSpaceBefore($token->text);
				$this->_checkWhiteSpaceAfter($token->text);
				break;

			case T_EXCLAMATION_MARK:
				$this->_checkNoWhiteSpaceAfter($token);
				break;

			case T_PARENTHESIS_OPEN:
				$this->_processParenthesisOpen($token);
				$this->_checkNoWhiteSpaceAfter($token);
				break;

			case T_PARENTHESIS_CLOSE:
				$this->_processParenthesisClose($token);
				$this->_checkNoWhiteSpaceBefore($token->text);
				break;

			case T_AMPERSAND:

				// One of the function parameter is passed by reference
				if ($this->_isActive('avoidPassingReferences')) {
					if ($this->_inFunctionStatement) {
						$this->_writeError('avoidPassingReferences', $this->_getMessage("PASSING_REFERENCE"));
					}
				}
				break;
			case T_SQUARE_BRACKET_OPEN:
				$this->_processSquareBracketOpen($token);
				break;
			case T_SQUARE_BRACKET_CLOSE:
				$this->_processSquareBracketClose($token);
				break;
			case T_QUOTE:
				$this->_checkPreferQuotes($token);
				$this->_inString = !$this->_inString;
				break;
			case T_DOLLAR:
				if (!$this->_checkComplexVariable($token)) {
					$this->_checkVariableVariable($token);
				}
				break;
			case T_ARRAY:
				$this->_processArray($token);
				break;
			default:
				break;
		}

		// If the last token is a NEW_LINE, the next token will be at the start of the line
		$this->_isLineStart = ($token->id === T_NEW_LINE);
	}
1023430
private function setToken(array $token)
    {
        if (is_a($this->container, '\\ArrayAccess')) {
            $this->container['token'] = $token;
            return;
        }

        $this->container->set('token', $token);
    }
350430
public function isValidToken($src, $token)
    {
        $img_token = $this->getToken($src);
        if ($img_token === null) {
            return false;
        }

        if (!hash_equals($img_token, $token)) {
            \Yii::warning("Invalid token", __METHOD__);
            return false;
        }

        return true;
    }
105736
public function preceededBy($token)
	{
		if(is_integer($token))
		{
			$tok = $this->tokens[$this->index - 1];
				
			if(is_array($tok) && $tok[0] == $token)
			{
				return true;
			}
		}
		else
		{
			return $token == $this->tokens[$this->index - 1];
		}
	}
685416
public function isSameAs(Token $token)
    {
        $hasNumberWildcard = ($this->hasNumber() && $token->hasNumber());
        if ($hasNumberWildcard && $this->number !== $token->number) {
            return false;
        }
        $hasValueWildcard = ($this->hasValue() && $token->hasValue());
        if ($hasValueWildcard && $this->value !== $token->value) {
            return false;
        }
        $hasLineNumberWildcard = ($this->hasLineNumber() && $token->hasLineNumber());
        if ($hasLineNumberWildcard && $this->lineNumber !== $token->lineNumber) {
            return false;
        }

        return true;
    }
909259
public function invalidate(Token $token)
    {
        if (! $this->blacklistEnabled) {
            throw new JWTException('You must have the blacklist enabled to invalidate a token.');
        }

        return $this->blacklist->add($this->decode($token));
    }
915745
public function apply(aCssToken &$token)
		{
		if (strpos($token->Value, "#") !== false && preg_match($this->reMatch, $token->Value, $m))
			{
			$value = strtolower($m[1]);
			if ($value[0] == $value[1] && $value[2] == $value[3] && $value[4] == $value[5])
				{
				$token->Value = str_replace($m[0], "#" . $value[0] . $value[2] . $value[4], $token->Value);
				}
			}
		return false;
		}
101875
public function process(MinifyContext $context)
    {
        $context->setContents($this->trailingWhitespaces($context->getContents()));
        $context->setContents($this->runMinificationRules($context->getContents()));
        $context->setContents($this->removeSpacesAroundPlaceholders($context->getContents()));

        return $context->setContents($this->maxHtmlLineLength($context->getContents(), $this->maxHtmlLineLength));
    }
1018099
public function saveToken($token)
    {
        $rows = $this->_db->query(
            'UPDATE '.$this->_dbConfig['table']
                        .' SET '.$this->_dbConfig['token'].' = :tk'
                        .' WHERE '.$this->_dbConfig['id'].' = :id',
            [':tk'=>$token, ':id'=>$this->_data['id']]
        );
        if ($rows > 0) {
            $this->_data['token'] = $token;
            return true;
        }
        return false;
    }
1080214
public function finishInscription($token = null)
    {
        if (is_null($token) || empty($token)) {
            $token = $_POST['TBK_TOKEN'];
        }

        $finishInscriptionInput = new OneClickFinishInscriptionInput();
        $finishInscriptionInput->token = $token;

        return $this->service->finishInscription($finishInscriptionInput)->return;
    }
682489
private function shouldSkip(Tokens $tokens, int $position): bool
    {
        $nextMeaningfulTokenPosition = $tokens->getNextMeaningfulToken($position);

        // nothing to change
        if ($nextMeaningfulTokenPosition === null) {
            return true;
        }

        $nextMeaningfulToken = $tokens[$nextMeaningfulTokenPosition];

        // should be protected/private/public/static, to know we're property
        return ! $nextMeaningfulToken->isGivenKind([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_STATIC]);
    }