findById($id); if (!$group) { throw new BadRequestException('im_friend_group.not_found'); } return $group; } public function checkName($name) { $value = $this->filter->sanitize($name, ['trim', 'string']); $length = kg_strlen($value); if ($length < 2) { throw new BadRequestException('im_friend_group.name_too_short'); } if ($length > 15) { throw new BadRequestException('im_friend_group.name_too_long'); } return $value; } }