| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | public function create($className, $args, $queue) |
||
| 13 | 11 | { |
|
| 14 | if (!class_exists($className)) { |
||
| 15 | 11 | throw new Resque_Exception( |
|
| 16 | 1 | 'Could not find job class ' . $className . '.' |
|
| 17 | 1 | ); |
|
| 18 | } |
||
| 19 | |||
| 20 | if (!method_exists($className, 'perform')) { |
||
| 21 | 10 | throw new Resque_Exception( |
|
| 22 | 1 | 'Job class ' . $className . ' does not contain a perform method.' |
|
| 23 | 1 | ); |
|
| 24 | } |
||
| 25 | |||
| 26 | $instance = new $className(); |
||
| 27 | 9 | $instance->args = $args; |
|
| 28 | 9 | $instance->queue = $queue; |
|
| 29 | 9 | return $instance; |
|
| 30 | 9 | } |
|
| 32 |