|
@@ -22,9 +22,15 @@ class Manager extends ManagerModel
|
|
|
|
|
|
/**
|
|
|
* Получает пользователя по id
|
|
|
+ *
|
|
|
+ * @throws InvalidArgumentException
|
|
|
*/
|
|
|
public function load(int $id): ?User
|
|
|
{
|
|
|
+ if ($id < 1) {
|
|
|
+ throw new InvalidArgumentException('Expected id > 0');
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->isset($id)) {
|
|
|
return $this->get($id);
|
|
|
} else {
|
|
@@ -36,6 +42,8 @@ class Manager extends ManagerModel
|
|
|
|
|
|
/**
|
|
|
* Получает массив пользователей по ids
|
|
|
+ *
|
|
|
+ * @throws InvalidArgumentException
|
|
|
*/
|
|
|
public function loadByIds(array $ids): array
|
|
|
{
|
|
@@ -44,7 +52,7 @@ class Manager extends ManagerModel
|
|
|
|
|
|
foreach ($ids as $id) {
|
|
|
if (! \is_int($id) || $id < 1) {
|
|
|
- throw new InvalidArgumentException('Expected a positive integer');
|
|
|
+ throw new InvalidArgumentException('Expected id > 0');
|
|
|
}
|
|
|
if ($this->isset($id)) {
|
|
|
$result[$id] = $this->get($id);
|