@@ -31,11 +31,6 @@ class Resource implements InputFilterAwareInterface
3131 */
3232 protected $ errors = [];
3333
34- /**
35- * @var Http\Client
36- */
37- protected $ httpClient ;
38-
3934 /**
4035 * @var mixed
4136 */
@@ -66,6 +61,9 @@ class Resource implements InputFilterAwareInterface
6661 */
6762 protected $ hydrator ;
6863
64+ /**
65+ * @return bool
66+ */
6967 public function hasErrors ()
7068 {
7169 return count ($ this ->errors ) > 0 ;
@@ -282,43 +280,4 @@ public function delete($id)
282280 curl_exec ($ this ->curl );
283281 return true ;
284282 }
285-
286- /**
287- * @param EntityInterface $entity
288- */
289- protected function processData (EntityInterface $ entity )
290- {
291- $ data = $ this ->getHydrator ()->extract ($ entity );
292- $ this ->getInputFilter ()->setData ($ data );
293-
294- if (!$ this ->getInputFilter ()->isValid ()) {
295- $ this ->errors = $ this ->getInputFilter ()->getMessages ();
296- throw new DomainException ("Unprocessable entity " , 422 );
297- }
298-
299- $ this ->httpClient ->setRawBody (json_decode ($ data ));
300- }
301-
302- /**
303- * @return object
304- */
305- protected function processRequest ()
306- {
307- $ response = $ this ->httpClient ->send ();
308-
309- if ($ response ->isSuccess ()) {
310- $ result = $ response ->getBody ();
311- $ entityClass = $ this ->getEntityClass ();
312- $ entity = $ this ->getHydrator ()->hydrate ((array )$ result , new $ entityClass );
313- return $ entity ;
314- } elseif ($ response ->isClientError () || $ response ->isServerError ()) {
315- throw new DomainException (
316- sprintf (
317- 'An error occured while requesting Zoho API for %s ' ,
318- __METHOD__
319- ),
320- $ response ->getStatusCode ()
321- );
322- }
323- }
324283}
0 commit comments