stop using reflection in prooduction code
Problem: Reflection is a debugging tool and not really meant for use on production. There are easier ways to check if a class implements an interface with `is_a()`. Solution: Get rid of reflection use and switch to `is_a()` in TaskManager, refactor the Enum thing that does not make sense since it is not being used. The `is_a()` solution is really straightforward and has been supported in php for ages. The Enum thing was a copy paste hack from stackoverflow and ignored the simple solution mentioned there while not using the features of the advanced one.
This commit is contained in:
parent
4557395a86
commit
09aea8b747
4 changed files with 7 additions and 52 deletions
|
@ -350,8 +350,7 @@ class TaskFactory {
|
|||
* @return bool true if the class $c implements AirtimeTask
|
||||
*/
|
||||
private static function _isTask($c) {
|
||||
$reflect = new ReflectionClass($c);
|
||||
return $reflect->implementsInterface('AirtimeTask');
|
||||
return is_a('AirtimeTask', $c, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue