Files
core/hwe/sammo/API/Command/RepeatCommand.php
T
Hide_D de5fe818e6 fix: phan 출력 결과에 따라 처리
- switch에 변수를 정하는 경우 default에 throw
- Util::getPost에 일부 타입 강제
- array인 일부 값들에 PHPDoc 타입 지정
- Enum에 toString이 없으므로 value값 지정
- 사용하지 않는 use function 제거
2022-05-09 00:06:41 +09:00

45 lines
964 B
PHP

<?php
namespace sammo\API\Command;
use sammo\Session;
use DateTimeInterface;
use sammo\Validator;
use function sammo\repeatGeneralCommand;
class RepeatCommand extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'amount',
])
->rule('integer', 'amount')
->rule('min', 'amount', 1)
->rule('max', 'amount', 12);
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$amount = $this->args['amount'];
repeatGeneralCommand($session->generalID, $amount);
return [
'result'=>true
];
}
}