@@ -15,13 +15,9 @@ trait WooCommerceTrait
1515 */
1616 public function all ($ endpoint = '' , $ options = [])
1717 {
18- try {
19- self ::__construct ();
18+ self ::__construct ();
2019
21- return $ this ->client ->get ($ endpoint , $ options );
22- } catch (\Exception $ ex ) {
23- throw new \Exception ($ ex ->getMessage (), 1 );
24- }
20+ return $ this ->client ->get ($ endpoint , $ options );
2521 }
2622
2723 /**
@@ -35,13 +31,9 @@ public function all($endpoint = '', $options = [])
3531 */
3632 public function find ($ endpoint = '' , $ options = [])
3733 {
38- try {
39- self ::__construct ();
34+ self ::__construct ();
4035
41- return $ this ->client ->get ($ endpoint , $ options );
42- } catch (\Exception $ ex ) {
43- throw new \Exception ($ ex ->getMessage (), 1 );
44- }
36+ return $ this ->client ->get ($ endpoint , $ options );
4537 }
4638
4739 /**
@@ -55,13 +47,9 @@ public function find($endpoint = '', $options = [])
5547 */
5648 public function create ($ endpoint , $ data )
5749 {
58- try {
59- self ::__construct ();
50+ self ::__construct ();
6051
61- return $ this ->client ->post ($ endpoint , $ data );
62- } catch (\Exception $ ex ) {
63- throw new \Exception ($ ex ->getMessage (), 1 );
64- }
52+ return $ this ->client ->post ($ endpoint , $ data );
6553 }
6654
6755 /**
@@ -75,13 +63,9 @@ public function create($endpoint, $data)
7563 */
7664 public function update ($ endpoint , $ data )
7765 {
78- try {
79- self ::__construct ();
66+ self ::__construct ();
8067
81- return $ this ->client ->put ($ endpoint , $ data );
82- } catch (\Exception $ ex ) {
83- throw new \Exception ($ ex ->getMessage (), 1 );
84- }
68+ return $ this ->client ->put ($ endpoint , $ data );
8569 }
8670
8771 /**
@@ -95,13 +79,9 @@ public function update($endpoint, $data)
9579 */
9680 public function delete ($ endpoint , $ options = [])
9781 {
98- try {
99- self ::__construct ();
82+ self ::__construct ();
10083
101- return $ this ->client ->delete ($ endpoint , $ options );
102- } catch (\Exception $ ex ) {
103- throw new \Exception ($ ex ->getMessage (), 1 );
104- }
84+ return $ this ->client ->delete ($ endpoint , $ options );
10585 }
10686
10787 /**
@@ -111,11 +91,7 @@ public function delete($endpoint, $options = [])
11191 */
11292 public function getRequest ()
11393 {
114- try {
115- return $ this ->client ->http ->getRequest ();
116- } catch (\Exception $ ex ) {
117- throw new \Exception ($ ex ->getMessage (), 1 );
118- }
94+ return $ this ->client ->http ->getRequest ();
11995 }
12096
12197 /**
@@ -125,11 +101,7 @@ public function getRequest()
125101 */
126102 public function getResponse ()
127103 {
128- try {
129- return $ this ->client ->http ->getResponse ();
130- } catch (\Exception $ ex ) {
131- throw new \Exception ($ ex ->getMessage (), 1 );
132- }
104+ return $ this ->client ->http ->getResponse ();
133105 }
134106
135107 /**
@@ -139,7 +111,7 @@ public function getResponse()
139111 */
140112 public function countResults ()
141113 {
142- return (int ) $ this ->getResponse ()->getHeaders ()[' X-WP-Total ' ];
114+ return (int ) $ this ->getResponse ()->getHeaders ()[$ this -> headers [ ' header_total ' ] ];
143115 }
144116
145117 /**
@@ -149,7 +121,7 @@ public function countResults()
149121 */
150122 public function countPages ()
151123 {
152- return (int ) $ this ->getResponse ()->getHeaders ()[' X-WP-TotalPages ' ];
124+ return (int ) $ this ->getResponse ()->getHeaders ()[$ this -> headers [ ' header_total_pages ' ] ];
153125 }
154126
155127 /**
0 commit comments