Acceptable default parameter in PHP function

0

In the example:

public function getEstoqueDeposito($busca, $deposito = FALSE) {
    ...
}

I know what I could do:

public function getEstoqueDeposito($busca, $deposito = FALSE) {
    if($busca == 'TOTAL'){
        ...
        return "whatever";
    } else if($busca == 'GRUPO'){
        ...
        return "whatever";
    } 
    return "Parâmetro inválido";
}

Finally, I would like to pre-define the values (TOTAL or GROUP) in the $ search parameter, in PHP, have any way to do this without having to test inside the function?

    
asked by anonymous 01.02.2018 / 11:05

0 answers