Code Duplication    Length = 8-14 lines in 5 locations

core/db_models/fields/EE_Model_Field_Base.php 2 locations

@@ 617-625 (lines=9) @@
614
            return;
615
        }
616
617
        if (! isset($allowable_types[ $type ])) {
618
            throw new InvalidArgumentException(
619
                sprintf(
620
                    esc_html__('The incoming argument (%1$s) must be one of the allowable types: %2$s', 'event_espresso'),
621
                    $type,
622
                    implode(',', array_flip($allowable_types))
623
                )
624
            );
625
        }
626
    }
627
628
@@ 659-667 (lines=9) @@
656
            )
657
        );
658
659
        if (! isset($allowable_formats[ $format ])) {
660
            throw new InvalidArgumentException(
661
                sprintf(
662
                    esc_html__('The incoming argument (%1$s) must be one of the allowable formats: %2$s', 'event_espresso'),
663
                    $format,
664
                    implode(',', array_flip($allowable_formats))
665
                )
666
            );
667
        }
668
    }
669
}
670

core/domain/values/model/CustomSelects.php 1 location

@@ 213-226 (lines=14) @@
210
        $data_type = $this->type === self::TYPE_COMPLEX ? $select_parts[1] : '';
211
        $data_type = $this->type === self::TYPE_STRUCTURED ? $select_parts[2] : $data_type;
212
213
        if (! in_array($data_type, $valid_data_types, true)) {
214
            throw new InvalidArgumentException(
215
                sprintf(
216
                    esc_html__(
217
                        'Datatype %1$s (for selection "%2$s" and alias "%3$s") is not a valid wpdb datatype (eg %%s)',
218
                        'event_espresso'
219
                    ),
220
                    $data_type,
221
                    $select_parts[0],
222
                    $alias,
223
                    implode(', ', $valid_data_types)
224
                )
225
            );
226
        }
227
    }
228
229

core/domain/values/Version.php 1 location

@@ 217-228 (lines=12) @@
214
            Version::RELEASE_TYPE_DECAF,
215
            Version::RELEASE_TYPE_PROD,
216
        );
217
        if (! in_array($release, $valid_release_types, true)) {
218
            throw new InvalidArgumentException(
219
                sprintf(
220
                    esc_html__(
221
                        '"%1$s" is not a valid release type. Please use one of the following values: %2$s',
222
                        'event_espresso'
223
                    ),
224
                    $release,
225
                    implode(', ', $valid_release_types)
226
                )
227
            );
228
        }
229
        $this->release = $release;
230
    }
231

core/domain/values/assets/BrowserAsset.php 1 location

@@ 128-135 (lines=8) @@
125
    private function validateAttribute($attribute)
126
    {
127
        $allowed = BrowserAsset::$allowed_attributes[ $this->type() ];
128
        if (! in_array($attribute, $allowed, true)) {
129
            throw new DomainException(
130
                sprintf(
131
                    esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'),
132
                    implode('", "', $allowed)
133
                )
134
            );
135
        }
136
        return true;
137
    }
138