| Conditions | 1 |
| Paths | 1 |
| Total Lines | 100 |
| 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 |
||
| 68 | public function pdoOptions() |
||
| 69 | { |
||
| 70 | return [ |
||
| 71 | [ |
||
| 72 | [ |
||
| 73 | PDO::ATTR_TIMEOUT => 10, |
||
| 74 | PDO::CRATE_ATTR_DEFAULT_SCHEMA => 'default', |
||
| 75 | PDO::CRATE_ATTR_HTTP_BASIC_AUTH => ['foo', 'bar'], |
||
| 76 | ], |
||
| 77 | [ |
||
| 78 | RequestOptions::TIMEOUT => 10, |
||
| 79 | RequestOptions::CONNECT_TIMEOUT => 10, |
||
| 80 | RequestOptions::AUTH => ['foo', 'bar'], |
||
| 81 | RequestOptions::HEADERS => [ |
||
| 82 | 'Default-Schema' => 'default', |
||
| 83 | ], |
||
| 84 | ], |
||
| 85 | ], |
||
| 86 | [ |
||
| 87 | [ |
||
| 88 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_ENABLED_BUT_WITHOUT_HOST_VERIFICATION, |
||
| 89 | ], |
||
| 90 | [ |
||
| 91 | RequestOptions::VERIFY => false, |
||
| 92 | 'base_uri' => 'https://localhost:4200', |
||
| 93 | ], |
||
| 94 | ], |
||
| 95 | [ |
||
| 96 | [ |
||
| 97 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 98 | ], |
||
| 99 | [ |
||
| 100 | 'base_uri' => 'https://localhost:4200', |
||
| 101 | ], |
||
| 102 | ], |
||
| 103 | [ |
||
| 104 | [ |
||
| 105 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 106 | PDO::CRATE_ATTR_SSL_CA_PATH => 'foo.pem', |
||
| 107 | ], |
||
| 108 | [ |
||
| 109 | 'base_uri' => 'https://localhost:4200', |
||
| 110 | RequestOptions::VERIFY => 'foo.pem', |
||
| 111 | ], |
||
| 112 | ], |
||
| 113 | [ |
||
| 114 | [ |
||
| 115 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 116 | PDO::CRATE_ATTR_SSL_CA_PATH => 'foo.pem', |
||
| 117 | PDO::CRATE_ATTR_SSL_CA_PASSWORD => 'foo', |
||
| 118 | ], |
||
| 119 | [ |
||
| 120 | 'base_uri' => 'https://localhost:4200', |
||
| 121 | RequestOptions::VERIFY => ['foo.pem', 'foo'], |
||
| 122 | ], |
||
| 123 | ], |
||
| 124 | [ |
||
| 125 | [ |
||
| 126 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 127 | PDO::CRATE_ATTR_SSL_KEY_PATH => 'foo.pem', |
||
| 128 | ], |
||
| 129 | [ |
||
| 130 | 'base_uri' => 'https://localhost:4200', |
||
| 131 | RequestOptions::SSL_KEY => 'foo.pem', |
||
| 132 | ], |
||
| 133 | ], |
||
| 134 | [ |
||
| 135 | [ |
||
| 136 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 137 | PDO::CRATE_ATTR_SSL_KEY_PATH => 'foo.pem', |
||
| 138 | PDO::CRATE_ATTR_SSL_KEY_PASSWORD => 'foo', |
||
| 139 | ], |
||
| 140 | [ |
||
| 141 | 'base_uri' => 'https://localhost:4200', |
||
| 142 | RequestOptions::SSL_KEY => ['foo.pem', 'foo'], |
||
| 143 | ], |
||
| 144 | ], |
||
| 145 | [ |
||
| 146 | [ |
||
| 147 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 148 | PDO::CRATE_ATTR_SSL_CERT_PATH => 'foo.pem', |
||
| 149 | ], |
||
| 150 | [ |
||
| 151 | 'base_uri' => 'https://localhost:4200', |
||
| 152 | RequestOptions::CERT => 'foo.pem', |
||
| 153 | ], |
||
| 154 | ], |
||
| 155 | [ |
||
| 156 | [ |
||
| 157 | PDO::CRATE_ATTR_SSL_MODE => PDO::CRATE_ATTR_SSL_MODE_REQUIRED, |
||
| 158 | PDO::CRATE_ATTR_SSL_CERT_PATH => 'foo.pem', |
||
| 159 | PDO::CRATE_ATTR_SSL_CERT_PASSWORD => 'foo', |
||
| 160 | ], |
||
| 161 | [ |
||
| 162 | 'base_uri' => 'https://localhost:4200', |
||
| 163 | RequestOptions::CERT => ['foo.pem', 'foo'], |
||
| 164 | ], |
||
| 165 | ], |
||
| 166 | ]; |
||
| 167 | } |
||
| 168 | |||
| 252 |