정적 분석기 결과 반영. 주로 배열 초기화. 변수 이름 실수 수정.

This commit is contained in:
2018-04-06 20:06:28 +09:00
parent 2bce82c73e
commit ffc0fc0c6f
20 changed files with 109 additions and 94 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<?php
namespace sammo\Event\Condition;
class Interval extends sammo\Event\Condition{
class Interval extends \sammo\Event\Condition{
//TODO:구현
public function __construct(...$args){
throw new \BadMethodCallException('Not Yet Implmented.');
+6 -4
View File
@@ -3,6 +3,8 @@ namespace sammo\Event\Condition;
class Logic extends \sammo\Event\Condition{
private $mode = 'and';
/** @var \sammo\Event\Condition[] */
private $conditions = [];
const AVAILABLE_LOGIC_NAME = [
'not'=>false,
@@ -26,7 +28,7 @@ class Logic extends \sammo\Event\Condition{
}
public function eval($env=null){
switch($this->$mode){
switch($this->mode){
case 'not':
return $this->logicNot($env);
case 'and':
@@ -41,7 +43,7 @@ class Logic extends \sammo\Event\Condition{
}
private function logicNot($env){
$sub = self::_eval($this->conditions[0], $env);
$result = self::_eval($this->conditions[0], $env);
$result['value'] = !$result['value'];
$result['chain'][] = 'not';
return $result;
@@ -55,7 +57,7 @@ class Logic extends \sammo\Event\Condition{
$sub = self::_eval($cond, $env);
$chain[] = $sub['chain'];
if(!$sub['value']){
$result['value'] = false;
$value = false;
break;
}
}
@@ -74,7 +76,7 @@ class Logic extends \sammo\Event\Condition{
$sub = self::_eval($cond, $env);
$chain[] = $sub['chain'];
if($sub['value']){
$result['value'] = true;
$value = true;
break;
}
}