Resque_Job_Factory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 27
ccs 10
cts 10
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 18 3
1
<?php
2
3
class Resque_Job_Factory implements Resque_Job_FactoryInterface
4
{
5
	/**
6
	 * @param $className
7
	 * @param array $args
8
	 * @param $queue
9
	 * @return Resque_JobInterface
10
	 * @throws \Resque_Exception
11
	 */
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
	}
31
}
32