Conditions | 2 |
Paths | 2 |
Total Lines | 7 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
35 | 1 | public function __construct(string $url, string $description = null, HashGenerator $hashGenerator = null) |
|
36 | { |
||
37 | 1 | $hashGenerator = $hashGenerator ?: new HashGenerator(); |
|
38 | 1 | $this->id = $hashGenerator::generate(self::ID_HASH_LENGTH); |
|
|
|||
39 | 1 | $this->url = $url; |
|
40 | 1 | $this->description = $description; |
|
41 | 1 | } |
|
42 | |||
61 |
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: