Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractLineCall.php

function AbstractLineCall::getCall

2 calls to AbstractLineCall::getCall()
RequireMultiLineCallSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/RequireMultiLineCallSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
RequireSingleLineCallSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/RequireSingleLineCallSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Functions/AbstractLineCall.php, line 54

Class

AbstractLineCall

Namespace

SlevomatCodingStandard\Sniffs\Functions

Code

protected function getCall(File $phpcsFile, int $parenthesisOpenerPointer, int $parenthesisCloserPointer) : string {
    $tokens = $phpcsFile->getTokens();
    $pointerBeforeParenthesisCloser = TokenHelper::findPreviousEffective($phpcsFile, $parenthesisCloserPointer - 1);
    $endPointer = $tokens[$pointerBeforeParenthesisCloser]['code'] === T_COMMA ? $pointerBeforeParenthesisCloser : $parenthesisCloserPointer;
    $call = '';
    for ($i = $parenthesisOpenerPointer + 1; $i < $endPointer; $i++) {
        if ($tokens[$i]['code'] === T_COMMA) {
            $nextPointer = TokenHelper::findNextEffective($phpcsFile, $i + 1);
            if ($tokens[$nextPointer]['code'] === T_CLOSE_PARENTHESIS) {
                $i = $nextPointer - 1;
                continue;
            }
        }
        if ($tokens[$i]['code'] === T_WHITESPACE) {
            if ($tokens[$i]['content'] === $phpcsFile->eolChar) {
                if ($tokens[$i - 1]['code'] === T_COMMA) {
                    $call .= ' ';
                }
                continue;
            }
            if ($tokens[$i]['column'] === 1) {
                // Nothing
                continue;
            }
        }
        $call .= $tokens[$i]['content'];
    }
    return trim($call);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal