Conditions | 5 |
Paths | 6 |
Total Lines | 60 |
Code Lines | 43 |
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 |
||
41 | public function DataProviderHttpHandlerHandle() : Generator |
||
42 | { |
||
43 | foreach ($this->DataProviderHttpHandlerInstances() as $args) { |
||
44 | list($implementation, $postConstructionCalls, $baseUrl, $basePath, $config) = $args; |
||
45 | |||
46 | foreach ($this->DataProviderVerifyHandlerGood() as $testArgs) { |
||
47 | list( |
||
48 | $sources, |
||
49 | $prefix, |
||
50 | $expectedStatus, |
||
51 | $expectedContent, |
||
52 | $uri, |
||
53 | $method, |
||
54 | $parameters, |
||
55 | $cookies, |
||
56 | $files, |
||
57 | $server, |
||
58 | $content |
||
59 | ) = $testArgs; |
||
60 | |||
61 | $parsed = parse_url($uri); |
||
62 | |||
63 | $baseUrl = $parsed['scheme'] . '://' . $parsed['host']; |
||
64 | |||
65 | if (isset($parsed['port'])) { |
||
66 | $baseUrl .= ':' . $parsed['port']; |
||
67 | } |
||
68 | |||
69 | $baseUrl .= '/' . $prefix; |
||
70 | |||
71 | $config[DaftSource::class]['sources'] = $sources; |
||
72 | $config[DaftSource::class]['cacheFile'] = ( |
||
73 | __DIR__ . |
||
74 | '/fixtures/http-kernel.fast-route.cache' |
||
75 | ); |
||
76 | |||
77 | if (is_file($config[DaftSource::class]['cacheFile'])) { |
||
78 | unlink($config[DaftSource::class]['cacheFile']); |
||
79 | } |
||
80 | |||
81 | $instance = Utilities::ObtainHttpHandlerInstance( |
||
82 | $this, |
||
83 | $implementation, |
||
84 | $baseUrl, |
||
85 | $basePath, |
||
86 | $config |
||
87 | ); |
||
88 | Utilities::ConfigureFrameworkInstance($this, $instance, $args[1]); |
||
89 | |||
90 | $request = Request::create( |
||
91 | $uri, |
||
92 | $method, |
||
93 | $parameters, |
||
94 | $cookies, |
||
95 | $files, |
||
96 | $server, |
||
97 | $content |
||
98 | ); |
||
99 | |||
100 | yield [$instance, $request, $expectedStatus, $expectedContent]; |
||
101 | } |
||
120 |