tastphp/framework

View on GitHub

Showing 28 of 30 total issues

Method register has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function register(Container $app)
    {
        $app['db.default_options'] = array(
            'driver' => 'pdo_mysql',
            'dbname' => 'test',
Severity: Major
Found in src/Framework/Doctrine/DoctrineService.php - About 3 hrs to fix

    File RouterService.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace TastPHP\Framework\Router;
    
    use Psr\Http\Message\ServerRequestInterface;
    Severity: Minor
    Found in src/Framework/Router/RouterService.php - About 3 hrs to fix

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

          public function match($requestUrl, $requestMethod = 'GET')
          {
              $isRegexp = false;
      
              $this->bind();
      Severity: Minor
      Found in src/Framework/Router/RouterService.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

      Function dispatch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function dispatch($container)
          {
              $action = explode('::', $this->config['_controller']);
      
              if (count($action) != 2) {
      Severity: Minor
      Found in src/Framework/Router/RouterService.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 dispatch has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function dispatch($container)
          {
              $action = explode('::', $this->config['_controller']);
      
              if (count($action) != 2) {
      Severity: Minor
      Found in src/Framework/Router/RouterService.php - About 1 hr to fix

        Function pregMatch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            private function pregMatch($url, $requestUrl, $route)
            {
                $replace = [];
                $search = [];
                $requireKeyNames = [];
        Severity: Minor
        Found in src/Framework/Router/RouterService.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 register has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function register()
            {
                $container = Kernel::getInstance();
        
                //debug bar
        Severity: Minor
        Found in src/Framework/Handler/WhoopsExceptionsHandler.php - About 1 hr to fix

          Method pregMatch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function pregMatch($url, $requestUrl, $route)
              {
                  $replace = [];
                  $search = [];
                  $requireKeyNames = [];
          Severity: Minor
          Found in src/Framework/Router/RouterService.php - About 1 hr to fix

            Method match has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function match($requestUrl, $requestMethod = 'GET')
                {
                    $isRegexp = false;
            
                    $this->bind();
            Severity: Minor
            Found in src/Framework/Router/RouterService.php - About 1 hr to fix

              Function register has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function register(Container $app)
                  {
                      $app['middlewareEvent'] = function ($app) {
                          return new MiddlewareEvent($app);
                      };
              Severity: Minor
              Found in src/Framework/ListenerRegister/ListenerRegisterService.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 generateEntityService has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function generateEntityService($output, $name)
                  {
                      $tableName = $name;
                      $name = $this->getGenerateEntityServiceNameByTableName($tableName);
                      $filesystem = new Filesystem();
              Severity: Minor
              Found in src/Framework/Console/Command/GenerateEntityServiceCommand.php - About 1 hr to fix

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

                    public function parseResource($resource, $isCustom)
                    {
                        $config = [];
                        if (true == $isCustom) {
                            $configResourceDir = self::$configCacheDir . "/" . substr($resource, 0, -11);
                Severity: Minor
                Found in src/Framework/Config/ConfigService.php - About 1 hr to fix

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

                      public function handleShutdown()
                      {
                          if ($exception = error_get_last()) {
                              if ($this->isFatal($exception['type'])) {
                                  $this->record($exception);
                  Severity: Minor
                  Found in src/Framework/Handler/ExceptionsHandler.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 parseRoutesConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function parseRoutesConfig($routesFile, $routeConfigAll)
                      {
                          $routesConfigs = YamlService::parse(file_get_contents($routesFile));
                          foreach ($routesConfigs as $routeConfig) {
                              $resources = ($routeConfig['resource']);
                  Severity: Minor
                  Found in src/Framework/Router/RouterServiceProvider.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 handleError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleError($level, $message, $file = '', $line = 0)
                      {
                          if (error_reporting() & $level) {
                              $error = [
                                  'message' => $message,
                  Severity: Minor
                  Found in src/Framework/Handler/ExceptionsHandler.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 registerServices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function registerServices()
                      {
                          $this['serviceProviders'] = $this->serviceProviders;
                  
                          foreach ($this->serviceProviders as $providerArray) {
                  Severity: Minor
                  Found in src/Framework/Traits/KernelTrait.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

                  Method put has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function put($tube, $data, $priority = 1024, $delaytime = 0, $lifetime = 60)
                  Severity: Minor
                  Found in src/Framework/Queue/BeanstalkdService.php - About 35 mins to fix

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

                        public function parseResource($resource, $isCustom)
                        {
                            $config = [];
                            if (true == $isCustom) {
                                $configResourceDir = self::$configCacheDir . "/" . substr($resource, 0, -11);
                    Severity: Minor
                    Found in src/Framework/Config/ConfigService.php - About 35 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 extend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function extend($id, $callable)
                        {
                            if (!isset($this->keys[$id])) {
                                throw new UnknownIdentifierException($id);
                            }
                    Severity: Minor
                    Found in src/Framework/Container/Container.php - About 35 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

                    Avoid too many return statements within this method.
                    Open

                                return $dbs[$app['dbs.default']];
                    Severity: Major
                    Found in src/Framework/Doctrine/DoctrineService.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language