initial checkin
[m6w6/hikke] / tests / hikke / TestObserver.php
1 <?php
2
3 namespace hikke;
4
5 class TestObserver implements \SplObserver
6 {
7 static $logs;
8
9 private $name;
10
11 function __construct($name) {
12 $this->name = $name;
13 }
14
15 function __toString() {
16 return $this->name;
17 }
18
19 static function reset() {
20 self::$logs = "";
21 }
22
23 function update(\SplSubject $event, $supp = null) {
24 self::$logs .= "$this->name: $event";
25 if ($supp && $supp != $event) {
26 self::$logs .= ":$supp";
27 }
28 self::$logs .= "\n";
29 }
30
31 function callMe(\stdClass $arg) {
32 $arg->data .= __METHOD__."\n";
33 }
34 }