| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 397 | public function apply($code, MockConfiguration $config) |
|
| 28 | { |
||
| 29 | 397 | $target = $config->getTargetClass(); |
|
| 30 | |||
| 31 | 397 | if (!$target) { |
|
| 32 | 28 | return $code; |
|
| 33 | } |
||
| 34 | |||
| 35 | 373 | if ($target->isFinal()) { |
|
| 36 | 1 | return $code; |
|
| 37 | } |
||
| 38 | |||
| 39 | 372 | $className = ltrim($target->getName(), "\\"); |
|
| 40 | 372 | if (!class_exists($className)) { |
|
| 41 | 17 | \Mockery::declareClass($className); |
|
| 42 | 17 | } |
|
| 43 | |||
| 44 | 372 | $code = str_replace( |
|
| 45 | 372 | "implements MockInterface", |
|
| 46 | 372 | "extends \\" . $className . " implements MockInterface", |
|
| 47 | $code |
||
| 48 | 372 | ); |
|
| 49 | |||
| 50 | 372 | return $code; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |