Conditions | 4 |
Paths | 6 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 4 | protected function getPheanstalk(&$name = null) |
|
32 | { |
||
33 | 4 | $pheanstalk = $this->locator->getPheanstalk($name); |
|
34 | |||
35 | 4 | if (null === $name) { |
|
36 | 4 | $name = 'default'; |
|
37 | } |
||
38 | |||
39 | 4 | if (null === $pheanstalk) { |
|
40 | 1 | throw new \RuntimeException('Pheanstalk not found: '.$name); |
|
41 | } |
||
42 | |||
43 | 3 | if (!$pheanstalk->getConnection()->isServiceListening()) { |
|
44 | 1 | throw new \RuntimeException('Pheanstalk not connected: '.$name); |
|
45 | } |
||
46 | |||
47 | 2 | return $pheanstalk; |
|
48 | } |
||
50 |