kaspernj/php_process

View on GitHub
lib/php_process/php_script.php

Summary

Maintainability
C
1 day
Test Coverage

File php_script.php has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env php5
<?php

//Controls the PHP-process on the PHP-side.
class php_process{
Severity: Minor
Found in lib/php_process/php_script.php - About 3 hrs to fix

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

    class php_process{
      private $errortypes = array (
        E_ERROR => 'Error',
        E_WARNING => 'Warning',
        E_PARSE => 'Parsing Error',
    Severity: Minor
    Found in lib/php_process/php_script.php - About 2 hrs to fix

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

        function parse_data($data){
          if (is_array($data)){
            foreach($data as $key => $val){
              if (is_object($val)){
                $data[$key] = $this->parse_data($val);
      Severity: Minor
      Found in lib/php_process/php_script.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 func has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        function func($id, $args){
          //These functions cant be called normally. Hack them with eval instead.
          $newargs = $this->read_parsed_data($args["args"]);
      
          if (in_array($args["func_name"], $this->func_specials)){
      Severity: Minor
      Found in lib/php_process/php_script.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 handle_line has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        function handle_line($line){
          $data = explode(":", $line);
          $type = $data[0];
          $id = intval($data[1]);
          $args = unserialize(base64_decode($data[2]));
      Severity: Minor
      Found in lib/php_process/php_script.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 handle_line has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function handle_line($line){
          $data = explode(":", $line);
          $type = $data[0];
          $id = intval($data[1]);
          $args = unserialize(base64_decode($data[2]));
      Severity: Minor
      Found in lib/php_process/php_script.php - About 1 hr to fix

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

          function error_handler($error_number, $error_message, $file_name, $line_number, $vars, $args = null){
        Severity: Minor
        Found in lib/php_process/php_script.php - About 45 mins to fix

          Function read_parsed_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            function read_parsed_data($data){
              if (is_array($data) and array_key_exists("type", $data) and $data["type"] == "proxyobj" and array_key_exists("id", $data)){
                $object = $this->objects[$data["id"]]["obj"];
                if (!$object){
                  throw new exception("No object by that ID: " . $data["id"]);
          Severity: Minor
          Found in lib/php_process/php_script.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 unset_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            function unset_ids($id, $args){
              foreach($args["ids"] as $obj_id){
                if (!array_key_exists($obj_id, $this->objects)){
                  continue;
                }
          Severity: Minor
          Found in lib/php_process/php_script.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

          There are no issues that match your filters.

          Category
          Status