I'm trying to find a way to make my code easeier to read, so i found that major part of the code is validation trough if, ifelse:
if (!$this -> is_valid_username($username)) {
$this -> Session -> setFlash('Enter valid client username, Error 1.', 'default', array(), 'errorlogaddclient');
$this -> redirect('/dashboard/settings');
exit ;
}
if (!$this -> is_valid_password($password) || !$this -> is_valid_defpass($password)) {
$this -> Session -> setFlash('Enter valid password, Error 2.', 'default', array(), 'errorlogaddclient');
$this -> redirect('/dashboard/settings');
exit ;
}
if ($this -> is_already_client($user)) {
$this -> Session -> setFlash("User is already someone's client, Error 3", 'default', array(), 'errorlogaddclient');
$this -> redirect('/dashboard/settings');
exit ;
}//ect
so what is proper/better way to do this
if (!$this->User->validates()) { ...
\$\endgroup\$ – AD7six Nov 6 '15 at 9:59