@@ -81,7 +81,7 @@ public function invalidateTags(array $tags): static
8181 sprintf (self ::API_ENDPOINT .'/zones/%s/purge_cache ' , $ this ->options ['zone_identifier ' ]),
8282 [],
8383 false ,
84- $ this -> json_encode (['tags ' => $ tags ])
84+ json_encode (['tags ' => $ tags ], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES )
8585 );
8686
8787 return $ this ;
@@ -115,7 +115,7 @@ public function clear(): static
115115 sprintf (self ::API_ENDPOINT .'/zones/%s/purge_cache ' , $ this ->options ['zone_identifier ' ]),
116116 ['Accept ' => 'application/json ' ],
117117 false ,
118- $ this -> json_encode (['purge_everything ' => true ])
118+ json_encode (['purge_everything ' => true ], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES )
119119 );
120120
121121 return $ this ;
@@ -130,7 +130,7 @@ public function flush(): int
130130 sprintf (self ::API_ENDPOINT .'/zones/%s/purge_cache ' , $ this ->options ['zone_identifier ' ]),
131131 [],
132132 false ,
133- $ this -> json_encode (['files ' => $ urlChunk ])
133+ json_encode (['files ' => $ urlChunk ], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES )
134134 );
135135 }
136136 $ this ->purgeByUrlsData = [];
@@ -165,14 +165,4 @@ protected function configureOptions(): OptionsResolver
165165
166166 return $ resolver ;
167167 }
168-
169- private function json_encode (array $ data ): string
170- {
171- $ json = json_encode ($ data , JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES );
172- if (false === $ json ) {
173- throw new \InvalidArgumentException (sprintf ('Cannot encode "$data": %s ' , json_last_error_msg ()));
174- }
175-
176- return $ json ;
177- }
178168}
0 commit comments