| Conditions | 2 |
| Paths | 4 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function setModifications($fileId, $modificationsJson) { |
||
| 32 | try { |
||
| 33 | $entity = $this->mapper->find($fileId); |
||
| 34 | $entity->setModifications($modificationsJson); |
||
| 35 | $this->mapper->update($entity); |
||
| 36 | } catch (DoesNotExistException $ex) { |
||
| 37 | $entity = new FileProperties(); |
||
| 38 | $entity->setId($fileId); |
||
| 39 | $entity->setModifications($modificationsJson); |
||
| 40 | $this->mapper->insert($entity); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 |
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: