GrafiteInc/FormMaker

View on GitHub

Showing 124 of 139 total issues

Method getOptions has 244 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected static function getOptions()
    {
        return [
            'options' => [
                'any' => 'Any',
Severity: Major
Found in src/Fields/Country.php - About 1 day to fix

    Method getOptions has 243 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function getOptions()
        {
            return [
                'options' => [
                    'Afghanistan' => 'AF',
    Severity: Major
    Found in src/Fields/Bootstrap/Country.php - About 1 day to fix

      FieldConfigProcessor has 65 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class FieldConfigProcessor
      {
          public $id;
          public $name;
          public $factory;
      Severity: Major
      Found in src/Services/FieldConfigProcessor.php - About 1 day to fix

        File FieldConfigProcessor.php has 475 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Grafite\Forms\Services;
        
        class FieldConfigProcessor
        Severity: Minor
        Found in src/Services/FieldConfigProcessor.php - About 7 hrs to fix

          File Quill.php has 453 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace Grafite\Forms\Fields;
          
          class Quill extends Field
          Severity: Minor
          Found in src/Fields/Quill.php - About 6 hrs to fix

            Method js has 168 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function js($id, $options)
                {
                    return <<<JS
                        _formsjs_quillField = function (element) {
                            element.addEventListener('grafite-form-change', function (event) {
            Severity: Major
            Found in src/Fields/Quill.php - About 6 hrs to fix

              Method validHtmlAttributes has 168 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function validHtmlAttributes()
                  {
                      return [
                          'accept',
                          'accept-charset',
              Severity: Major
              Found in src/Builders/AttributeBuilder.php - About 6 hrs to fix

                Method styles has 155 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function styles($id, $options)
                    {
                        $darkTheme = '';
                
                        if (! isset($options['theme']) || (is_bool($options['theme']) && $options['theme'])) {
                Severity: Major
                Found in src/Fields/Quill.php - About 6 hrs to fix

                  Method getOptions has 147 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected static function getOptions()
                      {
                          return [
                              'options' => [
                                  'Pacific/Midway',
                  Severity: Major
                  Found in src/Fields/Timezone.php - About 5 hrs to fix

                    Method getOptions has 147 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected static function getOptions()
                        {
                            return [
                                'options' => [
                                    '(UTC-11:00) Midway Island' => 'Pacific/Midway',
                    Severity: Major
                    Found in src/Fields/Bootstrap/Timezone.php - About 5 hrs to fix

                      Method js has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function js($id, $options)
                          {
                              return <<<JS
                                  _formsjs_autosuggestSelectField = function (inp) {
                                      if (! inp.getAttribute('data-formsjs-rendered')) {
                      Severity: Major
                      Found in src/Fields/AutoSuggestSelect.php - About 5 hrs to fix

                        Method js has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function js($id, $options)
                            {
                                return <<<JS
                                    _formsjs_tableActionBinding = function (element) {
                                        let _id = element.getAttribute('name');
                        Severity: Major
                        Found in src/Fields/Table.php - About 4 hrs to fix

                          Form has 35 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Form
                          {
                              use HasErrorBag;
                          
                              /**
                          Severity: Minor
                          Found in src/Forms/Form.php - About 4 hrs to fix

                            File Form.php has 349 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            
                            namespace Grafite\Forms\Forms;
                            
                            use Illuminate\Support\Arr;
                            Severity: Minor
                            Found in src/Forms/Form.php - About 4 hrs to fix

                              File FormMaker.php has 340 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              namespace Grafite\Forms\Services;
                              
                              use Illuminate\Support\Str;
                              Severity: Minor
                              Found in src/Services/FormMaker.php - About 4 hrs to fix

                                File FieldMaker.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                
                                namespace Grafite\Forms\Services;
                                
                                use Illuminate\Support\Str;
                                Severity: Minor
                                Found in src/Services/FieldMaker.php - About 4 hrs to fix

                                  File HtmlForm.php has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  
                                  namespace Grafite\Forms\Forms;
                                  
                                  use Exception;
                                  Severity: Minor
                                  Found in src/Forms/HtmlForm.php - About 3 hrs to fix

                                    Method scripts has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function scripts()
                                        {
                                            return <<<JS
                                    window.FormsJS_steps = function () {
                                        let _steps = document.querySelectorAll('.form_step');
                                    Severity: Major
                                    Found in src/Forms/WizardForm.php - About 3 hrs to fix

                                      Method js has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public static function js($id, $options)
                                          {
                                              return <<<JS
                                              _formsjs_bootstrapCustomSelectField = function (element) {
                                                  if (! element.getAttribute('data-formsjs-rendered')) {
                                      Severity: Major
                                      Found in src/Fields/Bootstrap/SimpleSelect.php - About 3 hrs to fix

                                        Function makeSelect has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            public function makeSelect($name, $selected, $options)
                                            {
                                                $selectOptions = '';
                                        
                                                if (isset($options['attributes']['value'])) {
                                        Severity: Minor
                                        Found in src/Builders/FieldBuilder.php - About 3 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language