| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 51 | 
| Code Lines | 40 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 42 | 
| CRAP Score | 2 | 
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  | 
            ||
| 7 | 1 | public function testFind()  | 
            |
| 8 |     { | 
            ||
| 9 | // page needs to be live  | 
            ||
| 10 | 1 |         $nearPage = $this->objFromFixture('NearestPOIPage', 'StationFinder'); | 
            |
| 11 | 1 |         $this->logInWithPermission('ADMIN'); | 
            |
| 12 | 1 | $nearPage->doPublish();  | 
            |
| 13 | 1 |         if (Member::currentUser()) { | 
            |
| 14 | 1 | Member::currentUser()->logOut();  | 
            |
| 15 | 1 | }  | 
            |
| 16 | 1 | $link = $nearPage->Link();  | 
            |
| 17 | 1 |         error_log('POI PAGE LINK:'.$link); | 
            |
| 18 | |||
| 19 | 1 | $url = $link;  | 
            |
| 20 | 1 |         error_log('TRYING URL '.$url); | 
            |
| 21 | 1 | $response = $this->get($url);  | 
            |
| 22 | 1 | $this->assertEquals(200, $response->getStatusCode());  | 
            |
| 23 | |||
| 24 | // location is MBK  | 
            ||
| 25 | 1 | $url = $link.'find?lat=13.7444513&lng=100.5290196';  | 
            |
| 26 | 1 | $response = $this->get($url);  | 
            |
| 27 | 1 | $this->assertEquals(200, $response->getStatusCode());  | 
            |
| 28 | $expected = array(  | 
            ||
| 29 | 1 | 'Ratchathewi',  | 
            |
| 30 | 1 | 'Phaya Thai',  | 
            |
| 31 | 1 | 'Chit Lom',  | 
            |
| 32 | 1 | 'Victory Monument',  | 
            |
| 33 | 1 | 'Nana',  | 
            |
| 34 | 1 | 'Sanam Pao',  | 
            |
| 35 | 1 | 'Ari',  | 
            |
| 36 | 1 | 'Saphan Khwai',  | 
            |
| 37 | 1 | 'Mo Chit',  | 
            |
| 38 | 1 | );  | 
            |
| 39 | 1 |         $this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected); | 
            |
| 40 | |||
| 41 | // location is victory monument  | 
            ||
| 42 | 1 | $url = $link.'find?lat=13.7650776&lng=100.5369724';  | 
            |
| 43 | 1 | $response = $this->get($url);  | 
            |
| 44 | 1 | $this->assertEquals(200, $response->getStatusCode());  | 
            |
| 45 | $expected = array(  | 
            ||
| 46 | 1 | 'Victory Monument',  | 
            |
| 47 | 1 | 'Phaya Thai',  | 
            |
| 48 | 1 | 'Sanam Pao',  | 
            |
| 49 | 1 | 'Ratchathewi',  | 
            |
| 50 | 1 | 'Ari',  | 
            |
| 51 | 1 | 'Chit Lom',  | 
            |
| 52 | 1 | 'Nana',  | 
            |
| 53 | 1 | 'Saphan Khwai',  | 
            |
| 54 | 1 | 'Mo Chit',  | 
            |
| 55 | 1 | );  | 
            |
| 56 | 1 |         $this->assertExactMatchBySelector('table#nearestPOIs td.name', $expected); | 
            |
| 57 | 1 | }  | 
            |
| 58 | }  | 
            ||
| 59 | 
Classes in PHP are usually named in CamelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.
Thus the name database provider becomes
DatabaseProvider.