| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 2 | public function resolve(Service $service) |
|
| 21 | { |
||
| 22 | 2 | $this->builder->setParams($service->getParams()); |
|
| 23 | |||
| 24 | 2 | $this->arguments = $this->builder->getArguments(); |
|
|
|
|||
| 25 | |||
| 26 | 2 | if (!isset($this->instances[$service->getName()])) { |
|
| 27 | 2 | $refObj = new ReflectionClass($service->getClass()); |
|
| 28 | 2 | $this->instances[$service->getName()] = $refObj->newInstanceArgs($this->arguments); |
|
| 29 | 2 | } |
|
| 30 | |||
| 31 | 2 | return $this->instances[$service->getName()]; |
|
| 32 | } |
||
| 33 | } |
||
| 34 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: