protected function isInCodeExample(PHP_CodeSniffer_File $phpcs_file, $stack_ptr) {
    $tokens = $phpcs_file->getTokens();
    $prev_comment = $stack_ptr;
    $last_comment = $stack_ptr;
    while (($prev_comment = $phpcs_file->findPrevious(array(T_COMMENT), ($last_comment - 1), NULL, FALSE)) !== FALSE) {
      if (isset($tokens[$last_comment]['line']) && $tokens[$prev_comment]['line'] !== ($tokens[$last_comment]['line'] - 1)) {
        return FALSE;
      }

      if ($tokens[$prev_comment]['content'] === '// @code' . $phpcs_file->eolChar) {
        return TRUE;
      }

      if ($tokens[$prev_comment]['content'] === '// @endcode' . $phpcs_file->eolChar) {
        return FALSE;
      }

      $last_comment = $prev_comment;
    }

    return FALSE;
  }
protected function isInCodeExample(PHP_CodeSniffer_File $phpcs_file, $stack_ptr) {
    $tokens = $phpcs_file->getTokens();
    $prev_comment = $stack_ptr;
    $last_comment = $stack_ptr;
    while (($prev_comment = $phpcs_file->findPrevious(array(T_COMMENT), ($last_comment - 1), NULL, FALSE)) !== FALSE) {
      if (isset($tokens[$last_comment]['line']) && $tokens[$prev_comment]['line'] !== ($tokens[$last_comment]['line'] - 1)) {
        return FALSE;
      }

      if ($tokens[$prev_comment]['content'] === '// @code' . $phpcs_file->eolChar) {
        return TRUE;
      }

      if ($tokens[$prev_comment]['content'] === '// @endcode' . $phpcs_file->eolChar) {
        return FALSE;
      }

      $last_comment = $prev_comment;
    }

    return FALSE;
  }
protected function isInCodeExample ( PHP_CodeSniffer_File $ phpcs_file , $ stack_ptr ) { $ tokens = $ phpcs_file -> getTokens ( ) ; $ prev_comment = $ stack_ptr ; $ last_comment = $ stack_ptr ; while ( ( $ prev_comment = $ phpcs_file -> findPrevious ( array ( T_COMMENT ) , ( $ last_comment - 1 ) , NULL , FALSE ) ) !== FALSE ) { if ( isset ( $ tokens [ $ last_comment ] [ 'line' ] ) && $ tokens [ $ prev_comment ] [ 'line' ] !== ( $ tokens [ $ last_comment ] [ 'line' ] - 1 ) ) { return FALSE ; } if ( $ tokens [ $ prev_comment ] [ 'content' ] === '// @code' . $ phpcs_file -> eolChar ) { return TRUE ; } if ( $ tokens [ $ prev_comment ] [ 'content' ] === '// @endcode' . $ phpcs_file -> eolChar ) { return FALSE ; } $ last_comment = $ prev_comment ; } return FALSE ; }
Determines if a comment line is part of an @code/@endcode example.
Determines if a comment line is part of an