Is there a way to use the class names as cases in the folowing example? (pseudo code)
class Some_Class {
static function get_image_size() {
switch (get_class($image_size)) {
case 'Class_1':
$image_size = 'related-post';
break;
}
case 'Class_2':
$image_size = 'full';
break;
}
return $image_size;
}
}
I need this to call a specific variable form different php classes. Basically I need something like the following code but using switch statement:
class Some_class {
static function get_image_size() {
if Class_Name_1 {
$image_size = 'related-post';
}
elseif Class_Name_2 {
$image_size = 'full';
}
return $image_size;
}
}
Thanks.