I've a function which i think can be improved, the code is pretty naive.
public function isValid($data)
{
$valid = true;
$valid = parent::isValid($data) && $valid;
$this->_errorsExist = !$valid;
return $valid;
}
The parent::isValid($data) will also return boolean.
I corrected it by removing the $valid in && condition.
public function isValid($data)
{
$valid = true;
$valid = parent::isValid($data);
$this->_errorsExist = !$valid;
return $valid;
}
But i think this still can be improved. Any suggestions would greatly be appreciated.
Aucun commentaire:
Enregistrer un commentaire