Leadtech/BootFramework

View on GitHub

Showing 15 of 15 total issues

Builder has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class Builder
{
    /** @var string */
    protected $appName = 'UNKNOWN';

Severity: Minor
Found in src/Leadtech/Boot/Builder.php - About 3 hrs to fix

    RemoteAccessPolicy has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RemoteAccessPolicy
    {
        /** @var bool */
        private $publicIpRangesDenied = false;
    
    
    Severity: Minor
    Found in src/Leadtech/Boot/Http/Security/RemoteAccessPolicy.php - About 2 hrs to fix

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

          private function createOrUpdateServiceDefinition(ContainerBuilder $container)
          {
              // First check if the console service is already registered.
              // This code will sure to give preference to user registered services.
              if ($container->hasDefinition($this->serviceIdentifier)) {
      Severity: Minor
      Found in src/Leadtech/Boot/Console/CompilerPass/ConsoleCompilerPass.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct(array $routeMatch)
          {
              // Get the route params + route match properties
              foreach ($routeMatch as $key => $value) {
                  if ($this->isClassMember($key)) {
      Severity: Minor
      Found in src/Leadtech/Boot/Http/Router/RouteMatch.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 invoke has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function invoke(RouteMatch $routeMatch, Request $request)
          {
              // Set route match & request
              $this->request = $request;
              $this->routeMatch = $routeMatch;
      Severity: Minor
      Found in src/Leadtech/Boot/Http/Service/AbstractService.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 getRealPaths has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getRealPaths()
          {
              $directories = [];
              $rootDir = $this->projectDir ?: getcwd();
              foreach ($this->getConfigDirs() as $path) {
      Severity: Minor
      Found in src/Leadtech/Boot/Builder.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 verifyClient has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function verifyClient(Request $request)
          {
              // Declare vars
              $clientIp = $request->getClientIp();
              $host = $request->getHost();
      Severity: Minor
      Found in src/Leadtech/Boot/Http/Router/RouteMatch.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 createOrUpdateServiceDefinition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function createOrUpdateServiceDefinition(ContainerBuilder $container)
          {
              // First check if the console service is already registered.
              // This code will sure to give preference to user registered services.
              if ($container->hasDefinition($this->serviceIdentifier)) {
      Severity: Minor
      Found in src/Leadtech/Boot/Console/CompilerPass/ConsoleCompilerPass.php - About 1 hr to fix

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

            public function loadConfiguration($resourceDir)
            {
                // Create xml loader
                $loader = new XmlFileLoader($this->serviceContainer, new FileLocator($resourceDir));
        
        
        Severity: Minor
        Found in src/Leadtech/Boot/ApplicationContext.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 moveAll has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function moveAll($targetDir, $files, $overwrite = false)
            {
                if (self::isDir($targetDir)) {
                    $fs = new Filesystem();
                    foreach ($files as $file) {
        Severity: Minor
        Found in src/Leadtech/Boot/IO/FileUtils.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

        Consider simplifying this complex logical expression.
        Open

                if ($this->isPublicIpRangesDenied() && NetworkUtils::isPublicIpRange($clientIp)
                    || $this->isPrivateIpRangesDenied() && NetworkUtils::isPrivateIpRange($clientIp)
                    || $this->isReservedIpRangesDenied() && NetworkUtils::isReservedIpRange($clientIp)) {
                    // Access denied!
                    $accessGranted = false;
        Severity: Major
        Found in src/Leadtech/Boot/Http/Router/RouteMatch.php - About 40 mins to fix

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

              public static function findByExtension($dir, $extension, $recursive = true, $followLinks = false, $filePattern = '*')
          Severity: Minor
          Found in src/Leadtech/Boot/IO/FileUtils.php - About 35 mins to fix

            Function createDirIfNotExists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function createDirIfNotExists($path, $mode = 0777, $recursive = true)
                {
                    // Check if the given path is a directory.
                    if (!is_dir($path)) {
                        if (file_exists($path)) {
            Severity: Minor
            Found in src/Leadtech/Boot/IO/FileUtils.php - About 25 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 loadConfigurations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function loadConfigurations($directories)
                {
                    // Load configurations
                    if (is_array($directories)) {
                        foreach ($directories as $directory) {
            Severity: Minor
            Found in src/Leadtech/Boot/ApplicationContext.php - About 25 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 loadCompilerPasses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function loadCompilerPasses($compilerPasses)
                {
                    // Load compiler passes
                    if (is_array($compilerPasses)) {
                        foreach ($compilerPasses as list($pass, $type)) {
            Severity: Minor
            Found in src/Leadtech/Boot/ApplicationContext.php - About 25 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