| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 1 / 1 | CRAP | 100.00% covered (success) | 100.00% | 11 / 11
ClassNamePass | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 11 / 11
apply($code, MockConfiguration $config) | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 11 / 11

1 | <?php
2 |
3 | namespace Mockery\Generator\StringManipulation\Pass;
4 |
5 | use Mockery\Generator\MockConfiguration;
6 |
7 | class ClassNamePass implements Pass
8 | {
9 | public function apply($code, MockConfiguration $config)
10 | {
11 | $namespace = $config->getNamespaceName();
12 | $className = $config->getShortName();
13 |
14 | $code = str_replace(
15 | 'namespace Mockery;',
16 | $namespace ? 'namespace ' . $namespace . ';' : '',
17 | $code
18 | );
19 |
20 | $code = str_replace(
21 | 'class Mock',
22 | 'class ' . $className,
23 | $code
24 | );
25 |
26 | return $code;
27 | }
28 | }