rafaelss (owner)

Revisions

gist: 126009 Download_button fork
public
Public Clone URL: git://gist.github.com/126009.git
callable.php
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
<?php
class Callable {
 
    public function __invoke(array $options) {
        print_r($options);
    }
}
 
class Model {
 
    public $attribute;
 
    public function __construct() {
        $this->attribute = new Callable();
    }
}
 
$callable = new Callable();
$callable(array('conditions' => '1 = 1'));
 
$model = new Model();
$model->attribute(array('order' => 'name ASC'));
?>
 
#############
## OUTPUT
 
Array
(
[conditions] => 1 = 1
)
 
Fatal error: Call to undefined method Model::attribute() in /home/rafael/projects/php53/callable.php on line 22