Conditions | 1 |
Paths | 1 |
Total Lines | 67 |
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 |
||
28 | public function providerForPassTroughMethods() |
||
29 | { |
||
30 | $contentInfo = new ContentInfo(); |
||
31 | $versionInfo = new VersionInfo(); |
||
32 | $contentCreateStruct = new ContentCreateStruct(); |
||
33 | $contentUpdateStruct = new ContentUpdateStruct(); |
||
34 | $contentMetaStruct = new ContentMetadataUpdateStruct(); |
||
35 | $locationCreateStruct = new LocationCreateStruct(); |
||
36 | $user = new User(); |
||
37 | $contentType = new ContentType(); |
||
38 | |||
39 | // string $method, array $arguments, bool $return = true |
||
40 | return [ |
||
41 | ['loadContentInfo', [42]], |
||
42 | |||
43 | ['loadContentInfoByRemoteId', ['f348tj4gorgji4']], |
||
44 | |||
45 | ['loadVersionInfo', [$contentInfo]], |
||
46 | ['loadVersionInfo', [$contentInfo, 3]], |
||
47 | |||
48 | ['loadVersionInfoById', [42]], |
||
49 | ['loadVersionInfoById', [42, 3]], |
||
50 | |||
51 | ['createContent', [$contentCreateStruct]], |
||
52 | ['createContent', [$contentCreateStruct, [44]]], |
||
53 | |||
54 | ['updateContentMetadata', [$contentInfo, $contentMetaStruct]], |
||
55 | |||
56 | ['deleteContent', [$contentInfo]], |
||
57 | |||
58 | ['createContentDraft', [$contentInfo]], |
||
59 | ['createContentDraft', [$contentInfo, $versionInfo]], |
||
60 | ['createContentDraft', [$contentInfo, $versionInfo, $user]], |
||
61 | |||
62 | ['loadContentDrafts', []], |
||
63 | ['loadContentDrafts', [$user]], |
||
64 | |||
65 | ['updateContent', [$versionInfo, $contentUpdateStruct]], |
||
66 | |||
67 | ['publishVersion', [$versionInfo]], |
||
68 | |||
69 | ['deleteVersion', [$versionInfo]], |
||
70 | |||
71 | ['loadVersions', [$contentInfo]], |
||
72 | |||
73 | ['copyContent', [$contentInfo, $locationCreateStruct]], |
||
74 | ['copyContent', [$contentInfo, $locationCreateStruct, $versionInfo]], |
||
75 | |||
76 | ['loadRelations', [$versionInfo]], |
||
77 | |||
78 | ['loadReverseRelations', [$contentInfo]], |
||
79 | |||
80 | ['addRelation', [$versionInfo, $contentInfo]], |
||
81 | |||
82 | ['deleteRelation', [$versionInfo, $contentInfo]], |
||
83 | |||
84 | ['removeTranslation', [$contentInfo, 'eng-GB']], |
||
85 | |||
86 | ['deleteTranslation', [$contentInfo, 'eng-GB']], |
||
87 | |||
88 | ['deleteTranslationFromDraft', [$versionInfo, 'eng-GB']], |
||
89 | |||
90 | ['newContentCreateStruct', [$contentType, 'eng-GB']], |
||
91 | ['newContentMetadataUpdateStruct', []], |
||
92 | ['newContentUpdateStruct', []], |
||
93 | ]; |
||
94 | } |
||
95 | |||
117 |