martin-helmich/typo3-typoscript-parser

View on GitHub
src/Tokenizer/Tokenizer.php

Summary

Maintainability
C
1 day
Test Coverage
A
99%

Showing 20 of 20 total issues

Function tokenizeString has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

public function tokenizeString(string $inputString): array
{
$inputString = $this->preprocessor->preprocess($inputString);
 
$tokens = new TokenStreamBuilder();
Severity: Minor
Found in src/Tokenizer/Tokenizer.php - About 2 hrs to fix

File Tokenizer.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
declare(strict_types=1);
 
namespace Helmich\TypoScriptParser\Tokenizer;
Severity: Minor
Found in src/Tokenizer/Tokenizer.php - About 2 hrs to fix

    Method tokenizeBinaryObjectOperation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    private function tokenizeBinaryObjectOperation(TokenStreamBuilder $tokens, array $matches, int $currentLine): void
    {
    $tokens->append(
    $this->getTokenTypeForBinaryOperator($matches[3]),
    $matches[3],
    Severity: Minor
    Found in src/Tokenizer/Tokenizer.php - About 1 hr to fix

      Method tokenizeString has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function tokenizeString(string $inputString): array
      {
      $inputString = $this->preprocessor->preprocess($inputString);
       
      $tokens = new TokenStreamBuilder();
      Severity: Minor
      Found in src/Tokenizer/Tokenizer.php - About 1 hr to fix

        Function tokenizeBinaryObjectOperation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        private function tokenizeBinaryObjectOperation(TokenStreamBuilder $tokens, array $matches, int $currentLine): void
        {
        $tokens->append(
        $this->getTokenTypeForBinaryOperator($matches[3]),
        $matches[3],
        Severity: Minor
        Found in src/Tokenizer/Tokenizer.php - About 45 mins to fix

        Function tokenizeObjectOperation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        private function tokenizeObjectOperation(
        TokenStreamBuilder $tokens,
        MultilineTokenBuilder $state,
        ScannerLine $line
        ): bool {
        Severity: Minor
        Found in src/Tokenizer/Tokenizer.php - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

        return TokenInterface::TYPE_OPERATOR_DELETE;
        Severity: Major
        Found in src/Tokenizer/Tokenizer.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return;
          Severity: Major
          Found in src/Tokenizer/Tokenizer.php - About 30 mins to fix

            The method tokenizeString() has an NPath complexity of 258. The configured NPath complexity threshold is 200.
            Open

            public function tokenizeString(string $inputString): array
            {
            $inputString = $this->preprocessor->preprocess($inputString);
             
            $tokens = new TokenStreamBuilder();
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            The method tokenizeBinaryObjectOperation() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
            Open

            private function tokenizeBinaryObjectOperation(TokenStreamBuilder $tokens, array $matches, int $currentLine): void
            {
            $tokens->append(
            $this->getTokenTypeForBinaryOperator($matches[3]),
            $matches[3],
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            The method tokenizeBinaryObjectOperation() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
            Open

            private function tokenizeBinaryObjectOperation(TokenStreamBuilder $tokens, array $matches, int $currentLine): void
            {
            $tokens->append(
            $this->getTokenTypeForBinaryOperator($matches[3]),
            $matches[3],
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            The method tokenizeString() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
            Open

            public function tokenizeString(string $inputString): array
            {
            $inputString = $this->preprocessor->preprocess($inputString);
             
            $tokens = new TokenStreamBuilder();
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            The class Tokenizer has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
            Open

            class Tokenizer implements TokenizerInterface
            {
            const OBJECT_ACCESSOR = '((?:\.)|(?:[a-zA-Z0-9_\-\\\\:\$\{\}/]+(?:\.[a-zA-Z0-9_\-\\\\:\$\{\}/]*)*))';
             
            const TOKEN_WHITESPACE = ',^[ \t\n]+,s';
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Missing class import via use statement (line '143', column '23').
            Open

            throw new \InvalidArgumentException("could not open file '$inputStream'");
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Avoid assigning values to variables in if clauses and the like (line '273', column '14').
            Open

            private function tokenizeMultilineComment(
            TokenStreamBuilder $tokens,
            MultilineTokenBuilder $state,
            ScannerLine $line
            ): void {
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Avoid assigning values to variables in if clauses and the like (line '323', column '14').
            Open

            private function tokenizeObjectOperation(
            TokenStreamBuilder $tokens,
            MultilineTokenBuilder $state,
            ScannerLine $line
            ): bool {
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Avoid assigning values to variables in if clauses and the like (line '309', column '18').
            Open

            private function tokenizeSimpleStatements(TokenStreamBuilder $tokens, ScannerLine $line): bool
            {
            $simpleTokens = [
            self::TOKEN_COMMENT_ONELINE => TokenInterface::TYPE_COMMENT_ONELINE,
            self::TOKEN_NESTING_END => TokenInterface::TYPE_BRACE_CLOSE,
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Avoid assigning values to variables in if clauses and the like (line '101', column '18').
            Open

            public function tokenizeString(string $inputString): array
            {
            $inputString = $this->preprocessor->preprocess($inputString);
             
            $tokens = new TokenStreamBuilder();
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Avoid assigning values to variables in if clauses and the like (line '269', column '14').
            Open

            private function tokenizeMultilineComment(
            TokenStreamBuilder $tokens,
            MultilineTokenBuilder $state,
            ScannerLine $line
            ): void {
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpmd

            Expected 0 spaces after opening bracket; newline found
            Open

            if (
            Severity: Minor
            Found in src/Tokenizer/Tokenizer.php by phpcodesniffer
            Category
            Status