Should I build a constructor with Setter? PHP [duplicate]

0

What is the best and safest way to build the builder?

Netbeans creates direct by changing the variable, but has how to use the setter. So what is the safest and best method? For example:

No setter

function __construct($nome, $idade, $sexo) {
        $this->nome = $nome;
        $this->idade = $idade;
        $this->sexo = $sexo;
    }

With setter

function __construct($nome, $idade, $sexo) {
        $this->setNome($nome);
        $this->setIdade($idade);
        $this->setSexo($sexo);
    }
    
asked by anonymous 07.07.2017 / 21:22

0 answers