sroehrl/neoan.io-lenkrad-core

View on GitHub

Showing 28 of 31 total issues

Function __invoke has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function __invoke(): static
    {
        $reflection = new \ReflectionClass(static::class);

        foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
Severity: Minor
Found in src/Request/RequestGuard.php - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function updateTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    function updateTable(): void
    {
        $doubleDown = [];
        $sql = "CREATE TABLE `{$this->interimTableName}`(";
        foreach ($this->interpreter->filteredProperties() as $i => $property) {
Severity: Minor
Found in src/Cli/MigrationHelper/SqLiteMigration.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Request has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request implements RequestInterface
{
    private static ?RequestInterface $instance = null;

    public string $requestMethod;
Severity: Minor
Found in src/Request/Request.php - About 2 hrs to fix

    Function initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function initialize(array $staticModel = []): Model
        {
    
            foreach ($this->parsedModel as $property) {
    
    
    Severity: Minor
    Found in src/Model/Interpreter.php - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        protected function execute(InputInterface $input, OutputInterface $output): int
        {
    
            $modelName = $input->getArgument('model');
            $sanitizedModelName = preg_replace('/[\/\\\]/', '_', $modelName);
    Severity: Minor
    Found in src/Cli/MigrateCommand.php - About 1 hr to fix

      Method updateTable has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function updateTable(): void
          {
              $doubleDown = [];
              $sql = "CREATE TABLE `{$this->interimTableName}`(";
              foreach ($this->interpreter->filteredProperties() as $i => $property) {
      Severity: Minor
      Found in src/Cli/MigrationHelper/SqLiteMigration.php - About 1 hr to fix

        Function removePrivateAttributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function removePrivateAttributes(Model &$instance) : void
            {
                foreach ($this->reflection->properties as $property){
                    foreach ($property->getAttributes() as $attribute){
                        if($attribute->newInstance()->getType() === AttributeType::PRIVATE && $property->isPublic() && !$property->isReadOnly()) {
        Severity: Minor
        Found in src/Model/Interpreter.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output): int
            {
        
                $modelName = $input->getArgument('model');
                $sanitizedModelName = preg_replace('/[\/\\\]/', '_', $modelName);
        Severity: Minor
        Found in src/Cli/MigrateCommand.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function getDependencies has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getDependencies($parameters): array
            {
                $dependencies = [];
                foreach ($parameters as $parameter) {
                    foreach($this->getParameterTypes($parameter) as $dependency) {
        Severity: Minor
        Found in src/Provider/DefaultProvider.php - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method migrateOne has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function migrateOne($modelName): void
            {
                if ($this->input->getArgument('dialect') === 'sqlite') {
                    $migrate = new SqLiteMigration(new ModelInterpreter($modelName), $this->input->getOption('with-copy'));
                } else {
        Severity: Minor
        Found in src/Cli/MigrateAllCommand.php - About 1 hr to fix

          Method parseClass has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parseClass(): array
              {
                  $this->parsedClass[] = [];
                  foreach ($this->properties as $i => $property) {
                      $attributes = $this->propertyMatchList[$property->getName()];
          Severity: Minor
          Found in src/Helper/AttributeHelper.php - About 1 hr to fix

            Method __invoke has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __invoke(): static
                {
                    $reflection = new \ReflectionClass(static::class);
            
                    foreach ($reflection->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
            Severity: Minor
            Found in src/Request/RequestGuard.php - About 1 hr to fix

              Function parseClass has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function parseClass(): array
                  {
                      $this->parsedClass[] = [];
                      foreach ($this->properties as $i => $property) {
                          $attributes = $this->propertyMatchList[$property->getName()];
              Severity: Minor
              Found in src/Helper/AttributeHelper.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function migrateOne has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function migrateOne($modelName): void
                  {
                      if ($this->input->getArgument('dialect') === 'sqlite') {
                          $migrate = new SqLiteMigration(new ModelInterpreter($modelName), $this->input->getOption('with-copy'));
                      } else {
              Severity: Minor
              Found in src/Cli/MigrateAllCommand.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method __construct has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct(string $message)
                  {
                      Event::dispatch(GenericEvent::UNRECOVERABLE_ERROR,[
                          self::class => $message
                      ]);
              Severity: Minor
              Found in src/Errors/SystemError.php - About 1 hr to fix

                Function __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct(string $message)
                    {
                        Event::dispatch(GenericEvent::UNRECOVERABLE_ERROR,[
                            self::class => $message
                        ]);
                Severity: Minor
                Found in src/Errors/SystemError.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function initialize(array $staticModel = []): Model
                    {
                
                        foreach ($this->parsedModel as $property) {
                
                
                Severity: Minor
                Found in src/Model/Interpreter.php - About 1 hr to fix

                  Function convert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function convert(mixed $data): mixed
                      {
                          if ($data instanceof Model || $data instanceof Collection || $data instanceof DataNormalization) {
                              $data = $data->toArray();
                          } elseif ($data instanceof Dynamic) {
                  Severity: Minor
                  Found in src/Helper/DataNormalization.php - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                      private function directoryExplorer(string $startingPoint, string $nameSpace): void
                      {
                          foreach (scandir($startingPoint) as $fileOrFolder) {
                              if (str_ends_with($fileOrFolder, '.php')) {
                                  try {
                  Severity: Minor
                  Found in src/Cli/MigrateAllCommand.php - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                      public static function getInstance($mockMe = null, $webPath = ''): ?RequestInterface
                      {
                          if ($mockMe) {
                              self::$instance = $mockMe;
                              self::$instance->webPath = $webPath;
                  Severity: Minor
                  Found in src/Request/Request.php - About 45 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language