From f660a4dc0e98ceb75d58c50c2eb81a711d0cc863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Plusquellec?= Date: Fri, 30 Jun 2017 18:27:38 +0200 Subject: [PATCH] total --- lib/container.php | 18 ++++++++++++++++-- lib/inner.php | 4 ++++ lib/lib.php | 12 ++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 lib/inner.php diff --git a/lib/container.php b/lib/container.php index 686cec1..61b59cf 100644 --- a/lib/container.php +++ b/lib/container.php @@ -3,15 +3,29 @@ class Container extends Ghost { + protected static function called() + { + return actual('container.class', maker(get_called_class())); + } + public function __construct(array $values = []) { parent::__construct($values, 'container'); } + public function build($class, $args = [], $single = true) + { + if (!isset($this->$class) || !$single) { + $this->$class = maker($class, $args); + } + + return $this->$class; + } + public static function __callStatic($m, $a) { - $i = new static; + $i = static::called(); - return call_user_func_array(); + return call_user_func_array([$i, $m], $a); } } diff --git a/lib/inner.php b/lib/inner.php new file mode 100644 index 0000000..d5e072e --- /dev/null +++ b/lib/inner.php @@ -0,0 +1,4 @@ +