/** * @param string $classes * * @return AbstractHtmlElement */ public function addCssClasses($classes) { $addedClasses = ' '; if ($this->attributes->exists('class')) { $addedClasses .= Type::string($this->attributes->get('class')); } $this->attributes->add(['class' => $classes . $addedClasses]); return $this; }
/** * @param string $name * @param string $password * @return Result */ public function login($name, $password) { $result = new Result(); $name = Type::string($name); $password = Type::string($password); if ($this->isLoggedIn()) { $result->addValue($this->session->get('user_id')); return $result; } $user = $this->users->getUserByLoginData($name, $password); if ($user) { $this->session->set('user_id', $user->getId()); $result->addValue($user->getId()); } else { $result->addError(L10n::msgReplace('%s is a invalid user or wrong password.', $name)); } return $result; }
/** * @param string $name * @param string $value * * @return string */ private function renderField($name, $value) { if (trim($value) !== '') { if (Type::isInt($name)) { return " {$value}"; } else { return " {$name}=\"{$value}\""; } } return ''; }
/** * @param int $status * * @return Response */ public function setStatus($status) { $this->status = Type::int($status); return $this; }