Basic.php
5 years ago
Call.php
5 years ago
ConstructParams.php
5 years ago
CreateArgs.php
5 years ago
NamedInstances.php
5 years ago
Namespace.php
5 years ago
ShareInstances.php
2 years ago
ShareInstances.php
86 lines
| 1 | <?php |
| 2 | /* @description Dice - A minimal Dependency Injection Container for PHP * |
| 3 | * @author Tom Butler tom@r.je * |
| 4 | * @copyright 2012-2018 Tom Butler <tom@r.je> | https:// r.je/dice.html * |
| 5 | * @license http:// www.opensource.org/licenses/bsd-license.php BSD License * |
| 6 | * @version 3.0 */ |
| 7 | class TestSharedInstancesTop { |
| 8 | public $shared; |
| 9 | public $share1; |
| 10 | public $share2; |
| 11 | |
| 12 | public function __construct(Shared $shared, SharedInstanceTest1 $share1, SharedInstanceTest2 $share2) { |
| 13 | $this->shared = $shared; |
| 14 | $this->share1 = $share1; |
| 15 | $this->share2 = $share2; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | class SharedInstanceTest1 { |
| 23 | public $shared; |
| 24 | |
| 25 | public function __construct(Shared $shared) { |
| 26 | $this->shared = $shared; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | |
| 31 | class SharedInstanceTest2 { |
| 32 | public $shared; |
| 33 | |
| 34 | public function __construct(Shared $shared) { |
| 35 | $this->shared = $shared; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | |
| 40 | |
| 41 | class M1 { |
| 42 | public $f; |
| 43 | public function __construct(F $f) { |
| 44 | $this->f = $f; |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | class M2 { |
| 49 | public $e; |
| 50 | public function __construct(E $e) { |
| 51 | $this->e = $e; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | class Foo77 { |
| 56 | public $bar; |
| 57 | |
| 58 | public function __construct(Bar77 $bar) { |
| 59 | $this->bar = $bar; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | class Bar77 { |
| 64 | public $a; |
| 65 | |
| 66 | public function __construct($a) { |
| 67 | $this->a = $a; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | |
| 72 | class Baz77 { |
| 73 | public static function create() { |
| 74 | return new Bar77('Z'); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | class Shared { |
| 79 | public $uniq; |
| 80 | |
| 81 | public function __construct() { |
| 82 | $this->uniq = uniqid(); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 |