taviroquai/duality

View on GitHub

Showing 30 of 38 total issues

Database has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Database
extends AbstractService
{
    /**
     * Holds the PDO handler
Severity: Minor
Found in src/Duality/Service/Database.php - About 2 hrs to fix

    App has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class App 
    extends Container
    {
        /**
         * Holds application working directory
    Severity: Minor
    Found in src/Duality/App.php - About 2 hrs to fix

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

      class Server
      extends AbstractService
      implements InterfaceServer
      {
          /**
      Severity: Minor
      Found in src/Duality/Service/Server.php - About 2 hrs to fix

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

            public function listen()
            {
                // Set default values
                $result = false;
                $matches = array();
        Severity: Minor
        Found in src/Duality/Service/Server.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 getRequestFromGlobals has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getRequestFromGlobals($server, $params)
            {
                if (empty($server['REQUEST_METHOD'])) {
                    return false;
                }
        Severity: Major
        Found in src/Duality/Service/Server.php - About 2 hrs to fix

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

              public function seedFromConfig()
              {
                  // Begin transation
                  $this->pdo->beginTransaction();
          
          
          Severity: Minor
          Found in src/Duality/Service/Database.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 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function send(\Closure $callback)
              {
                  $mail = new PHPMailer;
          
                  // Setup SMTP
          Severity: Minor
          Found in src/Duality/Service/Mailer.php - About 1 hr to fix

            Method connect has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function connect($host, $username, $password = '', $port = 22)
                {
                    // Start connection
                    if (!($this->connection = @ssh2_connect($host, $port))) {
                        throw new DualityException(
            Severity: Minor
            Found in src/Duality/Service/SSH.php - About 1 hr to fix

              Method listen has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function listen()
                  {
                      // Set default values
                      $result = false;
                      $matches = array();
              Severity: Minor
              Found in src/Duality/Service/Server.php - About 1 hr to fix

                Method init has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function init()
                    {
                        if (!extension_loaded('intl')) {
                            throw new DualityException(
                                "Error: intl extension not loaded",
                Severity: Minor
                Found in src/Duality/Service/Localization.php - About 1 hr to fix

                  Method init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function init()
                      {
                          $this->pretend = false;
                          $this->current = new Storage;
                          $this->smtp = new Storage;
                  Severity: Minor
                  Found in src/Duality/Service/Mailer.php - About 1 hr to fix

                    Method setLocale has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function setLocale($code, $timezone = 'Europe/Lisbon')
                        {
                            $this->current = \Locale::canonicalize($code);
                    
                            // Validate locale and translations directory
                    Severity: Minor
                    Found in src/Duality/Service/Localization.php - About 1 hr to fix

                      Method execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function execute(Request &$request)
                          {
                              $this->init();
                              $header = array();
                              $reqHeaders = $request->getHeaders(); 
                      Severity: Minor
                      Found in src/Duality/Service/Client.php - About 1 hr to fix

                        Function updateFromConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function updateFromConfig()
                            {
                                // Begin transation
                                $this->pdo->beginTransaction();
                        
                        
                        Severity: Minor
                        Found in src/Duality/Service/Database.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 connect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function connect($host, $username, $password = '', $port = 22)
                            {
                                // Start connection
                                if (!($this->connection = @ssh2_connect($host, $port))) {
                                    throw new DualityException(
                        Severity: Minor
                        Found in src/Duality/Service/SSH.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

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

                                $fields, $from, $where = '', $groupby = '', $limit = 0, $offset = 0
                        Severity: Minor
                        Found in src/Duality/Service/Database/MySql.php - About 45 mins to fix

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

                                  $host, $user = '', $pass = '', $encr = 'tls', $port = 587, $debugLevel = 0
                          Severity: Minor
                          Found in src/Duality/Service/Mailer.php - About 45 mins to fix

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

                                    $host,
                                    $username,
                                    $password = '',
                                    $port = 22,
                                    $paraphrase = null,
                            Severity: Minor
                            Found in src/Duality/Service/SSH.php - About 45 mins to fix

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

                                      $fields, $from, $where = '', $groupby = '', $limit = 0, $offset = 0
                              Severity: Minor
                              Found in src/Duality/Service/Database/SQLite.php - About 45 mins to fix

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

                                    public function send(\Closure $callback)
                                    {
                                        $mail = new PHPMailer;
                                
                                        // Setup SMTP
                                Severity: Minor
                                Found in src/Duality/Service/Mailer.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

                                Severity
                                Category
                                Status
                                Source
                                Language