Processes the token.

@throws CodeError Contains the error message if there is an invalid array check.

@return void
498194
protected function processToken(): void
    {
        $this->file->recordMetric($this->getStackPos(), 'Used comparison (for array checks)', $this->token['type']);

        $nextTokenPos = TokenHelper::findNextEffective($this->getFile(), $startPos = $this->getStackPos() + 1);
        $nextToken = $this->tokens[$nextTokenPos];

        // Add in Array check
        if (array_key_exists($nextToken['code'], $this->invalidStructure)) {
            $this->checkArrayStructure($this->invalidStructure[$nextToken['code']], $nextTokenPos + 1);
        } else {
            $this->file->recordMetric(
                $startPos,
                'Invalid array comparison',
                'no'
            );
        }
    }
506201
protected function postProcessing(): void
    {
        if (isset($this->value)) {
            $this->value = array_map(function ($item) {
                if (ctype_digit($item)) {
                    return intval($item);
                } else {
                    return $item;
                }
            }, $this->value);
        }
    }
78714
public function process()
    {
        if (ini_get('display_errors')) {
            $this->display();
        }

        if (ini_get('log_errors')) {
            $this->log();
        }

        if ($this->severity & self::$fatal_severity) {
            exit(1);
        }
    }
1025905
public function process()
    {
        if (
            $this->getForm()->getHiddenField($this->id . '_submitted') === null
        ) {
            return;
        }

        parent::process();

        foreach ($this->values as $option_value) {
            $this->getEntryWidget($option_value)->process();
        }
    }
731027
public function process()
    {
        $data = &$this->getForm()->getFormData();

        if (!isset($data[$this->id])) {
            $this->value = null;
        } elseif ($data[$this->id] == '') {
            $this->value = null;
        } else {
            $this->value = $data[$this->id];
        }

        $this->values = $this->splitValues($this->value);
        $locale = SwatI18NLocale::get();

        if (!$this->required && count($this->values) === 0) {
            return;
        } elseif (
            $this->max_entries > 0 &&
            count($this->values) > $this->max_entries
        ) {
            $message = sprintf(
                Swat::_('The %%s field cannot have more than %s entries.'),
                $locale->formatNumber($this->max_entries)
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        } elseif (
            $this->required &&
            count($this->values) < $this->min_entries
        ) {
            $message = sprintf(
                Swat::ngettext(
                    'The %%s field must have at least %s entry.',
                    'The %%s field must have at least %s entries.',
                    $this->min_entries
                ),
                $locale->formatNumber($this->min_entries)
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        }

        // validate individual values

        $min_length_msg = null;
        $max_length_msg = null;
        $min_length_error_values = array();
        $max_length_error_values = array();

        foreach ($this->values as $value) {
            $len = mb_strlen($value);
            if ($this->maxlength !== null && $len > $this->maxlength) {
                $max_length_msg =
                    sprintf(
                        Swat::ngettext(
                            'Entries in the %%s field must be less than %s ' .
                                'character long.',
                            'Entries in the %%s field must be less than %s ' .
                                'characters long.',
                            $this->maxlength
                        ),
                        $locale->formatNumber($this->maxlength)
                    ) . ' ';

                $max_length_error_values[] = $value;
            } elseif ($this->minlength !== null && $len < $this->minlength) {
                $min_length_msg =
                    sprintf(
                        Swat::ngettext(
                            'Entries in the %%s field must be at least %s ' .
                                'character long.',
                            'Entries in the %%s field must be at least %s ' .
                                'characters long.',
                            $this->minlength
                        ),
                        $locale->formatNumber($this->minlength)
                    ) . ' ';

                $min_length_error_values[] = $value;
            }
        }

        if ($min_length_msg !== null) {
            $min_length_msg .= sprintf(
                Swat::ngettext(
                    'The following entry is too short: %s.',
                    'The following entries are too short: %s.',
                    count($min_length_error_values)
                ),
                implode(', ', $min_length_error_values),
                $locale->formatNumber(count($min_length_error_values))
            );

            $this->addMessage(new SwatMessage($min_length_msg, 'error'));
        }

        if ($max_length_msg !== null) {
            $max_length_msg .= sprintf(
                Swat::ngettext(
                    'The following entry is too long: %s.',
                    'The following entries are too long: %s.',
                    count($max_length_error_values)
                ),
                implode(', ', $max_length_error_values),
                $locale->formatNumber(count($max_length_error_values))
            );

            $this->addMessage(new SwatMessage($max_length_msg, 'error'));
        }
    }
274517
public function process_token( $stackPtr ) {

    $token = $this->tokens[ $stackPtr ];

    if ( preg_match( '`^do_shortcode`i', $token['content'] ) > 0 ) {
      $this->phpcsFile->addWarning( 'Do not include do_shortcode() function in theme files. Use shortcode callback function instead.', $stackPtr, 'do_shortcodeDetected' );
    }
  }
546583
public function process($tokens) {
        $prev_category = "";
        $token_category = "";
        $skip_next = 0;
        $out = false;

	// $tokens may come as a numeric indexed array starting with an index greater than 0 (or as a boolean)
	$tokenCount = count($tokens);
        if ( is_array($tokens) ){
          $tokens = array_values($tokens);
        }
        for ($tokenNumber = 0; $tokenNumber < $tokenCount; ++$tokenNumber) {

            // https://github.com/greenlion/PHP-SQL-Parser/issues/279
            // https://github.com/sinri/PHP-SQL-Parser/commit/eac592a0e19f1df6f420af3777a6d5504837faa7
            // as there is no pull request for 279 by the user. His solution works and tested.
            if (!isset($tokens[$tokenNumber])) continue;// as a fix by Sinri 20180528
            $token = $tokens[$tokenNumber];
            $trim = trim($token); // this removes also \n and \t!

            // if it starts with an "(", it should follow a SELECT
            if ($trim !== "" && $trim[0] === "(" && $token_category === "") {
                $token_category = 'BRACKET';
                $prev_category = $token_category;
            }

            /*
             * If it isn't obvious, when $skip_next is set, then we ignore the next real token, that is we ignore whitespace.
             */
            if ($skip_next > 0) {
                if ($trim === "") {
                    if ($token_category !== "") { // is this correct??
                        $out[$token_category][] = $token;
                    }
                    continue;
                }
                // to skip the token we replace it with whitespace
                $trim = "";
                $token = "";
                $skip_next--;
                if ($skip_next > 0) {
                    continue;
                }
            }

            $upper = strtoupper($trim);
            switch ($upper) {

            /* Tokens that get their own sections. These keywords have subclauses. */
            case 'SELECT':
            case 'ORDER':
            case 'VALUES':
            case 'GROUP':
            case 'HAVING':
            case 'WHERE':
            case 'CALL':
            case 'PROCEDURE':
            case 'FUNCTION':
            case 'SERVER':
            case 'LOGFILE':
            case 'DEFINER':
            case 'RETURNS':
            case 'TABLESPACE':
            case 'TRIGGER':
            case 'DO':
            case 'FLUSH':
            case 'KILL':
            case 'RESET':
            case 'STOP':
            case 'PURGE':
            case 'EXECUTE':
            case 'PREPARE':
                $token_category = $upper;
                break;

            case 'DEALLOCATE':
                if ($trim === 'DEALLOCATE') {
                    $skip_next = 1;
                }
                $token_category = $upper;
                break;

            case 'DUPLICATE':
                if ($token_category !== 'VALUES') {
                    $token_category = $upper;
                }
                break;

            case 'SET':
                if ($token_category !== 'TABLE') {
                    $token_category = $upper;
                }
                break;

            case 'LIMIT':
            case 'PLUGIN':
            // no separate section
                if ($token_category === 'SHOW') {
                    continue;
                }
                $token_category = $upper;
                break;

            case 'FROM':
            // this FROM is different from FROM in other DML (not join related)
                if ($token_category === 'PREPARE') {
                    continue 2;
                }
                // no separate section
                if ($token_category === 'SHOW') {
                    continue;
                }
                $token_category = $upper;
                break;

            case 'EXPLAIN':
            case 'DESCRIBE':
            case 'SHOW':
                $token_category = $upper;
                break;

            case 'DESC':
                if ($token_category === '') {
                    // short version of DESCRIBE
                    $token_category = $upper;
                }
                // else direction of ORDER-BY
                break;

            case 'RENAME':
                $token_category = $upper;
                break;

            case 'DATABASE':
            case 'SCHEMA':
                if ($prev_category === 'DROP') {
                    continue;
                }
                if ($prev_category === 'SHOW') {
                    continue;
                }
                $token_category = $upper;
                break;

            case 'EVENT':
            // issue 71
                if ($prev_category === 'DROP' || $prev_category === 'ALTER' || $prev_category === 'CREATE') {
                    $token_category = $upper;
                }
                break;

            case 'DATA':
            // prevent wrong handling of DATA as keyword
                if ($prev_category === 'LOAD') {
                    $token_category = $upper;
                }
                break;

            case 'INTO':
            // prevent wrong handling of CACHE within LOAD INDEX INTO CACHE...
                if ($prev_category === 'LOAD') {
                    $out[$prev_category][] = $trim;
                    continue 2;
                }
                $token_category = $prev_category = $upper;
                break;

            case 'USER':
            // prevent wrong processing as keyword
                if ($prev_category === 'CREATE' || $prev_category === 'RENAME' || $prev_category === 'DROP') {
                    $token_category = $upper;
                }
                break;

            case 'VIEW':
            // prevent wrong processing as keyword
                if ($prev_category === 'CREATE' || $prev_category === 'ALTER' || $prev_category === 'DROP') {
                    $token_category = $upper;
                }
                break;

            /*
             * These tokens get their own section, but have no subclauses. These tokens identify the statement but have no specific subclauses of their own.
             */
            case 'DELETE':
            case 'ALTER':
            case 'INSERT':
            case 'TRUNCATE':
            case 'OPTIMIZE':
            case 'GRANT':
            case 'REVOKE':
            case 'HANDLER':
            case 'LOAD':
            case 'ROLLBACK':
            case 'SAVEPOINT':
            case 'UNLOCK':
            case 'INSTALL':
            case 'UNINSTALL':
            case 'ANALZYE':
            case 'BACKUP':
            case 'CHECKSUM':
            case 'REPAIR':
            case 'RESTORE':
            case 'HELP':
                $token_category = $upper;
                // set the category in case these get subclauses in a future version of MySQL
                $out[$upper][0] = $trim;
                continue 2;

            case 'REPLACE':
            	if ($prev_category === '') {
            		// set the category in case these get subclauses in a future version of MySQL
            		$token_category = $upper;
            		$out[$upper][0] = $trim;
            		continue 2;
            	}
                // part of the CREATE TABLE statement or a function
                $out[$prev_category][] = $trim;
                continue 2;

            case 'IGNORE':
                if ($prev_category === 'TABLE') {
                    // part of the CREATE TABLE statement
                    $out[$prev_category][] = $trim;
                    continue 2;
                }
                if ($token_category === 'FROM') {
                    // part of the FROM statement (index hint)
                    $out[$token_category][] = $trim;
                    continue 2;
                }
                $out['OPTIONS'][] = $upper;
                continue 2;

            case 'CHECK':
                if ($prev_category === 'TABLE') {
                    $out[$prev_category][] = $trim;
                    continue 2;
                }
                $token_category = $upper;
                $out[$upper][0] = $trim;
                continue 2;

            case 'CREATE':
                if ($prev_category === 'SHOW') {
                    continue;
                }
                $token_category = $upper;
                break;

            case 'INDEX':
	            if ( in_array( $prev_category, array( 'CREATE', 'DROP' ) ) ) {
		            $out[ $prev_category ][] = $trim;
		            $token_category          = $upper;
	            }
	            break;

            case 'TABLE':
                if ($prev_category === 'CREATE') {
                    $out[$prev_category][] = $trim;
                    $token_category = $upper;
                }
                if ($prev_category === 'TRUNCATE') {
                    $out[$prev_category][] = $trim;
                    $token_category = $upper;
                }
                break;

            case 'TEMPORARY':
                if ($prev_category === 'CREATE') {
                    $out[$prev_category][] = $trim;
                    $token_category = $prev_category;
                    continue 2;
                }
                break;

            case 'IF':
                if ($prev_category === 'TABLE') {
                    $token_category = 'CREATE';
                    $out[$token_category] = array_merge($out[$token_category], $out[$prev_category]);
                    $out[$prev_category] = array();
                    $out[$token_category][] = $trim;
                    $prev_category = $token_category;
                    continue 2;
                }
                break;

            case 'NOT':
                if ($prev_category === 'CREATE') {
                    $token_category = $prev_category;
                    $out[$prev_category][] = $trim;
                    continue 2;
                }
                break;

            case 'EXISTS':
                if ($prev_category === 'CREATE') {
                    $out[$prev_category][] = $trim;
                    $prev_category = $token_category = 'TABLE';
                    continue 2;
                }
                break;

            case 'CACHE':
                if ($prev_category === "" || $prev_category === 'RESET' || $prev_category === 'FLUSH'
                    || $prev_category === 'LOAD') {
                    $token_category = $upper;
                    continue 2;
                }
                break;

            /* This is either LOCK TABLES or SELECT ... LOCK IN SHARE MODE */
            case 'LOCK':
                if ($token_category === "") {
                    $token_category = $upper;
                    $out[$upper][0] = $trim;
                } elseif ($token_category === 'INDEX') {
                    break;
                } else {
                    $trim = 'LOCK IN SHARE MODE';
                    $skip_next = 3;
                    $out['OPTIONS'][] = $trim;
                }
                continue 2;

            case 'USING': /* USING in FROM clause is different from USING w/ prepared statement*/
                if ($token_category === 'EXECUTE') {
                    $token_category = $upper;
                    continue 2;
                }
                if ($token_category === 'FROM' && !empty($out['DELETE'])) {
                    $token_category = $upper;
                    continue 2;
                }
                break;

            /* DROP TABLE is different from ALTER TABLE DROP ... */
            case 'DROP':
                if ($token_category !== 'ALTER') {
                    $token_category = $upper;
                    continue 2;
                }
                break;

            case 'FOR':
                if ($prev_category === 'SHOW') {
                    continue;
                }
                $skip_next = 1;
                $out['OPTIONS'][] = 'FOR UPDATE'; // TODO: this could be generate problems within the position calculator
                continue 2;

            case 'UPDATE':
                if ($token_category === "") {
                    $token_category = $upper;
                    continue 2;
                }
                if ($token_category === 'DUPLICATE') {
                    continue 2;
                }
                break;

            case 'START':
                $trim = "BEGIN";
                $out[$upper][0] = $upper; // TODO: this could be generate problems within the position calculator
                $skip_next = 1;
                break;

            // This token is ignored, except within RENAME
            case 'TO':
                if ($token_category === 'RENAME') {
                    break;
                }
                continue 2;

            // This token is ignored, except within CREATE TABLE
            case 'BY':
                if ($prev_category === 'TABLE') {
                    break;
                }
                continue 2;

            // These tokens are ignored.
            case 'ALL':
            case 'SHARE':
            case 'MODE':
            case ';':
                continue 2;

            case 'KEY':
                if ($token_category === 'DUPLICATE') {
                    continue 2;
                }
                break;

            /* These tokens set particular options for the statement. */
            case 'LOW_PRIORITY':
            case 'DELAYED':
            case 'QUICK':
            case 'HIGH_PRIORITY':
                $out['OPTIONS'][] = $trim;
                continue 2;

            case 'USE':
                if ($token_category === 'FROM') {
                    // index hint within FROM clause
                    $out[$token_category][] = $trim;
                    continue 2;
                }
                // set the category in case these get subclauses in a future version of MySQL
                $token_category = $upper;
                $out[$upper][0] = $trim;
                continue 2;

            case 'FORCE':
                if ($token_category === 'FROM') {
                    // index hint within FROM clause
                    $out[$token_category][] = $trim;
                    continue 2;
                }
                $out['OPTIONS'][] = $trim;
                continue 2;

            case 'WITH':
                if ($token_category === 'GROUP') {
                    $skip_next = 1;
                    $out['OPTIONS'][] = 'WITH ROLLUP'; // TODO: this could be generate problems within the position calculator
                    continue 2;
                }
                if ($token_category === '') {
                	$token_category = $upper;
                }
                break;

            case 'AS':
                break;

            case '':
            case ',':
            case ';':
                break;

            default:
                break;
            }

            // remove obsolete category after union (empty category because of
            // empty token before select)
            if ($token_category !== "" && ($prev_category === $token_category)) {
                $out[$token_category][] = $token;
            }

            $prev_category = $token_category;
        }

        return parent::process($out);
    }
344162
public function process()
	{
		$view = $this->getView();
		$context = $this->getContext();
		$ids = (array) $view->param( 'fav_id', [] );

		try
		{
			if( $context->getUserId() != null && !empty( $ids ) )
			{
				switch( $view->param( 'fav_action' ) )
				{
					case 'add':
						$this->addFavorites( $ids ); break;
					case 'delete':
						$this->deleteFavorites( $ids ); break;
				}
			}

			parent::process();
		}
		catch( \Aimeos\MShop\Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$view->favoriteErrorList = $view->get( 'favoriteErrorList', [] ) + $error;
		}
		catch( \Aimeos\Controller\Frontend\Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
			$view->favoriteErrorList = $view->get( 'favoriteErrorList', [] ) + $error;
		}
		catch( \Aimeos\Client\Html\Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
			$view->favoriteErrorList = $view->get( 'favoriteErrorList', [] ) + $error;
		}
		catch( \Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
			$view->favoriteErrorList = $view->get( 'favoriteErrorList', [] ) + $error;
			$this->logException( $e );
		}
	}
1025284
public function process() : void
    {
        if (isset($this->output)) {
            $this->output->call($this);
        } elseif (!$this->delegated) {
            self::$inout->error("Recipe is missing a call to `output` and did not delegate anything, not very useful probably...\n");
        }
    }
605590
private function checkAndRegisterSortingError(): void
    {
        $orgTokens = $this->getTagTokens();
        $sortedTokens = $this->sortTokens($orgTokens);

        if (array_values($orgTokens) !== $sortedTokens) {
            $error = (new CodeWarning(
                static::CODE_WRONG_TAG_SORTING,
                self::MESSAGE_WRONG_TAG_SORTING,
                array_shift($orgTokens)['pointer']
            ))->setToken($this->token);

            $error->isFixable(true);

            throw $error;
        }
    }
527923
protected function doProcess()
    {
        if ($this->getValue()) {
            $this->metas->add($this->toArray(), $this->getPosition());
            return true;
        }
        return false;
    }
725221
protected function process()
    {

        // load email and website code
        $email = $this->getValue(ColumnKeys::EMAIL);
        $website = $this->getValue(ColumnKeys::WEBSITE);

        // add the customer identifier => entity ID mapping
        $this->addCustomerIdentifierEntityIdMapping($email, $website);

        // clean-up the repositories etc. to free memory
        $this->getCustomerBunchProcessor()->cleanUp();

        // temporary persist the last customer identifier
        $this->setLastIdentifier(array($email, $website));
    }
1209001
public function process()
    {
        $this->debug->groupCollapsed(__METHOD__);
        if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'HEAD') {
            $this->debug->warn('head request - do not process form');
            $this->debug->groupEnd();
            return;
        }
        $this->alerts->clear();
        $this->configNormalize();
        $this->initPersist();
        $this->status['submitted'] = $this->persist->get('submitted');
        $this->storeValues();
        $this->redirectPost();
        $this->setCurrentFields();
        // $this->debug->log('persist', $this->persist);
        // $this->debug->log('status', $this->status);
        $headers = $this->getHeaders();
        $this->processSubmit();
        $this->trashCollect();
        if (!\headers_sent()) {
            $this->debug->log('headers', $headers);
            foreach ($headers as $header) {
                \header($header);
            }
        }
        $this->persist->set('submitted', false);
        $this->debug->groupEnd();
        return;
    }
852107
protected function processToken(): void
    {
        // "Sniff" the var name only once, but register the possible error everytime the var is declared.
        if (!$this->sniffedVars[$var = $this->token['content']]) {
            $this->file->recordMetric($this->stackPos, 'CamelCase var name', 'no');

            if (!$this->isSniffSuppressed(static::CODE_NOT_CAMEL_CASE)) {
                $this->file->addError(
                    self::MESSAGE_NOT_CAMEL_CASE,
                    $this->stackPos,
                    static::CODE_NOT_CAMEL_CASE,
                    [
                        $var
                    ]
                );
            }
        } else {
            $this->file->recordMetric($this->stackPos, 'CamelCase var name', 'yes');
        }
    }
1166875
public function process ()
    {
        if ($this->isProcessed)
            return;
        $this->isProcessed = true;
        foreach ($this->getFields() as $field)
            /* @var $field Field */
            $field->preprocess();
        $this->isUserSubmitted = $this->getValue($this->getSubmitConfirmFieldName(), 'false') == 'true' || $this->forceSubmit;
        if ($this->isUserSubmitted) {
            foreach ($this->getFields() as $field)
                $field->restoreValue($this->method);

            $this->activateHandlers();

            if ($this->isValid()) {
                $this->submit();
            }
        }
    }
606319
protected function processToken(): void
    {
        $prevStatement = null;

        foreach ($this->useStatements as $useStatement) {
            if ($prevStatement && ($this->compareUseStatements($prevStatement, $useStatement) > 0)) {
                $exception = new CodeError(
                    static::CODE_INCORRECT_ORDER,
                    'Use statements should be sorted alphabetically. The first wrong one is %s.',
                    $useStatement->getPointer()
                );

                $exception
                    ->setPayload([$useStatement->getFullyQualifiedTypeName()])
                    ->isFixable(true);

                throw $exception;
            }

            $prevStatement = $useStatement;
        }
    }
1369368
public function process()
    {

        // load all available categories
        $categories = $this->getImportProcessor()->getCategories();

        // update the categories children count
        foreach ($categories as $category) {
            // load the category itself
            $this->category = $this->loadCategory($pk = $this->getPrimaryKey($category));

            // update the category's children count
            $this->persistCategory($this->initializeCategory($this->prepareAttributes()));

            // write a log message
            $this->getSystemLogger()->debug(
                sprintf('Successfully updated category with primary key %d', $pk)
            );
        }
    }