Code Duplication    Length = 13-13 lines in 2 locations

core/db_models/EEM_Base.model.php 2 locations

@@ 984-996 (lines=13) @@
981
	 * @return EE_Base_Class | NULL
982
	 * @throws \EE_Error
983
	 */
984
	public function get_one($query_params = array()){
985
		if( ! is_array( $query_params ) ){
986
			EE_Error::doing_it_wrong('EEM_Base::get_one', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
987
			$query_params = array();
988
		}
989
		$query_params['limit'] = 1;
990
		$items = $this->get_all($query_params);
991
		if(empty($items)){
992
			return null;
993
		}else{
994
			return array_shift($items);
995
		}
996
	}
997
998
999
@@ 4633-4645 (lines=13) @@
4630
	 * @return EE_Base_Class
4631
	 * @throws \EE_Error
4632
	 */
4633
	public function get_one_copy($model_object_or_attributes_array,$query_params = array()){
4634
		if( ! is_array( $query_params ) ){
4635
			EE_Error::doing_it_wrong('EEM_Base::get_one_copy', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' );
4636
			$query_params = array();
4637
		}
4638
		$query_params['limit'] = 1;
4639
		$copies = $this->get_all_copies($model_object_or_attributes_array,$query_params);
4640
		if(is_array($copies)){
4641
			return array_shift($copies);
4642
		}else{
4643
			return null;
4644
		}
4645
	}
4646
4647
4648