call echo logger
[auerswald-callnotifier.git] / src / callnotifier / Logger / CallEcho.php
1 <?php
2 namespace callnotifier;
3
4 class Logger_CallEcho implements Logger
5 {
6     public function log($type, $arData)
7     {
8         switch ($type) {
9         case 'incomingCall':
10             $this->displayIncoming($arData['call']);
11             break;
12         case 'finishedCall':
13             $this->displayFinished($arData['call']);
14             break;
15         }
16     }
17
18
19     protected function displayIncoming(CallMonitor_Call $call)
20     {
21         echo 'Incoming call from ' . $call->from
22             . ' to ' . $call->to . "\n";
23     }
24
25     protected function displayFinished(CallMonitor_Call $call)
26     {
27         echo 'Finished call from ' . $call->from
28             . ' to ' . $call->to
29             . ', length ' . date('H:i:s', $call->end - $call->start - 3600)
30             . "\n";
31     }
32 }
33 ?>