Code Duplication    Length = 15-15 lines in 2 locations

core/db_models/EEM_Base.model.php 2 locations

@@ 1239-1253 (lines=15) @@
1236
     * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL
1237
     * @throws EE_Error
1238
     */
1239
    public function get_one($query_params = array())
1240
    {
1241
        if (! is_array($query_params)) {
1242
            EE_Error::doing_it_wrong('EEM_Base::get_one',
1243
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
1244
                    gettype($query_params)), '4.6.0');
1245
            $query_params = array();
1246
        }
1247
        $query_params['limit'] = 1;
1248
        $items = $this->get_all($query_params);
1249
        if (empty($items)) {
1250
            return null;
1251
        }
1252
        return array_shift($items);
1253
    }
1254
1255
1256
@@ 5644-5658 (lines=15) @@
5641
     * @return EE_Base_Class
5642
     * @throws EE_Error
5643
     */
5644
    public function get_one_copy($model_object_or_attributes_array, $query_params = array())
5645
    {
5646
        if (! is_array($query_params)) {
5647
            EE_Error::doing_it_wrong('EEM_Base::get_one_copy',
5648
                sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'),
5649
                    gettype($query_params)), '4.6.0');
5650
            $query_params = array();
5651
        }
5652
        $query_params['limit'] = 1;
5653
        $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params);
5654
        if (is_array($copies)) {
5655
            return array_shift($copies);
5656
        }
5657
        return null;
5658
    }
5659
5660
5661