-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.php
More file actions
34 lines (30 loc) · 1.01 KB
/
sample.php
File metadata and controls
34 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require 'LazyEvalutableObject.php';
class Test extends LazyEvalutableObject {
public $omase = 'san';
public $tokyo = 'kyoto';
public $one_time;
public $normal_property = 100;
public function __construct() {
$this->addLazyEvalutionObserver('omase', array($this, 'omase'));
$this->addLazyEvalutionObserver('tokyo', array($this, 'tokyo'));
$this->addLazyEvalutionObserver('one_time', array($this, 'one_time'));
}
public function omase($property) {
echo sprintf("hello! property is %s\n", $property);
}
public function tokyo($property) {
echo sprintf("hello! property is %s\n", $property);
return 'osaka';
}
public function one_time($property) {
echo sprintf("hello! property is %s\n", $property);
$this->one_time = rand(0, 10);
return $this->one_time;
}
}
$test = new Test();
echo sprintf("\$test->omase = %s\n", $test->omase);
echo sprintf("\$test->tokyo = %s\n", $test->tokyo);
echo sprintf("\$test->one_time = %s\n", $test->one_time);
echo sprintf("\$test->one_time = %s\n", $test->one_time);