dadajuice/zephyrus

View on GitHub

Showing 64 of 84 total issues

ContentSecurityPolicy has 42 functions (exceeds 20 allowed). Consider refactoring.
Open

class ContentSecurityPolicy
{
    public const SELF = "'self'";
    public const UNSAFE_INLINE = "'unsafe-inline'";
    public const UNSAFE_EVAL = "'unsafe-eval'";
Severity: Minor
Found in src/Zephyrus/Security/ContentSecurityPolicy.php - About 5 hrs to fix

    Function localize has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        public function localize(string $key, array $args = []): string
        {
            $locale = $this->appLocale;
            $segments = explode(".", $key);
            $localizeIdentifier = $segments[0];
    Severity: Minor
    Found in src/Zephyrus/Application/Localization.php - About 4 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

    HttpRequester has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class HttpRequester
    {
        private string $url;
        private string $method;
        private bool $verifySsl = true;
    Severity: Minor
    Found in src/Zephyrus/Network/HttpRequester.php - About 4 hrs to fix

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

          private function convertFromJSCharCode(string $value): string
          {
              $matches = [];
      
              // check if value matches typical charCode pattern

      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

      FileUpload has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class FileUpload
      {
          /**
           * Original received data array for file upload. Should contain the following keys : ['error', 'tmp_name', 'type',
           * 'name', 'size'].
      Severity: Minor
      Found in src/Zephyrus/Utilities/Uploader/FileUpload.php - About 3 hrs to fix

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

        class Request
        {
            private ServerEnvironnement $environnement;
            private Url $url;
            private RequestBody $body;
        Severity: Minor
        Found in src/Zephyrus/Network/Request.php - About 3 hrs to fix

          File has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class File extends FileSystemNode
          {
              /**
               * Creates a new file and returns an instance of the newly created file. Will throw an exception if the override
               * argument is set to false and the file already exists.
          Severity: Minor
          Found in src/Zephyrus/Utilities/FileSystem/File.php - About 2 hrs to fix

            CsrfGuard has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class CsrfGuard
            {
                public const HEADER_TOKEN = 'HTTP_X_CSRF_TOKEN';
                public const REQUEST_TOKEN_VALUE = 'CSRFToken';
                public const TOKEN_LENGTH = 48;
            Severity: Minor
            Found in src/Zephyrus/Security/CsrfGuard.php - About 2 hrs to fix

              Localization has 23 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Localization
              {
                  private static ?Localization $instance = null;
              
                  /**
              Severity: Minor
              Found in src/Zephyrus/Application/Localization.php - About 2 hrs to fix

                Form has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Form
                {
                    private const SESSION_KEY = '__ZF_FORM_FIELDS';
                
                    /**
                Severity: Minor
                Found in src/Zephyrus/Application/Form.php - About 2 hrs to fix

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

                      function getallheaders(): array
                      {
                          $headers = [];
                          $copy_server = [
                              'CONTENT_TYPE'   => 'Content-Type',
                  Severity: Minor
                  Found in src/Zephyrus/functions.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

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

                  class WhereCondition
                  {
                      private array $queryParameters;
                      private string $resultSql;
                  
                  
                  Severity: Minor
                  Found in src/Zephyrus/Database/QueryBuilder/WhereCondition.php - About 2 hrs to fix

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

                    class RouteDefinition
                    {
                        private string $rawRouteRoot = "";
                        private string $routeRoot = "";
                        private string $route;
                    Severity: Minor
                    Found in src/Zephyrus/Network/Router/RouteDefinition.php - About 2 hrs to fix

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

                      class Directory extends FileSystemNode
                      {
                          /**
                           * Creates a new directory and returns an instance of the newly created
                           * directory.
                      Severity: Minor
                      Found in src/Zephyrus/Utilities/FileSystem/Directory.php - About 2 hrs to fix

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

                            private function prepareMultipartFormData(array $payload): array
                            {
                                $parameters = [];
                                foreach ($payload as $parameterName => $parameterValue) {
                                    // Problem with cURL while sending array in multipart/form-data
                        Severity: Minor
                        Found in src/Zephyrus/Network/HttpRequester/HttpPayload.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 convertFromControlChars has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function convertFromControlChars(string $value): string
                            {
                                // critical ctrl values
                                $search = [
                                    chr(0), chr(1), chr(2), chr(3), chr(4), chr(5),

                          Method localize has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function localize(string $key, array $args = []): string
                              {
                                  $locale = $this->appLocale;
                                  $segments = explode(".", $key);
                                  $localizeIdentifier = $segments[0];
                          Severity: Minor
                          Found in src/Zephyrus/Application/Localization.php - About 2 hrs to fix

                            Function initializeRoutesFromAttributes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private static function initializeRoutesFromAttributes(RouteRepository $repository): void
                                {
                                    $class = new ReflectionClass(static::class);
                                    $baseRoute = self::initializeBaseRoute($class);
                                    $result = self::initializeBaseAuthorizationRules($class);
                            Severity: Minor
                            Found in src/Zephyrus/Application/Controller.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 verify has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function verify(array $fields = []): bool
                                {
                                    if ($this->optional && $this->isEmpty()) {
                                        return true;
                                    }
                            Severity: Minor
                            Found in src/Zephyrus/Application/FormField.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 convertFromJSCharCode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function convertFromJSCharCode(string $value): string
                                {
                                    $matches = [];
                            
                                    // check if value matches typical charCode pattern
                              Severity
                              Category
                              Status
                              Source
                              Language