toInt를 더 튼튼하게 개선. ROOT가 지정되었으므로 강제 지정하는 코드 해제

This commit is contained in:
2018-04-03 21:22:52 +09:00
parent 0c64087c0f
commit 6a62f5af0d
4 changed files with 8 additions and 13 deletions
-4
View File
@@ -1,10 +1,6 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '../..');
}
class AppConf{
private static $serverList = null;
-3
View File
@@ -1,9 +1,6 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '../..');
}
class Lock {
private static $l = ROOT.'/d_log/lock.txt';
-4
View File
@@ -1,10 +1,6 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '../..');
}
/**
* Session Wrapper. 내부적으로 $_SESSION을 이용
*
+8 -2
View File
@@ -42,7 +42,10 @@ class Util extends \utilphp\util{
*
* @return int|null
*/
public static function toInt($val, $force=false){
public static function toInt($val, $silent=false){
if(!isset($val)){
return null;
}
if($val === null){
return null;
}
@@ -56,7 +59,10 @@ class Util extends \utilphp\util{
return null;
}
if($force){
if($silent){
if($val == null){
return null;
}
return intval($val);
}
throw new InvalidArgumentException('올바르지 않은 타입형 :'.$val);