改名
This commit is contained in:
@@ -131,7 +131,7 @@ class Container extends BaseObject implements ContainerInterface
|
||||
* @return object
|
||||
* @throws
|
||||
*/
|
||||
public function newObject($class, array $constrict = [], array $config = []): object
|
||||
public function create($class, array $constrict = [], array $config = []): object
|
||||
{
|
||||
return $this->resolve($class, $constrict, $config);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class Kiri
|
||||
} else if (is_array($className) && isset($className['class'])) {
|
||||
$class = $className['class'];
|
||||
unset($className['class']);
|
||||
return static::$container->newObject($class, $construct, $className);
|
||||
return static::$container->create($class, $construct, $className);
|
||||
} else if (is_callable($className, TRUE)) {
|
||||
return call_user_func($className, $construct);
|
||||
} else {
|
||||
|
||||
@@ -109,7 +109,7 @@ class Connection extends Component
|
||||
public function create($coroutineName, $config): Closure
|
||||
{
|
||||
return static function () use ($coroutineName, $config) {
|
||||
return Kiri::getDi()->newObject(PDO::class, [
|
||||
return Kiri::getDi()->create(PDO::class, [
|
||||
$config['database'], $config['cds'], $config['username'], $config['password'], $config['charset'] ?? 'utf8mb4'
|
||||
]);
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ class Redis extends Component
|
||||
public function create(string $name, mixed $config): Closure
|
||||
{
|
||||
return static function () use ($name, $config) {
|
||||
return Kiri::getDi()->newObject(\Kiri\Cache\Base\Redis::class, [
|
||||
return Kiri::getDi()->create(\Kiri\Cache\Base\Redis::class, [
|
||||
$config['host'], (int)$config['port'], $config['databases'] ?? 0,
|
||||
$config['auth'], $config['prefix'] ?? '', $config['timeout'] ?? 30,
|
||||
$config['read_timeout'] ?? 30
|
||||
|
||||
Reference in New Issue
Block a user