It appears you can't have an array of callable methods defined within the scope of a class. Why not?
Why is this valid PHP (see http://3v4l.org/1JeQr)
$methods = array(
1 => function($subject, $value){
return ($subject == $value);
}
);
var_dump($methods[1]('a', 'a'));
But not this (see http://3v4l.org/FL449)
class Foo {
public static $methods = array(
1 => function($subject, $value){
return ($subject == $value);
}
);
}
var_dump(Foo::$methods[1]('a', 'a'));