coralogix/php-coralogix-sdk

View on GitHub
src/Coralogix/LoggerManager.php

Summary

Maintainability
A
0 mins
Test Coverage

Method add_logline has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

    public function add_logline($message, int $severity, string $category = NULL, array $params = array())
    {
        try {
            if ($this->buffer_size < Constants::MAX_LOG_BUFFER_SIZE) {
                // Validate message
Severity: Minor
Found in src/Coralogix/LoggerManager.php - About 1 hr to fix

    Method __construct has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

        public function __construct(array $params, bool $sync_time = true)
        {
            try {
                // Initialize parameters
                $this->configured = false;
    Severity: Minor
    Found in src/Coralogix/LoggerManager.php - About 1 hr to fix

      Function add_logline has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Wontfix

          public function add_logline($message, int $severity, string $category = NULL, array $params = array())
          {
              try {
                  if ($this->buffer_size < Constants::MAX_LOG_BUFFER_SIZE) {
                      // Validate message
      Severity: Minor
      Found in src/Coralogix/LoggerManager.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 msg2str has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Wontfix

          public function msg2str($message): string
          {
              try {
                  // Format message content according to it's type
                  if (is_string($message)) {
      Severity: Minor
      Found in src/Coralogix/LoggerManager.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 send_bulk has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Wontfix

          private function send_bulk(bool $time_sync = true)
          {
              try {
                  // Check if current logger manager is configured
                  if (!$this->configured) return;
      Severity: Minor
      Found in src/Coralogix/LoggerManager.php - About 1 hr to fix

        Function run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Wontfix

            public function run()
            {
                try {
                    // Execute while thread not stopped
                    while (true) {
        Severity: Minor
        Found in src/Coralogix/LoggerManager.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 send_bulk has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Wontfix

            private function send_bulk(bool $time_sync = true)
            {
                try {
                    // Check if current logger manager is configured
                    if (!$this->configured) return;
        Severity: Minor
        Found in src/Coralogix/LoggerManager.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 update_time_delta_interval has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Wontfix

            private function update_time_delta_interval()
            {
                try {
                    if (time() - $this->time_delta_last_update >= 60 * Constants::SYNC_TIME_UPDATE_INTERVAL) {
                        // Get time information from Coralogix servers
        Severity: Minor
        Found in src/Coralogix/LoggerManager.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

        There are no issues that match your filters.

        Category
        Status