public function checkRequired(array $arr){
        //Filter out null values
        $filtered = $this->filterNull($arr);
        
        if(isset($this->required_trans))
            throw new MissingRequiredFieldsException;
        
        //check if all required fields are present
        return count(array_intersect_key(array_flip($this->required_trans), $filtered)) === count($this->required_trans);
    }
public function checkRequired(array $arr){
        //Filter out null values
        $filtered = $this->filterNull($arr);
        
        if(isset($this->required_trans))
            throw new MissingRequiredFieldsException;
        
        //check if all required fields are present
        return count(array_intersect_key(array_flip($this->required_trans), $filtered)) === count($this->required_trans);
    }
public function checkRequired ( array $ arr ) { //Filter out null values $ filtered = $ this -> filterNull ( $ arr ) ; if ( isset ( $ this -> required_trans ) ) throw new MissingRequiredFieldsException ; //check if all required fields are present return count ( array_intersect_key ( array_flip ( $ this -> required_trans ) , $ filtered ) ) === count ( $ this -> required_trans ) ; }
If you set the required fields in your service class
you can check if these fields were set.
@param array $arr
@return bool
If you set the required fields in your service class you can check if these fields were set .