Conditions | 4 |
Paths | 4 |
Total Lines | 29 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
46 | private function write($type, $message) |
||
47 | { |
||
48 | if ($this->destination === null) { |
||
49 | return; |
||
50 | } |
||
51 | $pid = getmypid(); |
||
52 | switch (true) { |
||
53 | case $this->ownerPid === $pid: |
||
54 | $role = 'owner'; |
||
55 | break; |
||
56 | case $this->masterPid === $pid: |
||
57 | $role = 'master'; |
||
58 | break; |
||
59 | default: |
||
60 | $role = 'worker'; |
||
61 | break; |
||
62 | } |
||
63 | fputs( |
||
64 | $this->destination, |
||
65 | sprintf( |
||
66 | '[%s][%s][%d(%s)] %s', |
||
67 | date('Y-m-d H:i:s'), |
||
68 | $type, |
||
69 | $pid, |
||
70 | $role, |
||
71 | $message . PHP_EOL |
||
72 | ) |
||
73 | ); |
||
74 | } |
||
75 | |||
98 |