moay/loxberry-php-core

View on GitHub

Showing 17 of 17 total issues

PluginInformation has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

class PluginInformation
{
    const DEFAULT_ICON = 'icon_64.png';

    /** @var int */
Severity: Minor
Found in src/System/Plugin/PluginInformation.php - About 4 hrs to fix

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

    class Logger
    {
        const LOGLEVEL_FATAL_ERROR = 0;
        const LOGLEVEL_ALERT = 1;
        const LOGLEVEL_CRITICAL_ERROR = 2;
    Severity: Minor
    Found in src/Logging/Logger.php - About 3 hrs to fix

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

      class MiniserverInformation
      {
          /** @var string */
          private $name;
      
      
      Severity: Minor
      Found in src/ConfigurationParser/MiniserverInformation.php - About 2 hrs to fix

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

            private function parseTranslations()
            {
                if (!file_exists($this->fileName) || !is_readable($this->fileName)) {
                    throw new \InvalidArgumentException(sprintf('Non existing translation file %s requested.', $this->fileName));
                }
        Severity: Minor
        Found in src/System/Localization/LanguageFileParser.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 sendToSocket has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function sendToSocket($socket, string $buf, int $len, int $flags, string $addr, int $port = 0)
        Severity: Minor
        Found in src/System/LowLevelExecutor.php - About 45 mins to fix

          Method __invoke has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  string $logName,
                  string $packageName,
                  ?string $fileName = null,
                  bool $writeToFile = true,
                  bool $writeToStdErr = false,
          Severity: Minor
          Found in src/Logging/LoggerFactory.php - About 45 mins to fix

            Method create has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $logName,
                    string $packageName,
                    ?string $fileName = null,
                    bool $writeToFile = true,
                    bool $writeToStdErr = false,
            Severity: Minor
            Found in src/Logging/LoggerFactory.php - About 45 mins to fix

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

                  public function fileGetContents($filename, bool $use_include_path = false, $context = null, int $offset = 0, ?int $maxlen = null)
              Severity: Minor
              Found in src/System/LowLevelExecutor.php - About 35 mins to fix

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

                        LogFileDatabaseFactory $databaseFactory,
                        LowLevelExecutor $lowLevelExecutor,
                        PathProvider $pathProvider,
                        SystemConfigurationParser $systemConfiguration,
                        PluginDatabase $pluginDatabase
                Severity: Minor
                Found in src/Logging/LoggerFactory.php - About 35 mins to fix

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

                          string $packageName,
                          string $name,
                          string $message,
                          array $additionalData = [],
                          $isError = false
                  Severity: Minor
                  Found in src/Communication/Notifications.php - About 35 mins to fix

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

                            string $logName,
                            string $packageName,
                            EventLogger $eventLogger,
                            AttributeLogger $attributeLogger,
                            SystemConfigurationParser $systemConfiguration
                    Severity: Minor
                    Found in src/Logging/Logger.php - About 35 mins to fix

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

                          public function log($messageOrEvent, int $level = self::LOGLEVEL_DEBUG)
                          {
                              if (!$this->started) {
                                  $this->logStart();
                              }
                      Severity: Minor
                      Found in src/Logging/Logger.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 getStorageDeviceSelect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getStorageDeviceSelect(string $formId, array $flagsAndConfigurations = []): string
                          {
                              foreach ($flagsAndConfigurations as $configurationOrKey => $flagOrValue) {
                                  if (is_numeric($configurationOrKey)) {
                                      if (!in_array($flagOrValue, self::KNOWN_FLAGS)) {
                      Severity: Minor
                      Found in src/System/Utility/HttpAccess/AjaxStorageHandler.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 push has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function push(MiniserverInformation $miniserver, array $data, ?string $prefix = null)
                          {
                              if (null === $this->udpPort) {
                                  throw new \LogicException('Cannot execute UDP call, port must be set first via setUdpPort');
                              }
                      Severity: Minor
                      Found in src/Communication/Udp.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 $now->format('"Y-m-d\TH:i:sO"');
                      Severity: Major
                      Found in src/System/Utility/DateTimeProvider.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $now->format('Ymd_His_').$microseconds;
                        Severity: Major
                        Found in src/System/Utility/DateTimeProvider.php - About 30 mins to fix

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

                              private function prepareMessages(array $data, ?string $prefix = null): array
                              {
                                  $messages = [];
                                  $prefixStrLength = null !== $prefix ? strlen($prefix) + 2 : 0;
                                  $message = '';
                          Severity: Minor
                          Found in src/Communication/Udp.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