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