Conditions | 2 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 40 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 0 | Features | 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 |
||
39 | public function testFacebook() { |
||
40 | $fullBaseUrl = Configure::read('App.fullBaseUrl') ?: FULL_BASE_URL; |
||
41 | |||
42 | // Text link |
||
43 | $title = __d('social_media', 'Share on Facebook'); |
||
44 | $urlParameters = [ |
||
45 | 'link' => 'your-url', |
||
46 | 'name' => 'your-name', |
||
47 | 'caption' => 'your-caption', |
||
48 | 'description' => 'your-description', |
||
49 | 'picture' => 'your-picture', |
||
50 | 'redirect_uri' => $fullBaseUrl |
||
51 | ]; |
||
52 | |||
53 | $result = $this->SocialMedia->facebook($title, $urlParameters); |
||
54 | $expected = '<a href="https://www.facebook.com/dialog/feed?' . |
||
55 | 'app_id=505567138750925&' . |
||
56 | 'redirect_uri=' . urlencode($fullBaseUrl) . '&' . |
||
57 | 'link=your-url&' . |
||
58 | 'name=your-name&' . |
||
59 | 'caption=your-caption&' . |
||
60 | 'description=your-description&' . |
||
61 | 'picture=your-picture' . |
||
62 | '">' . __d('social_media', 'Share on Facebook') . '</a>'; |
||
63 | |||
64 | $this->assertEqual($result, $expected); |
||
65 | |||
66 | // Image link |
||
67 | $image = '<img title="Facebook" src="/img/facebook.png">'; |
||
68 | $urlParameters = [ |
||
69 | 'link' => 'your-url', |
||
70 | 'name' => 'your-name', |
||
71 | 'caption' => 'your-caption', |
||
72 | 'description' => 'your-description', |
||
73 | 'picture' => 'your-picture', |
||
74 | 'redirect_uri' => $fullBaseUrl |
||
75 | ]; |
||
76 | $options = ['escape' => false, 'escapeTitle' => false]; |
||
77 | |||
78 | $result = $this->SocialMedia->facebook($image, $urlParameters, $options); |
||
79 | $expected = '<a href="https://www.facebook.com/dialog/feed?' . |
||
80 | 'app_id=505567138750925&' . |
||
81 | 'redirect_uri=' . urlencode($fullBaseUrl) . '&' . |
||
82 | 'link=your-url&' . |
||
83 | 'name=your-name&' . |
||
84 | 'caption=your-caption&' . |
||
85 | 'description=your-description&' . |
||
86 | 'picture=your-picture' . |
||
87 | '">' . $image . '</a>'; |
||
88 | |||
89 | $this->assertEqual($result, $expected); |
||
90 | } |
||
130 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths