Conditions | 5 |
Paths | 7 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
37 | public function onTerminate(Event $event) |
||
38 | { |
||
39 | if ($this->translator === null) { |
||
40 | return; |
||
41 | } |
||
42 | |||
43 | $messages = $this->translator->getCollectedMessages(); |
||
44 | $created = array(); |
||
45 | foreach ($messages as $message) { |
||
46 | if ($message['state'] === DataCollectorTranslator::MESSAGE_MISSING) { |
||
47 | $m = new Message($message); |
||
48 | $this->transService->createAsset($m); |
||
49 | $created[] = $m; |
||
50 | } |
||
51 | } |
||
52 | |||
53 | if (count($created) > 0) { |
||
54 | // update filesystem |
||
55 | $this->fileSystemUpdater->updateMessageCatalog($created); |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 |
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: