argTest를 로직 순서에 맞게 변경
This commit is contained in:
@@ -24,6 +24,29 @@ use \sammo\Constraint\Constraint;
|
||||
class che_헌납 extends Command\GeneralCommand{
|
||||
static protected $actionName = '헌납';
|
||||
|
||||
protected function argTest():bool{
|
||||
if(!key_exists('isGold', $this->arg)){
|
||||
return false;
|
||||
}
|
||||
if(!key_exists('amount', $this->arg)){
|
||||
return false;
|
||||
}
|
||||
$isGold = $this->arg['isGold'];
|
||||
$amount = $this->arg['amount'];
|
||||
if(!is_int($amount)){
|
||||
return false;
|
||||
}
|
||||
$amount = Util::valueFit($amount, 100, 10000);
|
||||
if(!is_bool($isGold)){
|
||||
return false;
|
||||
}
|
||||
$this->arg = [
|
||||
'isGold'=>$isGold,
|
||||
'amount'=>$amount
|
||||
];
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function init(){
|
||||
|
||||
$general = $this->generalObj;
|
||||
@@ -45,35 +68,6 @@ class che_헌납 extends Command\GeneralCommand{
|
||||
|
||||
}
|
||||
|
||||
protected function argTest():bool{
|
||||
if(!key_exists('isGold', $this->arg)){
|
||||
return false;
|
||||
}
|
||||
if(!key_exists('amount', $this->arg)){
|
||||
return false;
|
||||
}
|
||||
$isGold = $this->arg['isGold'];
|
||||
$amount = $this->arg['amount'];
|
||||
if(!is_int($amount)){
|
||||
return false;
|
||||
}
|
||||
if($amount < 100){
|
||||
return false;
|
||||
}
|
||||
if($amount > 10000){
|
||||
return false;
|
||||
}
|
||||
$amount = (int)$amount;
|
||||
if(!is_bool($isGold)){
|
||||
return false;
|
||||
}
|
||||
$this->arg = [
|
||||
'isGold'=>$isGold,
|
||||
'amount'=>$amount
|
||||
];
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getCost():array{
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user