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
CreateArgs.php
82 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 | |
| 8 | class ConsumeArgsTop { |
| 9 | public $s; |
| 10 | public $a; |
| 11 | |
| 12 | public function __construct(ConsumeArgsSub $a, $s) { |
| 13 | $this->a = $a; |
| 14 | $this->s = $s; |
| 15 | } |
| 16 | } |
| 17 | class ConsumeArgsSub { |
| 18 | public $s; |
| 19 | |
| 20 | public function __construct($s) { |
| 21 | $this->s = $s; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | |
| 26 | class A2 { |
| 27 | public $b; |
| 28 | public $c; |
| 29 | public $foo; |
| 30 | |
| 31 | public function __construct(B $b, C $c, $foo) { |
| 32 | $this->b = $b; |
| 33 | $this->foo = $foo; |
| 34 | $this->c = $c; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | |
| 39 | class A3 { |
| 40 | public $b; |
| 41 | public $c; |
| 42 | public $foo; |
| 43 | |
| 44 | public function __construct(C $c, $foo, B $b) { |
| 45 | $this->b = $b; |
| 46 | $this->foo = $foo; |
| 47 | $this->c = $c; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | class A4 { |
| 52 | public $m1; |
| 53 | public $m2; |
| 54 | public function __construct(M1 $m1, M2 $m2) { |
| 55 | $this->m1 = $m1; |
| 56 | $this->m2 = $m2; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | |
| 61 | class BestMatch { |
| 62 | public $a; |
| 63 | public $string; |
| 64 | public $b; |
| 65 | |
| 66 | public function __construct($string, A $a, B $b) { |
| 67 | $this->a = $a; |
| 68 | $this->string = $string; |
| 69 | $this->b = $b; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | //From: https://github.com/TomBZombie/Dice/issues/62#issuecomment-112370319 |
| 74 | class ScalarConstructors { |
| 75 | public $string; |
| 76 | public $null; |
| 77 | |
| 78 | public function __construct($string, $null) { |
| 79 | $this->string = $string; |
| 80 | $this->null = $null; |
| 81 | } |
| 82 | } |