Conditions | 5 |
Paths | 9 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function build(array $parameters) |
||
38 | { |
||
39 | foreach ($parameters as $property => $value) { |
||
40 | $property = static::convertToCamelCase($property); |
||
41 | |||
42 | if (\property_exists($this, $property)) { |
||
43 | $this->$property = $value; |
||
44 | } |
||
45 | } |
||
46 | if (\property_exists($this, 'dates')) { |
||
47 | foreach ($this->dates as $value) { |
||
|
|||
48 | $property = static::convertToCamelCase($value); |
||
49 | $this->$property = static::convertDateTime($this->$property); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |
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: