civictechro/fiipregatit.ro

View on GitHub

Showing 29 of 53 total issues

Method _registerCustomMetaBox has 136 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function _registerCustomMetaBox() {
      $custom_boxes_init = function() {
        // Custom Guides meta box
        $cmb_guide = new_cmb2_box(array(
            'id'            => 'galerie_foto_ghiduri',
Severity: Major
Found in site/web/app/mu-plugins/fiipregatit-content.php - About 5 hrs to fix

    FirstAid has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class FirstAid extends Entity {
      private $arsuraCopii;
      private $apel112;
      private $intoxicatieAlcoolica;
      private $muscaturiAnimal;
    Severity: Minor
    Found in site/web/app/lib/Entity/FirstAid.php - About 3 hrs to fix

      Guide has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      final class Guide extends Entity {
        private $title;
        private $nume;
        private $inainteaEvenimentului;
        private $inTimpulEvenimentului;
      Severity: Minor
      Found in site/web/app/lib/Entity/Guide.php - About 3 hrs to fix

        PersonalPlan has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        final class PersonalPlan extends Entity {
          private $apa;
          private $alimente;
          private $imbracaminteSiIncaltaminte;
          private $sacDeDormit;
        Severity: Minor
        Found in site/web/app/lib/Entity/PersonalPlan.php - About 2 hrs to fix

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

            public function getPDFGuideSize(): ?string {
              if (!$this->guidePDF || !$this->guidePDF['url']) {
                return null;
              }
          
          
          Severity: Minor
          Found in site/web/app/lib/Entity/Guide.php - About 1 hr to fix

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

            var cssTasks = function(filename) {
              return lazypipe()
                .pipe(function() {
                  return gulpif(!enabled.failStyleTask, plumber());
                })
            Severity: Minor
            Found in site/web/app/themes/sage/gulpfile.js - About 1 hr to fix

              Method getPage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPage(): FirstAid {
                    return (new FirstAid($this->wpObject->ID))
                      ->setArsuraCopii(get_field('arsura_la_copii', $this->wpObject->ID))
                      ->setIntoxicatiaAlcoolica(
                        get_field('intoxicatia_alcoolica', $this->wpObject->ID)
              Severity: Minor
              Found in site/web/app/lib/CustomPage/FirstAidPage.php - About 1 hr to fix

                Method _registerCustomPostTypes has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function _registerCustomPostTypes() {
                      register_post_type(App::POST_TYPE_CAMPAIGN,
                        array(
                          'labels' => array(
                            'name' => __('Campanii'),
                Severity: Minor
                Found in site/web/app/mu-plugins/fiipregatit-content.php - About 1 hr to fix

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

                      public function getPage(): PersonalPlan {
                        return (new PersonalPlan($this->wpObject->ID))
                          ->setApa(get_field('apa', $this->wpObject->ID))
                          ->setAlimente(get_field('alimente', $this->wpObject->ID))
                          ->setImbracaminteSiIncaltaminte(
                  Severity: Minor
                  Found in site/web/app/lib/CustomPage/PersonalPlanPage.php - About 1 hr to fix

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

                        final public static function get(
                          ?WP_Post $post
                        ): MetaGenerator {
                          if (!$post) {
                            return new GenericMetaGenerator($post);
                    Severity: Minor
                    Found in site/web/app/themes/sage/lib/Meta/MetaGenerator.php - About 1 hr to fix

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

                          final public function getAll(): array {
                            $all_tags = array();
                      
                            $custom_tags = $this->copyAllCommonTags($this->getCustomTags());
                            $default_tags = $this->getDefaultTags();
                      Severity: Minor
                      Found in site/web/app/themes/sage/lib/Meta/MetaGenerator.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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function render(): void {
                            $handler = opendir($this->guidePath);
                      
                            $custom_css = $this->customCSS();
                            add_action(
                      Severity: Minor
                      Found in site/web/app/themes/sage/lib/DashboardGuides.php - About 1 hr to fix

                        Method get has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            final public static function get(
                              WP_Post $post,
                              array $attributes = array()
                            ): IndexCustomFields {
                              switch ($post->post_type) {
                        Severity: Minor
                        Found in site/web/app/themes/sage/lib/Algolia/IndexCustomFields.php - About 1 hr to fix

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

                          function title() {
                            if (is_home()) {
                              if (get_option('page_for_posts', true)) {
                                return get_the_title(get_option('page_for_posts', true));
                              } else {
                          Severity: Minor
                          Found in site/web/app/themes/sage/lib/titles.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function render(): void {
                                $handler = opendir($this->guidePath);
                          
                                $custom_css = $this->customCSS();
                                add_action(
                          Severity: Minor
                          Found in site/web/app/themes/sage/lib/DashboardGuides.php - About 35 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

                          Avoid too many return statements within this method.
                          Open

                                    return new PersonalPlanMetaGenerator(
                                      $post,
                                      \CustomPageManager::getPersonalPlanPage()->getPage()
                                    );
                          Severity: Major
                          Found in site/web/app/themes/sage/lib/Meta/MetaGenerator.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return get_the_title();
                            Severity: Major
                            Found in site/web/app/themes/sage/lib/titles.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                  return __('Not Found', 'sage');
                              Severity: Major
                              Found in site/web/app/themes/sage/lib/titles.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                          return new AboutMetaGenerator(
                                            $post,
                                            \CustomPageManager::getAboutPage()->getPage()
                                          );
                                Severity: Major
                                Found in site/web/app/themes/sage/lib/Meta/MetaGenerator.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                            return new AboutIndexCustomFields(
                                              $attributes,
                                              \CustomPageManager::getAboutPage()->getPage()
                                            );
                                  Severity: Major
                                  Found in site/web/app/themes/sage/lib/Algolia/IndexCustomFields.php - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language