Code Duplication    Length = 15-15 lines in 2 locations

core/db_models/EEM_Base.model.php 2 locations

@@ 5618-5632 (lines=15) @@
5615
     * @return EE_Base_Class
5616
     * @throws EE_Error
5617
     */
5618
    public function get_one_copy($model_object_or_attributes_array, $query_params = array())
5619
    {
5620
        if (! is_array($query_params)) {
5621
            EE_Error::doing_it_wrong('EEM_Base::get_one_copy',
5622
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
5623
                    gettype($query_params)), '4.6.0');
5624
            $query_params = array();
5625
        }
5626
        $query_params['limit'] = 1;
5627
        $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params);
5628
        if (is_array($copies)) {
5629
            return array_shift($copies);
5630
        }
5631
        return null;
5632
    }
5633
5634
5635
@@ 1214-1228 (lines=15) @@
1211
     * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL
1212
     * @throws EE_Error
1213
     */
1214
    public function get_one($query_params = array())
1215
    {
1216
        if (! is_array($query_params)) {
1217
            EE_Error::doing_it_wrong('EEM_Base::get_one',
1218
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
1219
                    gettype($query_params)), '4.6.0');
1220
            $query_params = array();
1221
        }
1222
        $query_params['limit'] = 1;
1223
        $items = $this->get_all($query_params);
1224
        if (empty($items)) {
1225
            return null;
1226
        }
1227
        return array_shift($items);
1228
    }
1229
1230
1231