WPThemeReview/Sniffs/PluginTerritory/AdminBarRemovalSniff.php
public function process_text_for_style( $stackPtr, $file_name ) {
		$content = trim( $this->tokens[ $stackPtr ]['content'] );

		// No need to check an empty string.
		if ( '' === $content ) {
			return;
		}

		// Are we in a <style> tag ?
		if ( true === $this->in_style[ $file_name ] ) {
			if ( false !== strpos( $content, '</style>' ) ) {
				// Make sure we check any content on this line before the closing style tag.
				$this->in_style[ $file_name ] = false;
				$content                      = trim( substr( $content, 0, strpos( $content, '</style>' ) ) );
			}
		} elseif ( false !== strpos( $content, '<style' ) ) {
			// Ok, found a <style> open tag.
			if ( false === strpos( $content, '</style>' ) ) {
				// Make sure we check any content on this line after the opening style tag.
				$this->in_style[ $file_name ] = true;
				$content                      = trim( substr( $content, ( strpos( $content, '<style' ) + 6 ) ) );
			} else {
				// Ok, we have open and close style tag on the same line with possibly content within.
				$start   = ( strpos( $content, '<style' ) + 6 );
				$end     = strpos( $content, '</style>' );
				$content = trim( substr( $content, $start, ( $end - $start ) ) );
				unset( $start, $end );
			}
		} else {
			return;
		}

		// Are we in one of the target selectors ?
		if ( true === $this->in_target_selector[ $file_name ] ) {
			if ( false !== strpos( $content, '}' ) ) {
				// Make sure we check any content on this line before the selector closing brace.
				$this->in_target_selector[ $file_name ] = false;
				$content                                = trim( substr( $content, 0, strpos( $content, '}' ) ) );
			}
		} elseif ( preg_match( $this->target_css_selectors_regex, $content, $matches ) > 0 ) {
			// Ok, found a new target selector.
			$content = '';

			if ( isset( $matches[1] ) && '' !== $matches[1] ) {
				if ( false === strpos( $matches[1], '}' ) ) {
					// Make sure we check any content on this line before the closing brace.
					$this->in_target_selector[ $file_name ] = true;
					$content                                = trim( $matches[1] );
				} else {
					// Ok, we have the selector open and close brace on the same line.
					$content = trim( substr( $matches[1], 0, strpos( $matches[1], '}' ) ) );
				}
			} else {
				$this->in_target_selector[ $file_name ] = true;
			}
		} else {
			return;
		}
		unset( $matches );

		// Now let's do the check for the CSS properties.
		if ( ! empty( $content ) ) {
			foreach ( $this->target_css_properties as $property => $requirements ) {
				if ( false !== strpos( $content, $property ) ) {
					$error = true;

					if ( true === $this->remove_only ) {
						// Check the value of the CSS property.
						if ( preg_match( '`' . preg_quote( $property, '`' ) . '\s*:\s*(.+?)\s*(?:!important)?;`', $content, $matches ) > 0 ) {
							$value = trim( $matches[1] );
							$valid = $this->validate_css_property_value( $value, $requirements['type'], $requirements['value'] );
							if ( true === $valid ) {
								$error = false;
							}
						}
					}

					if ( true === $error ) {
						$this->phpcsFile->addError( 'Hiding of the admin bar is not allowed.', $stackPtr, 'HidingDetected' );
					}
				}
			}
		}
	}
public function process_text_for_style( $stackPtr, $file_name ) {
		$content = trim( $this->tokens[ $stackPtr ]['content'] );

		// No need to check an empty string.
		if ( '' === $content ) {
			return;
		}

		// Are we in a <style> tag ?
		if ( true === $this->in_style[ $file_name ] ) {
			if ( false !== strpos( $content, '</style>' ) ) {
				// Make sure we check any content on this line before the closing style tag.
				$this->in_style[ $file_name ] = false;
				$content                      = trim( substr( $content, 0, strpos( $content, '</style>' ) ) );
			}
		} elseif ( false !== strpos( $content, '<style' ) ) {
			// Ok, found a <style> open tag.
			if ( false === strpos( $content, '</style>' ) ) {
				// Make sure we check any content on this line after the opening style tag.
				$this->in_style[ $file_name ] = true;
				$content                      = trim( substr( $content, ( strpos( $content, '<style' ) + 6 ) ) );
			} else {
				// Ok, we have open and close style tag on the same line with possibly content within.
				$start   = ( strpos( $content, '<style' ) + 6 );
				$end     = strpos( $content, '</style>' );
				$content = trim( substr( $content, $start, ( $end - $start ) ) );
				unset( $start, $end );
			}
		} else {
			return;
		}

		// Are we in one of the target selectors ?
		if ( true === $this->in_target_selector[ $file_name ] ) {
			if ( false !== strpos( $content, '}' ) ) {
				// Make sure we check any content on this line before the selector closing brace.
				$this->in_target_selector[ $file_name ] = false;
				$content                                = trim( substr( $content, 0, strpos( $content, '}' ) ) );
			}
		} elseif ( preg_match( $this->target_css_selectors_regex, $content, $matches ) > 0 ) {
			// Ok, found a new target selector.
			$content = '';

			if ( isset( $matches[1] ) && '' !== $matches[1] ) {
				if ( false === strpos( $matches[1], '}' ) ) {
					// Make sure we check any content on this line before the closing brace.
					$this->in_target_selector[ $file_name ] = true;
					$content                                = trim( $matches[1] );
				} else {
					// Ok, we have the selector open and close brace on the same line.
					$content = trim( substr( $matches[1], 0, strpos( $matches[1], '}' ) ) );
				}
			} else {
				$this->in_target_selector[ $file_name ] = true;
			}
		} else {
			return;
		}
		unset( $matches );

		// Now let's do the check for the CSS properties.
		if ( ! empty( $content ) ) {
			foreach ( $this->target_css_properties as $property => $requirements ) {
				if ( false !== strpos( $content, $property ) ) {
					$error = true;

					if ( true === $this->remove_only ) {
						// Check the value of the CSS property.
						if ( preg_match( '`' . preg_quote( $property, '`' ) . '\s*:\s*(.+?)\s*(?:!important)?;`', $content, $matches ) > 0 ) {
							$value = trim( $matches[1] );
							$valid = $this->validate_css_property_value( $value, $requirements['type'], $requirements['value'] );
							if ( true === $valid ) {
								$error = false;
							}
						}
					}

					if ( true === $error ) {
						$this->phpcsFile->addError( 'Hiding of the admin bar is not allowed.', $stackPtr, 'HidingDetected' );
					}
				}
			}
		}
	}
Processes this test, when one of its tokens is encountered.

@since WPCS 0.11.0

@param int    $stackPtr  The position of the current token in the stack.
@param string $file_name The file name of the current file being processed.

@return void