Conditions | 1 |
Paths | 1 |
Total Lines | 59 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
9 | class GetConfigsCest |
||
10 | { |
||
11 | public function _before(ApiTester $I) |
||
|
|||
12 | { |
||
13 | $user = $I->grabEntityFromRepository(User::class, ['id' => 1]); |
||
14 | $I->haveInRepository(DbConfiguration::class, [ |
||
15 | 'owner' => $user, |
||
16 | 'title' => 'sqlite config', |
||
17 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
18 | ]); |
||
19 | $I->haveInRepository(DbConfiguration::class, [ |
||
20 | 'owner' => $user, |
||
21 | 'title' => 'mysql config', |
||
22 | 'url' => 'mysql://test-user:test-pwd@mysql/test', |
||
23 | ]); |
||
24 | $I->haveInRepository(DbConfiguration::class, [ |
||
25 | 'owner' => $user, |
||
26 | 'title' => 'project 1 config', |
||
27 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
28 | ]); |
||
29 | $I->haveInRepository(DbConfiguration::class, [ |
||
30 | 'owner' => $user, |
||
31 | 'title' => 'project 2 config', |
||
32 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
33 | ]); |
||
34 | $I->haveInRepository(DbConfiguration::class, [ |
||
35 | 'owner' => $user, |
||
36 | 'title' => 'project 3 config', |
||
37 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
38 | ]); |
||
39 | $I->haveInRepository(DbConfiguration::class, [ |
||
40 | 'owner' => $user, |
||
41 | 'title' => 'project 4 config', |
||
42 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
43 | ]); |
||
44 | $I->haveInRepository(DbConfiguration::class, [ |
||
45 | 'owner' => $user, |
||
46 | 'title' => 'project 5 config', |
||
47 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
48 | ]); |
||
49 | $I->haveInRepository(DbConfiguration::class, [ |
||
50 | 'owner' => $user, |
||
51 | 'title' => 'project 6 config', |
||
52 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
53 | ]); |
||
54 | $I->haveInRepository(DbConfiguration::class, [ |
||
55 | 'owner' => $user, |
||
56 | 'title' => 'project 7 config', |
||
57 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
58 | ]); |
||
59 | $I->haveInRepository(DbConfiguration::class, [ |
||
60 | 'owner' => $user, |
||
61 | 'title' => 'project 8 config', |
||
62 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
63 | ]); |
||
64 | $I->haveInRepository(DbConfiguration::class, [ |
||
65 | 'owner' => $user, |
||
66 | 'title' => 'project 9 config', |
||
67 | 'url' => 'sqlite:///data/db/db.sqlite', |
||
68 | ]); |
||
207 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.