eee
This commit is contained in:
@@ -47,20 +47,21 @@ class Kiri
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $className
|
* @param string|array $className
|
||||||
* @param array $construct
|
* @param array $construct
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function createObject($className, array $construct = []): mixed
|
public static function createObject(string|array $className, array $construct = []): mixed
|
||||||
{
|
{
|
||||||
|
$container = static::getContainer();
|
||||||
if (is_string($className) && class_exists($className)) {
|
if (is_string($className) && class_exists($className)) {
|
||||||
$object = static::getContainer()->get($className);
|
$object = $container->get($className);
|
||||||
return self::configure($object, $construct);
|
return self::configure($object, $construct);
|
||||||
} else if (is_array($className) && isset($className['class'])) {
|
} else if (is_array($className) && isset($className['class'])) {
|
||||||
$class = $className['class'];
|
$class = $className['class'];
|
||||||
unset($className['class']);
|
unset($className['class']);
|
||||||
return static::getContainer()->make($class, $construct, $className);
|
return $container->make($class, $construct, $className);
|
||||||
} else if (is_callable($className, TRUE)) {
|
} else if (is_callable($className, TRUE)) {
|
||||||
return call_user_func($className, $construct);
|
return call_user_func($className, $construct);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Core;
|
namespace Kiri\Core;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DateFormat
|
* Class DateFormat
|
||||||
* @package Kiri\Core
|
* @package Kiri\Core
|
||||||
@@ -18,6 +17,18 @@ namespace Kiri\Core;
|
|||||||
class DateFormat
|
class DateFormat
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function DaySecond(): int
|
||||||
|
{
|
||||||
|
$time = strtotime(date('Y-m-d', strtotime('+1days')));
|
||||||
|
|
||||||
|
return $time - time();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $time
|
* @param $time
|
||||||
* @return bool|false|int|string
|
* @return bool|false|int|string
|
||||||
|
|||||||
Reference in New Issue
Block a user