Code Duplication    Length = 15-15 lines in 2 locations

core/db_models/EEM_Base.model.php 2 locations

@@ 1225-1239 (lines=15) @@
1222
     * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL
1223
     * @throws EE_Error
1224
     */
1225
    public function get_one($query_params = array())
1226
    {
1227
        if (! is_array($query_params)) {
1228
            EE_Error::doing_it_wrong('EEM_Base::get_one',
1229
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
1230
                    gettype($query_params)), '4.6.0');
1231
            $query_params = array();
1232
        }
1233
        $query_params['limit'] = 1;
1234
        $items = $this->get_all($query_params);
1235
        if (empty($items)) {
1236
            return null;
1237
        }
1238
        return array_shift($items);
1239
    }
1240
1241
1242
@@ 5630-5644 (lines=15) @@
5627
     * @return EE_Base_Class
5628
     * @throws EE_Error
5629
     */
5630
    public function get_one_copy($model_object_or_attributes_array, $query_params = array())
5631
    {
5632
        if (! is_array($query_params)) {
5633
            EE_Error::doing_it_wrong('EEM_Base::get_one_copy',
5634
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
5635
                    gettype($query_params)), '4.6.0');
5636
            $query_params = array();
5637
        }
5638
        $query_params['limit'] = 1;
5639
        $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params);
5640
        if (is_array($copies)) {
5641
            return array_shift($copies);
5642
        }
5643
        return null;
5644
    }
5645
5646
5647