private function _processVariable($text) {
		// Check the variable naming convention
		if (!in_array($text, $this->_systemVariables)) {
			$this->_checkVariableNaming($text);
		}

		// Check the variable name's length
		$this->_checkVariableNameLength($text);

		// Check if the variable is not a deprecated system variable
		$this->_checkDeprecation($text);

		// Check if the variable is not replaced
		$this->_checkReplacements($text);

		// Check if the variable is a function parameter
		if (!empty($this->_functionParameters[$text]) && $this->_inFunction) {

			$this->_functionParameters[$text] = "used";
		} else if (!$this->_inFunctionStatement) {

			// Global variable
			$pos = $this->tokenizer->getCurrentPosition();
			$nextTokenInfo = $this->tokenizer->peekNextValidToken($pos + 1);

			// if the next token is an equal, we suppose that this is an affectation
			$nextTokenText = $nextTokenInfo->text;
			$affectionTokens = array(
				'=',
				'+=',
				'*=',
				'/=',
				'-=',
				'%=',
				'&=',
				'|=',
				'^=',
				'<<=',
				'>>=',
				'.='
			);
			$isAffectation = in_array($nextTokenText, $affectionTokens);

			// Check if the variable has already been met
			if (empty($this->_variables[$text]) && !in_array($text, $this->_systemVariables)) {
				// The variable is met for the first time
				$variable = new VariableInfo();
				$variable->name = $text;
				$variable->line = $this->lineNumber; // We store the first declaration of the variable
				$this->_variables[$text] = $variable;
			} else if ($isAffectation) {
				// The variable is reaffected another value, this doesn't count as a valid use.
			} else {

				// Manage the case of $this->attribute
				if ($text === '$this') {

					$nextTokenInfo2 = $this->tokenizer->peekNextValidToken($nextTokenInfo->position);

					if ($this->tokenizer->checkToken($nextTokenInfo2, T_OBJECT_OPERATOR)) {

						// Detect $this inside a static function.
						if ($this->_functionStatic) {
							if ($this->_isActive('thisInStatic')) {
								$this->_writeError('thisInStatic', $this->_getMessage('THIS_IN_STATIC_FUNCTION'));
							}
						}

						$nextTokenInfo3 = $this->tokenizer->peekNextValidToken($nextTokenInfo2->position + 1);

						// This does not look like a function call, it should be a class attribute.
						// We eliminate the $this-> part
						$text = '$' . $nextTokenInfo3->text;
					}
				}

				// The variable is met again, we suppose we have used it for something
				if (!empty($this->_variables[$text])) {
					$variable = $this->_variables[$text];
					$variable->isUsed = true;
					$this->_variables[$text] = $variable;
				}
			}
		}
	}
private function _processVariable($text) {
		// Check the variable naming convention
		if (!in_array($text, $this->_systemVariables)) {
			$this->_checkVariableNaming($text);
		}

		// Check the variable name's length
		$this->_checkVariableNameLength($text);

		// Check if the variable is not a deprecated system variable
		$this->_checkDeprecation($text);

		// Check if the variable is not replaced
		$this->_checkReplacements($text);

		// Check if the variable is a function parameter
		if (!empty($this->_functionParameters[$text]) && $this->_inFunction) {

			$this->_functionParameters[$text] = "used";
		} else if (!$this->_inFunctionStatement) {

			// Global variable
			$pos = $this->tokenizer->getCurrentPosition();
			$nextTokenInfo = $this->tokenizer->peekNextValidToken($pos + 1);

			// if the next token is an equal, we suppose that this is an affectation
			$nextTokenText = $nextTokenInfo->text;
			$affectionTokens = array(
				'=',
				'+=',
				'*=',
				'/=',
				'-=',
				'%=',
				'&=',
				'|=',
				'^=',
				'<<=',
				'>>=',
				'.='
			);
			$isAffectation = in_array($nextTokenText, $affectionTokens);

			// Check if the variable has already been met
			if (empty($this->_variables[$text]) && !in_array($text, $this->_systemVariables)) {
				// The variable is met for the first time
				$variable = new VariableInfo();
				$variable->name = $text;
				$variable->line = $this->lineNumber; // We store the first declaration of the variable
				$this->_variables[$text] = $variable;
			} else if ($isAffectation) {
				// The variable is reaffected another value, this doesn't count as a valid use.
			} else {

				// Manage the case of $this->attribute
				if ($text === '$this') {

					$nextTokenInfo2 = $this->tokenizer->peekNextValidToken($nextTokenInfo->position);

					if ($this->tokenizer->checkToken($nextTokenInfo2, T_OBJECT_OPERATOR)) {

						// Detect $this inside a static function.
						if ($this->_functionStatic) {
							if ($this->_isActive('thisInStatic')) {
								$this->_writeError('thisInStatic', $this->_getMessage('THIS_IN_STATIC_FUNCTION'));
							}
						}

						$nextTokenInfo3 = $this->tokenizer->peekNextValidToken($nextTokenInfo2->position + 1);

						// This does not look like a function call, it should be a class attribute.
						// We eliminate the $this-> part
						$text = '$' . $nextTokenInfo3->text;
					}
				}

				// The variable is met again, we suppose we have used it for something
				if (!empty($this->_variables[$text])) {
					$variable = $this->_variables[$text];
					$variable->isUsed = true;
					$this->_variables[$text] = $variable;
				}
			}
		}
	}
private function _processVariable ( $ text ) { // Check the variable naming convention if ( ! in_array ( $ text , $ this -> _systemVariables ) ) { $ this -> _checkVariableNaming ( $ text ) ; } // Check the variable name's length $ this -> _checkVariableNameLength ( $ text ) ; // Check if the variable is not a deprecated system variable $ this -> _checkDeprecation ( $ text ) ; // Check if the variable is not replaced $ this -> _checkReplacements ( $ text ) ; // Check if the variable is a function parameter if ( ! empty ( $ this -> _functionParameters [ $ text ] ) && $ this -> _inFunction ) { $ this -> _functionParameters [ $ text ] = "used" ; } else if ( ! $ this -> _inFunctionStatement ) { // Global variable $ pos = $ this -> tokenizer -> getCurrentPosition ( ) ; $ nextTokenInfo = $ this -> tokenizer -> peekNextValidToken ( $ pos + 1 ) ; // if the next token is an equal, we suppose that this is an affectation $ nextTokenText = $ nextTokenInfo -> text ; $ affectionTokens = array ( '=' , '+=' , '*=' , '/=' , '-=' , '%=' , '&=' , '|=' , '^=' , '<<=' , '>>=' , '.=' ) ; $ isAffectation = in_array ( $ nextTokenText , $ affectionTokens ) ; // Check if the variable has already been met if ( empty ( $ this -> _variables [ $ text ] ) && ! in_array ( $ text , $ this -> _systemVariables ) ) { // The variable is met for the first time $ variable = new VariableInfo ( ) ; $ variable -> name = $ text ; $ variable -> line = $ this -> lineNumber ; // We store the first declaration of the variable $ this -> _variables [ $ text ] = $ variable ; } else if ( $ isAffectation ) { // The variable is reaffected another value, this doesn't count as a valid use. } else { // Manage the case of $this->attribute if ( $ text === '$this' ) { $ nextTokenInfo2 = $ this -> tokenizer -> peekNextValidToken ( $ nextTokenInfo -> position ) ; if ( $ this -> tokenizer -> checkToken ( $ nextTokenInfo2 , T_OBJECT_OPERATOR ) ) { // Detect $this inside a static function. if ( $ this -> _functionStatic ) { if ( $ this -> _isActive ( 'thisInStatic' ) ) { $ this -> _writeError ( 'thisInStatic' , $ this -> _getMessage ( 'THIS_IN_STATIC_FUNCTION' ) ) ; } } $ nextTokenInfo3 = $ this -> tokenizer -> peekNextValidToken ( $ nextTokenInfo2 -> position + 1 ) ; // This does not look like a function call, it should be a class attribute. // We eliminate the $this-> part $ text = '$' . $ nextTokenInfo3 -> text ; } } // The variable is met again, we suppose we have used it for something if ( ! empty ( $ this -> _variables [ $ text ] ) ) { $ variable = $ this -> _variables [ $ text ] ; $ variable -> isUsed = true ; $ this -> _variables [ $ text ] = $ variable ; } } } }
Check the variable use.

This function is launched when the current token is T_VARIABLE

@param String $text
The variable name
Check the variable use .