argTest를 로직 순서에 맞게 변경

This commit is contained in:
2018-10-21 14:28:29 +09:00
parent c08459e370
commit 6c5c2d40bc
27 changed files with 289 additions and 304 deletions
+23 -29
View File
@@ -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];
}