"Username or password is required."); } $authData = $this->domainLogin($username, $password); if($authData) { return $authData; } return array("error" => "Username or password is invalid."); } private function domainLogin($username, $password) { return (new Authorize())->login($username, $password); } }