| Conditions | 2 | 
| Paths | 1 | 
| Total Lines | 56 | 
| Code Lines | 48 | 
| 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  | 
            ||
| 39 | protected function getSecurityCheckerMock($empty = false)  | 
            ||
| 40 |     { | 
            ||
| 41 | // Mock info comes from SensioLabs API docs example output,  | 
            ||
| 42 | // and a real (test) silverstripe/installer 3.2.0 installation  | 
            ||
| 43 | // (using the aforementioned API)  | 
            ||
| 44 | $mockOutput = <<<CVENOTICE  | 
            ||
| 45 | { | 
            ||
| 46 |     "symfony\/symfony": { | 
            ||
| 47 | "version": "2.1.x-dev",  | 
            ||
| 48 |         "advisories": { | 
            ||
| 49 |             "symfony\/symfony\/CVE-2013-1397.yaml": { | 
            ||
| 50 | "title": "Ability to enable\/disable object support in YAML parsing and dumping",  | 
            ||
| 51 | "link": "http:\/\/symfony.com\/blog\/security-release-symfony-2-0-22-and-2-1-7-released",  | 
            ||
| 52 | "cve": "CVE-2013-1397"  | 
            ||
| 53 | }  | 
            ||
| 54 | }  | 
            ||
| 55 | },  | 
            ||
| 56 |     "silverstripe\/framework": { | 
            ||
| 57 | "version": "3.2.0",  | 
            ||
| 58 |         "advisories": { | 
            ||
| 59 |             "silverstripe\/framework\/SS-2016-002-1.yaml": { | 
            ||
| 60 | "title": "SS-2016-002: CSRF vulnerability in GridFieldAddExistingAutocompleter",  | 
            ||
| 61 | "link": "https:\/\/www.silverstripe.org\/download\/security-releases\/ss-2016-002\/",  | 
            ||
| 62 | "cve": ""  | 
            ||
| 63 | },  | 
            ||
| 64 |             "silverstripe\/framework\/SS-2016-003-1.yaml": { | 
            ||
| 65 | "title": "SS-2016-003: Hostname, IP and Protocol Spoofing through HTTP Headers",  | 
            ||
| 66 | "link": "https:\/\/www.silverstripe.org\/download\/security-releases\/ss-2016-003\/",  | 
            ||
| 67 | "cve": ""  | 
            ||
| 68 | },  | 
            ||
| 69 |             "silverstripe\/framework\/SS-2015-028-1.yaml": { | 
            ||
| 70 | "title": "SS-2015-028: Missing security check on dev\/build\/defaults",  | 
            ||
| 71 | "link": "https:\/\/www.silverstripe.org\/download\/security-releases\/ss-2015-028\/",  | 
            ||
| 72 | "cve": ""  | 
            ||
| 73 | },  | 
            ||
| 74 |             "silverstripe\/framework\/SS-2015-027-1.yaml": { | 
            ||
| 75 | "title": "SS-2015-027: HtmlEditor embed url sanitisation",  | 
            ||
| 76 | "link": "https:\/\/www.silverstripe.org\/download\/security-releases\/ss-2015-027\/",  | 
            ||
| 77 | "cve": ""  | 
            ||
| 78 | },  | 
            ||
| 79 |             "silverstripe\/framework\/SS-2015-026-1.yaml": { | 
            ||
| 80 | "title": "SS-2015-026: Form field validation message XSS vulnerability",  | 
            ||
| 81 | "link": "https:\/\/www.silverstripe.org\/download\/security-releases\/ss-2015-026\/",  | 
            ||
| 82 | "cve": ""  | 
            ||
| 83 | }  | 
            ||
| 84 | }  | 
            ||
| 85 | }  | 
            ||
| 86 | }  | 
            ||
| 87 | CVENOTICE;  | 
            ||
| 88 | |||
| 89 | $securityCheckerMock = $this->getMockBuilder(SecurityChecker::class)->setMethods(['check'])->getMock();  | 
            ||
| 90 |         $securityCheckerMock->expects($this->any())->method('check')->will($this->returnValue( | 
            ||
| 91 | $empty ? [] : json_decode($mockOutput, true)  | 
            ||
| 92 | ));  | 
            ||
| 93 | |||
| 94 | return $securityCheckerMock;  | 
            ||
| 95 | }  | 
            ||
| 156 |