If I write a public static method in a class ie...
public static function get_info($type){
switch($type){
case'title':
self::get_title();
break;
}
}
I have to write my get_title() function as public...
public static function get_title(){
return 'Title';
}
Otherwise I get the error:
Call to private method Page::get_title()
Which makes me feel as though the function get_info()
is essentially redundant. I'd like to be able to make a call from a static method to a private method inside my class for validation purposes. Is this impossible?
PHP > 5.0 btw.
!####### EDIT SOLUTION (BUT NOT ANSWER TO QUESTION) #########!
In case you are curious, my workaround was to instantiate my static function's class inside the static function.
So, the class name was Page I would do this...
public static function get_info($type){
$page = new Page();
switch($type){
case'title':
$page->get_title();
break;
}
}
public function get_title(){
return 'Title';
}