| Conditions | 2 |
| Paths | 3 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function __construct() |
||
| 28 | { |
||
| 29 | try { |
||
| 30 | $this->headers = [ |
||
| 31 | 'header_total' => config('woocommerce.header_total') ?? 'X-WP-Total', |
||
| 32 | 'header_total_pages' => config('woocommerce.header_total_pages') ?? 'X-WP-TotalPages', |
||
| 33 | ]; |
||
| 34 | |||
| 35 | $this->client = new Client( |
||
| 36 | config('woocommerce.store_url'), |
||
| 37 | config('woocommerce.consumer_key'), |
||
| 38 | config('woocommerce.consumer_secret'), |
||
| 39 | [ |
||
| 40 | 'version' => 'wc/'.config('woocommerce.api_version'), |
||
| 41 | 'wp_api' => config('woocommerce.wp_api_integration'), |
||
| 42 | 'verify_ssl' => config('woocommerce.verify_ssl'), |
||
| 43 | 'query_string_auth' => config('woocommerce.query_string_auth'), |
||
| 44 | 'timeout' => config('woocommerce.timeout'), |
||
| 45 | ] |
||
| 46 | ); |
||
| 47 | } catch (\Exception $e) { |
||
| 48 | throw new \Exception($e->getMessage(), 1); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.