| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| Code Lines | 53 |
| 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 namespace DocLister\Tests; |
||
| 35 | protected function mockMODX(array $config = array()) |
||
| 36 | {
|
||
| 37 | $modx = $this->getMockBuilder('DocumentParser')
|
||
| 38 | ->setMethods(array('getFullTableName'))
|
||
| 39 | ->getMock(); |
||
| 40 | |||
| 41 | $modx->expects($this->any()) |
||
| 42 | ->method('getFullTableName')
|
||
| 43 | ->will($this->returnArgument(0)); |
||
| 44 | |||
| 45 | $modx->db = $this->mockDBAPI(); |
||
| 46 | |||
| 47 | $modx->documentObject = array( |
||
| 48 | 'id' => 1, |
||
| 49 | 'type' => 'document', |
||
| 50 | 'contentType' => 'text/html', |
||
| 51 | 'pagetitle' => 'New document', |
||
| 52 | 'longtitle' => '', |
||
| 53 | 'description' => '', |
||
| 54 | 'alias' => '', |
||
| 55 | 'link_attributes' => '', |
||
| 56 | 'published' => 1, |
||
| 57 | 'pub_date' => 0, |
||
| 58 | 'unpub_date' => 0, |
||
| 59 | 'parent' => 0, |
||
| 60 | 'isfolder' => 0, |
||
| 61 | 'introtext' => '', |
||
| 62 | 'content' => '', |
||
| 63 | 'richtext' => 1, |
||
| 64 | 'template' => 0, |
||
| 65 | 'menuindex' => 0, |
||
| 66 | 'searchable' => 1, |
||
| 67 | 'cacheable' => 1, |
||
| 68 | 'createdon' => 0, |
||
| 69 | 'createdby' => 0, |
||
| 70 | 'editedon' => 0, |
||
| 71 | 'editedby' => 0, |
||
| 72 | 'deleted' => 0, |
||
| 73 | 'deletedon' => 0, |
||
| 74 | 'deletedby' => 0, |
||
| 75 | 'publishedon' => 0, |
||
| 76 | 'publishedby' => 0, |
||
| 77 | 'menutitle' => '', |
||
| 78 | 'donthit' => 0, |
||
| 79 | 'haskeywords' => 0, |
||
| 80 | 'hasmetatags' => 0, |
||
| 81 | 'privateweb' => 0, |
||
| 82 | 'privatemgr' => 0, |
||
| 83 | 'content_dispo' => 0, |
||
| 84 | 'hidemenu' => 0, |
||
| 85 | 'alias_visible' => 1 |
||
| 86 | ); |
||
| 87 | $modx->documentIdentifier = 1; |
||
| 88 | $modx->config = array_merge(array( |
||
| 89 | 'manager_language' => 'russian-UTF8', |
||
| 90 | 'site_start' => 1, |
||
| 91 | 'site_url' => 'http://example.com/', |
||
| 92 | ), $config); |
||
| 93 | |||
| 94 | return $modx; |
||
| 95 | |||
| 97 | } |