detain/myadmin-softaculous-licensing

View on GitHub

Showing 25 of 108 total issues

File SoftaculousNOC.php has 627 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Softaculous Related Functionality
 * @author Joe Huss <detain@interserver.net>
 * @copyright 2020
Severity: Major
Found in src/SoftaculousNOC.php - About 1 day to fix

    SoftaculousNOC has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SoftaculousNOC
    {
        private $nocname = 'username';
        private $nocpass = 'password';
        public $softaculous = 'https://www.softaculous.com/noc';
    Severity: Minor
    Found in src/SoftaculousNOC.php - About 6 hrs to fix

      Function array2json has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      function array2json($arr)
      {
          if (function_exists('json_encode')) {
              return json_encode($arr);
          } //Lastest versions of PHP already has this functionality.
      Severity: Minor
      Found in src/SoftaculousNOC.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

      Function sitemush_refund_and_cancel has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function sitemush_refund_and_cancel($key = '', $ip = '', $force = 0)
          {
              if (!empty($ip)) {
                  // Search for a license
                  $lic = $this->sitemush_licenses('', $ip);
      Severity: Minor
      Found in src/SoftaculousNOC.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

      Function refund_and_cancel has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function refund_and_cancel($key = '', $ip = '', $force = 0)
          {
              if (!empty($ip)) {
                  // Search for a license
                  $lic = $this->licenses('', $ip);
      Severity: Minor
      Found in src/SoftaculousNOC.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

      Function webuzo_refund_and_cancel has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function webuzo_refund_and_cancel($key = '', $ip = '', $force = 0)
          {
              if (!empty($ip)) {
                  // Search for a license
                  $lic = $this->webuzo_licenses('', $ip);
      Severity: Minor
      Found in src/SoftaculousNOC.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

      Function virt_refund_and_cancel has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function virt_refund_and_cancel($key = '', $ip = '', $force = 0)
          {
              if (!empty($ip)) {
                  // Search for a license
                  $lic = $this->virt_licenses('', $ip);
      Severity: Minor
      Found in src/SoftaculousNOC.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 array2json has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function array2json($arr)
      {
          if (function_exists('json_encode')) {
              return json_encode($arr);
          } //Lastest versions of PHP already has this functionality.
      Severity: Minor
      Found in src/SoftaculousNOC.php - About 1 hr to fix

        Function webuzo_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function webuzo_list()
        {
            if ($GLOBALS['tf']->ima == 'admin') {
                $table = new \TFTable();
                $table->set_title('webuzo License List');
        Severity: Minor
        Found in src/webuzo_list.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 softaculous_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function softaculous_list()
        {
            if ($GLOBALS['tf']->ima == 'admin') {
                $table = new \TFTable();
                $table->set_title('Softaculous License List');
        Severity: Minor
        Found in src/softaculous_list.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 toArray has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function toArray($xml)
            {
                if (is_string($xml)) {
                    $xml = new SimpleXMLElement($xml);
                }
        Severity: Minor
        Found in src/SoftaculousNOC.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 toArray has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function toArray($xml)
            {
                if (is_string($xml)) {
                    $xml = new \SimpleXMLElement($xml);
                }
        Severity: Minor
        Found in src/ArrayToXML.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 toXML has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function toXML($data, $rootNodeName = 'ResultSet', $xml=null)
            {
        
                // turn off compatibility mode as simple xml throws a wobbly if you don't.
                if (ini_get('zend.ze1_compatibility_mode') == 1) {
        Severity: Minor
        Found in src/SoftaculousNOC.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 activate_webuzo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function activate_webuzo($ipAddress, $field = '', $email = '')
        {
            myadmin_log('softaculous', 'info', "activating webuzo({$ipAddress}, {$field}, {$email})", __LINE__, __FILE__);
            try {
                $noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(WEBUZO_USERNAME, WEBUZO_PASSWORD);
        Severity: Minor
        Found in src/activate_webuzo.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 activate_webuzo has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function activate_webuzo($ipAddress, $field = '', $email = '')
        {
            myadmin_log('softaculous', 'info', "activating webuzo({$ipAddress}, {$field}, {$email})", __LINE__, __FILE__);
            try {
                $noc = new \Detain\MyAdminSoftaculous\SoftaculousNOC(WEBUZO_USERNAME, WEBUZO_PASSWORD);
        Severity: Minor
        Found in src/activate_webuzo.php - About 1 hr to fix

          Function toXML has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function toXML($data, $rootNodeName = 'ResultSet', $xml = null)
              {
                  if (null === $xml) { //$xml = simplexml_load_string( "" );
                      $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
                  }
          Severity: Minor
          Found in src/ArrayToXML.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 req has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function req()
              {
                  $url = $this->softaculous.'?';
          
                  foreach ($this->params as $k => $v) {
          Severity: Minor
          Found in src/SoftaculousNOC.php - About 1 hr to fix

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

                public function buy($ip, $toadd, $servertype, $authemail, $autorenew, $buy_sitepad = 0)
            Severity: Minor
            Found in src/SoftaculousNOC.php - About 45 mins to fix

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

                  public function sitemush_licenses($key = '', $ip = '', $expiry = '', $start = 0, $len = 1000000, $email = '')
              Severity: Minor
              Found in src/SoftaculousNOC.php - About 45 mins to fix

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

                    public function webuzo_licenses($key = '', $ip = '', $expiry = '', $start = 0, $len = 1000000, $email = '')
                Severity: Minor
                Found in src/SoftaculousNOC.php - About 45 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language