phan 처리

This commit is contained in:
2020-05-02 12:01:54 +09:00
parent c8948953c9
commit 016ca770f5
47 changed files with 155 additions and 95 deletions
+34 -5
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use MeekroDBException;
class KVStorage{
private $db;
private $tableName;
@@ -31,7 +33,7 @@ class KVStorage{
}
public function __set($key, $value) {
return $this->setValue($key, $value);
$this->setValue($key, $value);
}
public function __unset($key){
@@ -63,7 +65,9 @@ class KVStorage{
}
public function invalidateCacheValue($key):self{
$key = mb_strtolower($key);
if(is_string($key)){
$key = mb_strtolower($key);
}
if($this->cacheData === null){
return $this;
}
@@ -192,8 +196,15 @@ class KVStorage{
return $result;
}
/**
* @param string|int $key
* @param bool $onlyCache
* @return mixed|null
*/
public function getValue($key, bool $onlyCache=false){
$key = mb_strtolower($key);
if(is_string($key)){
$key = mb_strtolower($key);
}
if($this->cacheData !== null && ($onlyCache || key_exists($key, $this->cacheData))){
return $this->cacheData[$key] ?? null;
}
@@ -205,8 +216,17 @@ class KVStorage{
return $value;
}
/**
*
* @param string|int $key
* @param mixed $value
* @return KVStorage
* @throws MeekroDBException
*/
public function setValue($key, $value):self{
$key = mb_strtolower($key);
if(is_string($key)){
$key = mb_strtolower($key);
}
if($value === null){
return $this->deleteValue($key);
}
@@ -217,8 +237,17 @@ class KVStorage{
return $this->setDBValue($key, $value);
}
/**
*
* @param string|int $key
* @param mixed $value
* @return KVStorage
* @throws MeekroDBException
*/
public function deleteValue($key):self{
$key = mb_strtolower($key);
if(is_string($key)){
$key = mb_strtolower($key);
}
if(isset($this->cacheData[$key])){
unset($this->cacheData[$key]);
}
+3 -3
View File
@@ -52,9 +52,9 @@ class Session
public function restart(): Session
{
//NOTE: logout 프로세스는 아예 세션을 날려버리기도 하므로, 항상 안전하게 session_restart가 가능함을 보장하지 않음.
ini_set('session.use_only_cookies', false);
ini_set('session.use_cookies', false);
ini_set('session.use_trans_sid', false);
ini_set('session.use_only_cookies', 'false');
ini_set('session.use_cookies', 'false');
ini_set('session.use_trans_sid', 'false');
ini_set('session.cache_limiter', "none");
session_id($this->sessionID);
session_start(); // second session_start
+6 -6
View File
@@ -76,13 +76,13 @@ class TimeUtil
return date('H:i:s', strtotime('00:00:00') + $second);
}
public static function today()
public static function today():string
{
$obj = new \DateTime();
return $obj->format('Y-m-d');
}
public static function now(bool $withFraction=false)
public static function now(bool $withFraction=false):string
{
$obj = new \DateTime();
if(!$withFraction){
@@ -91,7 +91,7 @@ class TimeUtil
return $obj->format('Y-m-d H:i:s.u');
}
public static function nowAddDays($day, bool $withFraction=false)
public static function nowAddDays($day, bool $withFraction=false):string
{
$obj = new \DateTime();
$obj->add(static::secondsToDateInterval($day * 3600 * 24));
@@ -101,7 +101,7 @@ class TimeUtil
return $obj->format('Y-m-d H:i:s.u');
}
public static function nowAddHours($hour, bool $withFraction=false)
public static function nowAddHours($hour, bool $withFraction=false):string
{
$obj = new \DateTime();
$obj->add(static::secondsToDateInterval($hour * 3600));
@@ -111,7 +111,7 @@ class TimeUtil
return $obj->format('Y-m-d H:i:s.u');
}
public static function nowAddMinutes($minute, bool $withFraction=false)
public static function nowAddMinutes($minute, bool $withFraction=false):string
{
$obj = new \DateTime();
$obj->add(static::secondsToDateInterval($minute * 60));
@@ -121,7 +121,7 @@ class TimeUtil
return $obj->format('Y-m-d H:i:s.u');
}
public static function nowAddSeconds($second, bool $withFraction=false)
public static function nowAddSeconds($second, bool $withFraction=false):string
{
$obj = new \DateTime();
$obj->add(static::secondsToDateInterval($second));
+1 -1
View File
@@ -567,7 +567,7 @@ class Util extends \utilphp\util
*
* @param array $array 배열. 1차원 배열 또는 2차원 배열
* @param int|string|null $key 2차원 배열에서 참조할 키.
* @return int|float 합계
* @return array
*/
public static function arrayGroupBy(array $array, $key, bool $preserveRowKey=false) {
$result = array();