99namespace Cloudflare \API \Endpoints ;
1010
1111use Cloudflare \API \Adapter \Adapter ;
12+ use Cloudflare \API \Traits \BodyAccessorTrait ;
1213
1314class WAF implements API
1415{
16+ use BodyAccessorTrait;
17+
1518 private $ adapter ;
1619
1720 public function __construct (Adapter $ adapter )
@@ -42,9 +45,9 @@ public function getPackages(
4245 }
4346
4447 $ user = $ this ->adapter ->get ('zones/ ' . $ zoneID . '/firewall/waf/packages ' , $ query );
45- $ body = json_decode ($ user ->getBody ());
48+ $ this -> body = json_decode ($ user ->getBody ());
4649
47- return (object )['result ' => $ body ->result , 'result_info ' => $ body ->result_info ];
50+ return (object )['result ' => $ this -> body ->result , 'result_info ' => $ this -> body ->result_info ];
4851 }
4952
5053
@@ -53,9 +56,9 @@ public function getPackageInfo(
5356 string $ packageID
5457 ): \stdClass {
5558 $ user = $ this ->adapter ->get ('zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID );
56- $ body = json_decode ($ user ->getBody ());
59+ $ this -> body = json_decode ($ user ->getBody ());
5760
58- return $ body ->result ;
61+ return $ this -> body ->result ;
5962 }
6063
6164 public function getRules (
@@ -81,9 +84,9 @@ public function getRules(
8184 $ query ['direction ' ] = $ direction ;
8285 }
8386 $ user = $ this ->adapter ->get ('zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID . '/rules ' , $ query );
84- $ body = json_decode ($ user ->getBody ());
87+ $ this -> body = json_decode ($ user ->getBody ());
8588
86- return (object )['result ' => $ body ->result , 'result_info ' => $ body ->result_info ];
89+ return (object )['result ' => $ this -> body ->result , 'result_info ' => $ this -> body ->result_info ];
8790 }
8891
8992 public function getRuleInfo (
@@ -92,9 +95,9 @@ public function getRuleInfo(
9295 string $ ruleID
9396 ): \stdClass {
9497 $ user = $ this ->adapter ->get ('zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID . '/rules/ ' . $ ruleID );
95- $ body = json_decode ($ user ->getBody ());
98+ $ this -> body = json_decode ($ user ->getBody ());
9699
97- return $ body ->result ;
100+ return $ this -> body ->result ;
98101 }
99102
100103 public function updateRule (
@@ -111,9 +114,9 @@ public function updateRule(
111114 'zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID . '/rules/ ' . $ ruleID ,
112115 $ query
113116 );
114- $ body = json_decode ($ user ->getBody ());
117+ $ this -> body = json_decode ($ user ->getBody ());
115118
116- return $ body ->result ;
119+ return $ this -> body ->result ;
117120 }
118121
119122 public function getGroups (
@@ -143,9 +146,9 @@ public function getGroups(
143146 'zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID . '/groups ' ,
144147 $ query
145148 );
146- $ body = json_decode ($ user ->getBody ());
149+ $ this -> body = json_decode ($ user ->getBody ());
147150
148- return (object )['result ' => $ body ->result , 'result_info ' => $ body ->result_info ];
151+ return (object )['result ' => $ this -> body ->result , 'result_info ' => $ this -> body ->result_info ];
149152 }
150153
151154 public function getGroupInfo (
@@ -154,9 +157,9 @@ public function getGroupInfo(
154157 string $ groupID
155158 ): \stdClass {
156159 $ user = $ this ->adapter ->get ('zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID . '/groups/ ' . $ groupID );
157- $ body = json_decode ($ user ->getBody ());
160+ $ this -> body = json_decode ($ user ->getBody ());
158161
159- return $ body ->result ;
162+ return $ this -> body ->result ;
160163 }
161164
162165 public function updateGroup (
@@ -173,8 +176,8 @@ public function updateGroup(
173176 'zones/ ' . $ zoneID . '/firewall/waf/packages/ ' . $ packageID . '/groups/ ' . $ groupID ,
174177 $ query
175178 );
176- $ body = json_decode ($ user ->getBody ());
179+ $ this -> body = json_decode ($ user ->getBody ());
177180
178- return $ body ->result ;
181+ return $ this -> body ->result ;
179182 }
180183}
0 commit comments