attogram/attogram

View on GitHub

Showing 51 of 308 total issues

File Attogram.php has 680 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// Attogram Framework - Attogram class v0.5.6

namespace Attogram;

Severity: Major
Found in Attogram/Attogram.php - About 1 day to fix

    Function checkHtaccess has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkHtaccess()
        {
            $htaccessFile = './.htaccess';
            file_exists($htaccessFile) ? $result = 'pass' : $result = 'fail';
            echo '<pre class="'.$result.'">'.$this->{$result}.' 2.0 - <strong>'
    Severity: Minor
    Found in public/check.php - About 1 day 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 checkHtaccess has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function checkHtaccess()
        {
            $htaccessFile = './.htaccess';
            file_exists($htaccessFile) ? $result = 'pass' : $result = 'fail';
            echo '<pre class="'.$result.'">'.$this->{$result}.' 2.0 - <strong>'
    Severity: Major
    Found in public/check.php - About 4 hrs to fix

      Attogram has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Attogram
      {
          const ATTOGRAM_VERSION = '0.8.2';
      
          public $startTime;          // (float) microsecond time of awakening
      Severity: Minor
      Found in Attogram/Attogram.php - About 3 hrs to fix

        File check.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        // Attogram Framework - Check Script v0.1.11
        
        namespace Attogram;
        
        
        Severity: Minor
        Found in public/check.php - About 3 hrs to fix

          File index.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          // Attogram Framework - Guru Meditation Loader - v0.6.0
          
          namespace Attogram;
          
          
          Severity: Minor
          Found in public/index.php - About 3 hrs to fix

            Method guruMeditationErrorHandler has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function guruMeditationErrorHandler(
                    $level,
                    $message,
                    $file = '',
                    $line = '',
            Severity: Major
            Found in public/index.php - About 2 hrs to fix

              Method awaken has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function awaken()
                  {
                      // The Site Administrator IP addresses
                      $this->remember(
                          'admins',
              Severity: Major
              Found in Attogram/Attogram.php - About 2 hrs to fix

                Method checkApache has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function checkApache()
                    {
                        isset($_SERVER['SERVER_SOFTWARE'])
                            ? $serverSoftware = $_SERVER['SERVER_SOFTWARE'] : $serverSoftware = '';
                        $serverSoftwareArray = explode(' ', $serverSoftware);
                Severity: Minor
                Found in public/check.php - About 1 hr to fix

                  Function getMimeType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getMimeType($file)
                      {
                          $mimeType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $file);
                          switch (pathinfo($file, PATHINFO_EXTENSION)) { // https://bugs.php.net/bug.php?id=53035
                              case 'html':
                  Severity: Minor
                  Found in Attogram/Attogram.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 getMimeType has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getMimeType($file)
                      {
                          $mimeType = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $file);
                          switch (pathinfo($file, PATHINFO_EXTENSION)) { // https://bugs.php.net/bug.php?id=53035
                              case 'html':
                  Severity: Minor
                  Found in Attogram/Attogram.php - About 1 hr to fix

                    Method tranquility has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function tranquility()
                        {
                            // Speed things up! gz compession
                            //if (ob_start('ob_gzhandler')) {
                            //    $this->debug('tranquility: ob_gzhandler active');
                    Severity: Minor
                    Found in public/index.php - About 1 hr to fix

                      Method route has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function route()
                          {
                              if (is_dir($this->uri[0])) {  // requesting a directory?
                                  $this->log->error('ROUTE: 403 Action Forbidden');
                                  $this->error404('No spelunking allowed');
                      Severity: Minor
                      Found in Attogram/Attogram.php - About 1 hr to fix

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

                            public function apacheConfExamine($conf)
                            {
                                $thisDir = '';
                                $allowOverride = array();
                                $file = new SplFileObject($conf);
                        Severity: Minor
                        Found in public/check.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 defaultHomepage has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function defaultHomepage()
                            {
                                $this->log->error('using defaultHomepage');
                                $this->pageHeader('Home');
                                echo '<div class="container">'
                        Severity: Minor
                        Found in Attogram/Attogram.php - About 1 hr to fix

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

                              public function virtualWebDirectory()
                              {
                                  if (!preg_match('/^\/'.'web'.'\//', $this->request->getPathInfo())) {
                                      return; // not a virtual web directory request
                                  }
                          Severity: Minor
                          Found in Attogram/Attogram.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 route has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function route()
                              {
                                  if (is_dir($this->uri[0])) {  // requesting a directory?
                                      $this->log->error('ROUTE: 403 Action Forbidden');
                                      $this->error404('No spelunking allowed');
                          Severity: Minor
                          Found in Attogram/Attogram.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 virtualWebDirectory has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function virtualWebDirectory()
                              {
                                  if (!preg_match('/^\/'.'web'.'\//', $this->request->getPathInfo())) {
                                      return; // not a virtual web directory request
                                  }
                          Severity: Minor
                          Found in Attogram/Attogram.php - About 1 hr to fix

                            Method meditate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function meditate()
                                {
                                    // Set default configuration
                                    $this->config = array();
                                    $this->config['attogramDirectory']  = '..'.DIRECTORY_SEPARATOR;
                            Severity: Minor
                            Found in public/index.php - About 1 hr to fix

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

                                  public function testNullDatabase()
                                  {
                                      $nullDatabase = new \Attogram\NullDatabase;
                                      $this->assertFalse(
                                          $nullDatabase->initDB(),
                              Severity: Minor
                              Found in tests/AttogramTest.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language