| Conditions | 1 |
| Paths | 1 |
| Total Lines | 68 |
| Code Lines | 63 |
| 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 |
||
| 85 | public function setUp() { |
||
| 86 | parent::setUp(); |
||
| 87 | |||
| 88 | $this->data_dir = dirname( __DIR__ ) . '/data/'; |
||
| 89 | |||
| 90 | $this->app = Mockery::mock( 'Writing_On_GitHub' ); |
||
| 91 | $this->controller = Mockery::mock( 'Writing_On_GitHub_Controller' ); |
||
| 92 | $this->request = Mockery::mock( 'Writing_On_GitHub_Request' ); |
||
| 93 | $this->import = Mockery::mock( 'Writing_On_GitHub_Import' ); |
||
| 94 | $this->export = Mockery::mock( 'Writing_On_GitHub_Export' ); |
||
| 95 | $this->response = Mockery::mock( 'Writing_On_GitHub_Response' ); |
||
| 96 | $this->payload = Mockery::mock( 'Writing_On_GitHub_Payload' ); |
||
| 97 | $this->api = Mockery::mock( 'Writing_On_GitHub_Api' ); |
||
| 98 | $this->semaphore = Mockery::mock( 'Writing_On_GitHub_Semaphore' ); |
||
| 99 | $this->database = Mockery::mock( 'Writing_On_GitHub_Database' ); |
||
| 100 | $this->post = Mockery::mock( 'Writing_On_GitHub_Post' ); |
||
| 101 | $this->blob = Mockery::mock( 'Writing_On_GitHub_Blob' ); |
||
| 102 | $this->api_cache = Mockery::mock( 'Writing_On_GitHub_Cache' ); |
||
| 103 | $this->fetch = Mockery::mock( 'Writing_On_GitHub_Fetch_Client' ); |
||
| 104 | $this->persist = Mockery::mock( 'Writing_On_GitHub_Persist_Client' ); |
||
| 105 | |||
| 106 | Writing_On_GitHub::$instance = $this->app; |
||
| 107 | |||
| 108 | $this->app |
||
| 109 | ->shouldReceive( 'request' ) |
||
| 110 | ->andReturn( $this->request ) |
||
| 111 | ->byDefault(); |
||
| 112 | $this->app |
||
| 113 | ->shouldReceive( 'import' ) |
||
| 114 | ->andReturn( $this->import ) |
||
| 115 | ->byDefault(); |
||
| 116 | $this->app |
||
| 117 | ->shouldReceive( 'export' ) |
||
| 118 | ->andReturn( $this->export ) |
||
| 119 | ->byDefault(); |
||
| 120 | $this->app |
||
| 121 | ->shouldReceive( 'response' ) |
||
| 122 | ->andReturn( $this->response ) |
||
| 123 | ->byDefault(); |
||
| 124 | $this->app |
||
| 125 | ->shouldReceive( 'api' ) |
||
| 126 | ->andReturn( $this->api ) |
||
| 127 | ->byDefault(); |
||
| 128 | $this->app |
||
| 129 | ->shouldReceive( 'semaphore' ) |
||
| 130 | ->andReturn( $this->semaphore ) |
||
| 131 | ->byDefault(); |
||
| 132 | $this->app |
||
| 133 | ->shouldReceive( 'database' ) |
||
| 134 | ->andReturn( $this->database ) |
||
| 135 | ->byDefault(); |
||
| 136 | $this->app |
||
| 137 | ->shouldReceive( 'blob' ) |
||
| 138 | ->andReturn( $this->blob ) |
||
| 139 | ->byDefault(); |
||
| 140 | $this->app |
||
| 141 | ->shouldReceive( 'cache' ) |
||
| 142 | ->andReturn( $this->api_cache ) |
||
| 143 | ->byDefault(); |
||
| 144 | $this->api |
||
| 145 | ->shouldReceive( 'fetch' ) |
||
| 146 | ->andReturn( $this->fetch ) |
||
| 147 | ->byDefault(); |
||
| 148 | $this->api |
||
| 149 | ->shouldReceive( 'persist' ) |
||
| 150 | ->andReturn( $this->persist ) |
||
| 151 | ->byDefault(); |
||
| 152 | } |
||
| 153 | |||
| 158 |