1
0
mirror of synced 2024-12-04 19:06:03 +03:00

Delete RetailcrmProxy.php

This commit is contained in:
Vitaly Artemev 2016-12-06 14:43:49 +04:00 committed by GitHub
parent 5411b7fe86
commit fbd776a075

View File

@ -1,39 +0,0 @@
<?php
/**
* Class RequestProxy
* @package RetailCrm\Component
*/
class RetailcrmProxy
{
private $api;
private $log;
public function __construct($url, $key, $log)
{
$this->api = new RetailcrmApiClient($url, $key);
$this->log = $log;
}
public function __call($method, $arguments)
{
$accessLog = date('H:m:i') . ' [' . $method . '] -> ' . json_encode($arguments) . "\n";
error_log($accessLog, 3, $this->log);
try {
$response = call_user_func_array(array($this->api, $method), $arguments);
if (!$response->isSuccessful()) {
error_log("[$method] " . $response->getErrorMsg() . "\n", 3, $this->log);
if (isset($response['errors'])) {
$error = implode("\n", $response['errors']);
error_log($error . "\n", 3, $this->log);
}
$response = false;
}
return $response;
} catch (CurlException $e) {
error_log("[$method] " . $e->getMessage() . "\n", 3, $this->log);
return false;
} catch (InvalidJsonException $e) {
error_log("[$method] " . $e->getMessage() . "\n", 3, $this->log);
return false;
}
}
}