Code Duplication    Length = 4-15 lines in 3 locations

core/db_models/EEM_Base.model.php 3 locations

@@ 3885-3898 (lines=14) @@
3882
        $allow_fields = in_array($query_param_type, array('where', 'having', 'order_by', 'group_by', 'order'));
3883
        //check to see if we have a field on this model
3884
        $this_model_fields = $this->field_settings(true);
3885
        if (array_key_exists($query_param, $this_model_fields)) {
3886
            if ($allow_fields) {
3887
                return;
3888
            }
3889
            throw new EE_Error(
3890
                sprintf(
3891
                    __(
3892
                        "Using a field name (%s) on model %s is not allowed on this query param type '%s'. Original query param was %s",
3893
                        "event_espresso"
3894
                    ),
3895
                    $query_param, get_class($this), $query_param_type, $original_query_param
3896
                )
3897
            );
3898
        }
3899
        //check if this is a special logic query param
3900
        if (in_array($query_param, $this->_logic_query_param_keys, true)) {
3901
            if ($allow_logic_query_params) {
@@ 4253-4267 (lines=15) @@
4250
            $cleaned_value = $this->_construct_between_value($value, $field_obj);
4251
            return $operator . SP . $cleaned_value;
4252
        }
4253
        if (in_array($operator, $this->_null_style_operators)) {
4254
            if ($value !== null) {
4255
                throw new EE_Error(
4256
                    sprintf(
4257
                        __(
4258
                            "You attempted to give a value  (%s) while using a NULL-style operator (%s). That isn't valid",
4259
                            "event_espresso"
4260
                        ),
4261
                        $value,
4262
                        $operator
4263
                    )
4264
                );
4265
            }
4266
            return $operator;
4267
        }
4268
        if ($operator === 'LIKE' && ! is_array($value)) {
4269
            //if the operator is 'LIKE', we want to allow percent signs (%) and not
4270
            //remove other junk. So just treat it as a string.
@@ 5099-5102 (lines=4) @@
5096
    public function add_to_entity_map(EE_Base_Class $object)
5097
    {
5098
        $className = $this->_get_class_name();
5099
        if (! $object instanceof $className) {
5100
            throw new EE_Error(sprintf(__("You tried adding a %s to a mapping of %ss", "event_espresso"),
5101
                is_object($object) ? get_class($object) : $object, $className));
5102
        }
5103
        /** @var $object EE_Base_Class */
5104
        if (! $object->ID()) {
5105
            throw new EE_Error(sprintf(__("You tried storing a model object with NO ID in the %s entity mapper.",