Code Duplication    Length = 13-13 lines in 2 locations

core/db_models/EEM_Base.model.php 2 locations

@@ 1208-1220 (lines=13) @@
1205
     * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL
1206
     * @throws \EE_Error
1207
     */
1208
    public function get_one($query_params = array())
1209
    {
1210
        if (! is_array($query_params)) {
1211
            EE_Error::doing_it_wrong('EEM_Base::get_one',
1212
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
1213
                    gettype($query_params)), '4.6.0');
1214
            $query_params = array();
1215
        }
1216
        $query_params['limit'] = 1;
1217
        $items = $this->get_all($query_params);
1218
        if (empty($items)) {
1219
            return null;
1220
        } else {
1221
            return array_shift($items);
1222
        }
1223
    }
@@ 5558-5570 (lines=13) @@
5555
     * @return EE_Base_Class
5556
     * @throws \EE_Error
5557
     */
5558
    public function get_one_copy($model_object_or_attributes_array, $query_params = array())
5559
    {
5560
        if (! is_array($query_params)) {
5561
            EE_Error::doing_it_wrong('EEM_Base::get_one_copy',
5562
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
5563
                    gettype($query_params)), '4.6.0');
5564
            $query_params = array();
5565
        }
5566
        $query_params['limit'] = 1;
5567
        $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params);
5568
        if (is_array($copies)) {
5569
            return array_shift($copies);
5570
        } else {
5571
            return null;
5572
        }
5573
    }