travi/php-framework

View on GitHub

Showing 140 of 176 total issues

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

abstract class Field extends ContentObject implements FormElement
{
    protected $validations = array();
    protected $name;
    protected $label;
Severity: Minor
Found in php/framework/src/travi/framework/components/Forms/Field.php - About 2 hrs to fix

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

        function upload($isImage=false)
        {
            if ($this->acceptedMimetype($this->mimetype)) {
                $this->checkDirectory();
    
    
    Severity: Major
    Found in php/framework/objects/utility/upload.class.php - About 2 hrs to fix

      Method createFeed has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function createFeed() {
              $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
              $feed.= $this->_createGeneratorComment();
              $feed.= $this->_createStylesheetReferences();
              $feed.= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
      Severity: Major
      Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 2 hrs to fix

        Method createPreview has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function createPreview($newHeight,$newWidth)
            {
                if (empty($newHeight) && empty($newWidth)) {
                    $newHeight = 275;
                    $newWidth = 250;
        Severity: Minor
        Found in php/framework/objects/utility/upload.class.php - About 2 hrs to fix

          Method _prepare_post_body has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _prepare_post_body($formvars, $formfiles)
              {
                  settype($formvars, "array");
                  settype($formfiles, "array");
          
          Severity: Minor
          Found in php/thirdparty/Snoopy/Snoopy.class.php - About 2 hrs to fix

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

                function createFeed() {
                    $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
                    $feed.= $this->_createGeneratorComment();
                    $feed.= $this->_createStylesheetReferences();
                    $feed.= "<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\"";
            Severity: Minor
            Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

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

                  function _setFormat($format) {
                      switch (strtoupper($format)) {
                          
                          case "2.0":
                              // fall through
              Severity: Minor
              Found in php/thirdparty/FeedCreator/include/feedcreator.class.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 _setFormat has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function _setFormat($format) {
                      switch (strtoupper($format)) {
                          
                          case "2.0":
                              // fall through
              Severity: Minor
              Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

                Function _set_navigation has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function _set_navigation() {
                            $('#lightbox-nav').show();
                
                            // Instead to define this configuration in CSS file, we define here. And it�s need to IE. Just.
                            $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
                Severity: Minor
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

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

                      private function setVideoVersions($video, $entry, $namespaces)
                      {
                          $ns_media = $entry->children($namespaces['media']);
                  
                          $versions = $ns_media->group->content;

                  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 __toString has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __toString()
                      {
                          $hour = substr($this->getValue(), 0, 2);
                          if ($hour >= 12) {
                              $ampm = 'pm';
                  Severity: Minor
                  Found in php/framework/objects/travi/framework/content/form.class.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 FeedDate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function FeedDate($dateString="") {
                          if ($dateString=="") $dateString = date("r");
                          
                          if (is_numeric($dateString)) {
                              $this->unix = $dateString;
                  Severity: Minor
                  Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

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

                        function createFeed() {
                            $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n";
                            $feed.= $this->_createGeneratorComment();
                            $feed.= $this->_createStylesheetReferences();
                            $feed.= "<feed xmlns=\"http://www.w3.org/2005/Atom\"";
                    Severity: Minor
                    Found in php/thirdparty/FeedCreator/include/feedcreator.class.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 objectToArray has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function objectToArray($item)
                        {
                            if (is_object($item)) {
                                $itemResult = array();
                                $ref        = new \ReflectionClass($item);
                    Severity: Minor
                    Found in php/framework/src/travi/framework/view/render/Renderer.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 client_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function client_data(info) {
                        if (info == 'width') {
                            width = (screen.width) ? screen.width : '';
                            height = (screen.height) ? screen.height : '';
                            width_height_html = width + " x " + height + " pixels";
                    Severity: Minor
                    Found in client/thirdparty/techPatterns/client_data.js - 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 ___getPageSize has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function ___getPageSize() {
                                var xScroll, yScroll;
                                if (window.innerHeight && window.scrollMaxY) {
                                    xScroll = window.innerWidth + window.scrollMaxX;
                                    yScroll = window.innerHeight + window.scrollMaxY;
                    Severity: Minor
                    Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

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

                          function _setMIME($format) {
                              switch (strtoupper($format)) {
                                  
                                  case "2.0":
                                      // fall through
                      Severity: Minor
                      Found in php/thirdparty/FeedCreator/include/feedcreator.class.php - About 1 hr to fix

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

                            function _connect(&$fp)
                            {
                                if(!empty($this->proxy_host) && !empty($this->proxy_port))
                                    {
                                        $this->_isproxy = true;
                        Severity: Minor
                        Found in php/thirdparty/Snoopy/Snoopy.class.php - About 1 hr to fix

                          Function _resize_container_image_box has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function _resize_container_image_box(intImageWidth,intImageHeight) {
                                      // Get current width and height
                                      var intCurrentWidth = $('#lightbox-container-image-box').width();
                                      var intCurrentHeight = $('#lightbox-container-image-box').height();
                                      //Adjust the image size to fit within the viewport
                          Severity: Minor
                          Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

                            Function qp_enc has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                function qp_enc($input = "", $line_max = 76) { 
                                    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); 
                                    $lines = preg_split("/(?:\r\n|\r|\n)/", $input); 
                                    $eol = "\r\n"; 
                                    $escape = "="; 
                            Severity: Minor
                            Found in php/thirdparty/FeedCreator/include/feedcreator.class.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

                            Severity
                            Category
                            Status
                            Source
                            Language