protected function check_text( $context ) {
		$stack_ptr = $context['stack_ptr'];
		$arg_name  = $context['arg_name'];
		$content   = $context['tokens'][0]['content'];
		$is_error  = empty( $context['warning'] );

		// UnorderedPlaceholders: Check for multiple unordered placeholders.
		$unordered_matches_count = preg_match_all( self::UNORDERED_SPRINTF_PLACEHOLDER_REGEX, $content, $unordered_matches );
		$unordered_matches       = $unordered_matches[0];
		$all_matches_count       = preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $content, $all_matches );

		if ( $unordered_matches_count > 0 && $unordered_matches_count !== $all_matches_count && $all_matches_count > 1 ) {
			$code = $this->string_to_errorcode( 'MixedOrderedPlaceholders' . ucfirst( $arg_name ) );
			$this->phpcsFile->addError(
				'Multiple placeholders should be ordered. Mix of ordered and non-ordered placeholders found. Found: %s.',
				$stack_ptr,
				$code,
				array( implode( ', ', $all_matches[0] ) )
			);

		} elseif ( $unordered_matches_count >= 2 ) {
			$code = $this->string_to_errorcode( 'UnorderedPlaceholders' . ucfirst( $arg_name ) );

			$suggestions     = array();
			$replace_regexes = array();
			$replacements    = array();
			for ( $i = 0; $i < $unordered_matches_count; $i++ ) {
				$to_insert         = ( $i + 1 );
				$to_insert        .= ( '"' !== $content[0] ) ? '$' : '\$';
				$suggestions[ $i ] = substr_replace( $unordered_matches[ $i ], $to_insert, 1, 0 );

				// Prepare the strings for use a regex.
				$replace_regexes[ $i ] = '`\Q' . $unordered_matches[ $i ] . '\E`';
				// Note: the initial \\ is a literal \, the four \ in the replacement translate to also to a literal \.
				$replacements[ $i ] = str_replace( '\\', '\\\\', $suggestions[ $i ] );
				// Note: the $ needs escaping to prevent numeric sequences after the $ being interpreted as match replacements.
				$replacements[ $i ] = str_replace( '$', '\\$', $replacements[ $i ] );
			}

			$fix = $this->addFixableMessage(
				'Multiple placeholders should be ordered. Expected \'%s\', but got %s.',
				$stack_ptr,
				$is_error,
				$code,
				array( implode( ', ', $suggestions ), implode( ', ', $unordered_matches ) )
			);

			if ( true === $fix ) {
				$fixed_str = preg_replace( $replace_regexes, $replacements, $content, 1 );

				$this->phpcsFile->fixer->replaceToken( $stack_ptr, $fixed_str );
			}
		}

		/*
		 * NoEmptyStrings.
		 *
		 * Strip placeholders and surrounding quotes.
		 */
		$non_placeholder_content = trim( $this->strip_quotes( $content ) );
		$non_placeholder_content = preg_replace( self::SPRINTF_PLACEHOLDER_REGEX, '', $non_placeholder_content );

		if ( '' === $non_placeholder_content ) {
			$this->phpcsFile->addError( 'Strings should have translatable content', $stack_ptr, 'NoEmptyStrings' );
		}
	}
protected function check_text( $context ) {
		$stack_ptr = $context['stack_ptr'];
		$arg_name  = $context['arg_name'];
		$content   = $context['tokens'][0]['content'];
		$is_error  = empty( $context['warning'] );

		// UnorderedPlaceholders: Check for multiple unordered placeholders.
		$unordered_matches_count = preg_match_all( self::UNORDERED_SPRINTF_PLACEHOLDER_REGEX, $content, $unordered_matches );
		$unordered_matches       = $unordered_matches[0];
		$all_matches_count       = preg_match_all( self::SPRINTF_PLACEHOLDER_REGEX, $content, $all_matches );

		if ( $unordered_matches_count > 0 && $unordered_matches_count !== $all_matches_count && $all_matches_count > 1 ) {
			$code = $this->string_to_errorcode( 'MixedOrderedPlaceholders' . ucfirst( $arg_name ) );
			$this->phpcsFile->addError(
				'Multiple placeholders should be ordered. Mix of ordered and non-ordered placeholders found. Found: %s.',
				$stack_ptr,
				$code,
				array( implode( ', ', $all_matches[0] ) )
			);

		} elseif ( $unordered_matches_count >= 2 ) {
			$code = $this->string_to_errorcode( 'UnorderedPlaceholders' . ucfirst( $arg_name ) );

			$suggestions     = array();
			$replace_regexes = array();
			$replacements    = array();
			for ( $i = 0; $i < $unordered_matches_count; $i++ ) {
				$to_insert         = ( $i + 1 );
				$to_insert        .= ( '"' !== $content[0] ) ? '$' : '\$';
				$suggestions[ $i ] = substr_replace( $unordered_matches[ $i ], $to_insert, 1, 0 );

				// Prepare the strings for use a regex.
				$replace_regexes[ $i ] = '`\Q' . $unordered_matches[ $i ] . '\E`';
				// Note: the initial \\ is a literal \, the four \ in the replacement translate to also to a literal \.
				$replacements[ $i ] = str_replace( '\\', '\\\\', $suggestions[ $i ] );
				// Note: the $ needs escaping to prevent numeric sequences after the $ being interpreted as match replacements.
				$replacements[ $i ] = str_replace( '$', '\\$', $replacements[ $i ] );
			}

			$fix = $this->addFixableMessage(
				'Multiple placeholders should be ordered. Expected \'%s\', but got %s.',
				$stack_ptr,
				$is_error,
				$code,
				array( implode( ', ', $suggestions ), implode( ', ', $unordered_matches ) )
			);

			if ( true === $fix ) {
				$fixed_str = preg_replace( $replace_regexes, $replacements, $content, 1 );

				$this->phpcsFile->fixer->replaceToken( $stack_ptr, $fixed_str );
			}
		}

		/*
		 * NoEmptyStrings.
		 *
		 * Strip placeholders and surrounding quotes.
		 */
		$non_placeholder_content = trim( $this->strip_quotes( $content ) );
		$non_placeholder_content = preg_replace( self::SPRINTF_PLACEHOLDER_REGEX, '', $non_placeholder_content );

		if ( '' === $non_placeholder_content ) {
			$this->phpcsFile->addError( 'Strings should have translatable content', $stack_ptr, 'NoEmptyStrings' );
		}
	}
protected function check_text ( $ context ) { $ stack_ptr = $ context [ 'stack_ptr' ] ; $ arg_name = $ context [ 'arg_name' ] ; $ content = $ context [ 'tokens' ] [ 0 ] [ 'content' ] ; $ is_error = empty ( $ context [ 'warning' ] ) ; // UnorderedPlaceholders: Check for multiple unordered placeholders. $ unordered_matches_count = preg_match_all ( self :: UNORDERED_SPRINTF_PLACEHOLDER_REGEX , $ content , $ unordered_matches ) ; $ unordered_matches = $ unordered_matches [ 0 ] ; $ all_matches_count = preg_match_all ( self :: SPRINTF_PLACEHOLDER_REGEX , $ content , $ all_matches ) ; if ( $ unordered_matches_count > 0 && $ unordered_matches_count !== $ all_matches_count && $ all_matches_count > 1 ) { $ code = $ this -> string_to_errorcode ( 'MixedOrderedPlaceholders' . ucfirst ( $ arg_name ) ) ; $ this -> phpcsFile -> addError ( 'Multiple placeholders should be ordered. Mix of ordered and non-ordered placeholders found. Found: %s.' , $ stack_ptr , $ code , array ( implode ( ', ' , $ all_matches [ 0 ] ) ) ) ; } elseif ( $ unordered_matches_count >= 2 ) { $ code = $ this -> string_to_errorcode ( 'UnorderedPlaceholders' . ucfirst ( $ arg_name ) ) ; $ suggestions = array ( ) ; $ replace_regexes = array ( ) ; $ replacements = array ( ) ; for ( $ i = 0 ; $ i < $ unordered_matches_count ; $ i ++ ) { $ to_insert = ( $ i + 1 ) ; $ to_insert .= ( '"' !== $ content [ 0 ] ) ? '$' : '\$' ; $ suggestions [ $ i ] = substr_replace ( $ unordered_matches [ $ i ] , $ to_insert , 1 , 0 ) ; // Prepare the strings for use a regex. $ replace_regexes [ $ i ] = '`\Q' . $ unordered_matches [ $ i ] . '\E`' ; // Note: the initial \\ is a literal \, the four \ in the replacement translate to also to a literal \. $ replacements [ $ i ] = str_replace ( '\\' , '\\\\' , $ suggestions [ $ i ] ) ; // Note: the $ needs escaping to prevent numeric sequences after the $ being interpreted as match replacements. $ replacements [ $ i ] = str_replace ( '$' , '\\$' , $ replacements [ $ i ] ) ; } $ fix = $ this -> addFixableMessage ( 'Multiple placeholders should be ordered. Expected \'%s\', but got %s.' , $ stack_ptr , $ is_error , $ code , array ( implode ( ', ' , $ suggestions ) , implode ( ', ' , $ unordered_matches ) ) ) ; if ( true === $ fix ) { $ fixed_str = preg_replace ( $ replace_regexes , $ replacements , $ content , 1 ) ; $ this -> phpcsFile -> fixer -> replaceToken ( $ stack_ptr , $ fixed_str ) ; } } /*
		 * NoEmptyStrings.
		 *
		 * Strip placeholders and surrounding quotes.
		 */ $ non_placeholder_content = trim ( $ this -> strip_quotes ( $ content ) ) ; $ non_placeholder_content = preg_replace ( self :: SPRINTF_PLACEHOLDER_REGEX , '' , $ non_placeholder_content ) ; if ( '' === $ non_placeholder_content ) { $ this -> phpcsFile -> addError ( 'Strings should have translatable content' , $ stack_ptr , 'NoEmptyStrings' ) ; } }
Check the string itself for problems.

@param array $context Context (@todo needs better description).
@return void
Check the string itself for problems .