|
@@ -2,21 +2,38 @@
|
|
|
|
|
|
namespace WebserviceBundle\Services;
|
|
|
|
|
|
+use Buzz\Client\Curl;
|
|
|
use Buzz\Message\Request as HttpRequest;
|
|
|
use Buzz\Message\RequestInterface as HttpRequestInterface;
|
|
|
use Buzz\Message\Response as HttpResponse;
|
|
|
+use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
+use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
|
|
|
|
|
class Webservice
|
|
|
{
|
|
|
|
|
|
+ /**
|
|
|
+ * @var ContainerInterface
|
|
|
+ */
|
|
|
protected $serviceContainer;
|
|
|
|
|
|
+ /**
|
|
|
+ * @var TokenStorage
|
|
|
+ */
|
|
|
protected $securityTokenStorage;
|
|
|
|
|
|
+ /**
|
|
|
+ * @var Curl
|
|
|
+ */
|
|
|
protected $httpClient;
|
|
|
|
|
|
|
|
|
- public function __construct($serviceContainer, $securityTokenStorage, $httpClient)
|
|
|
+ /**
|
|
|
+ * @param ContainerInterface $serviceContainer
|
|
|
+ * @param TokenStorageInterface $securityTokenStorage
|
|
|
+ * @param Curl $httpClient
|
|
|
+ */
|
|
|
+ public function __construct(ContainerInterface $serviceContainer, TokenStorageInterface $securityTokenStorage, Curl $httpClient)
|
|
|
{
|
|
|
$this->serviceContainer = $serviceContainer;
|
|
|
$this->securityTokenStorage = $securityTokenStorage;
|
|
@@ -26,6 +43,7 @@ class Webservice
|
|
|
/**
|
|
|
* @param string $webservice
|
|
|
* @param array $params
|
|
|
+ *
|
|
|
* @return array
|
|
|
*/
|
|
|
public function getChoices($webservice, $params = array())
|
|
@@ -44,6 +62,7 @@ class Webservice
|
|
|
/**
|
|
|
* @param string $webservice
|
|
|
* @param array $params
|
|
|
+ *
|
|
|
* @return array
|
|
|
*/
|
|
|
public function getArray($webservice, $params = array())
|
|
@@ -67,6 +86,8 @@ class Webservice
|
|
|
|
|
|
/**
|
|
|
* @param string $url
|
|
|
+ * @param string $method
|
|
|
+ *
|
|
|
* @return HttpResponse
|
|
|
*/
|
|
|
public function makeGetRequest($url, $method = HttpRequestInterface::METHOD_GET)
|
|
@@ -92,6 +113,7 @@ class Webservice
|
|
|
* @param array $order_by
|
|
|
* @param integer $limit
|
|
|
* @param integer $offset
|
|
|
+ *
|
|
|
* @return array
|
|
|
*/
|
|
|
public function getData($webservice, $filters = array(), $order_by = array(), $limit = null, $offset = null)
|
|
@@ -132,6 +154,7 @@ class Webservice
|
|
|
/**
|
|
|
* @param string $webservice
|
|
|
* @param int $id
|
|
|
+ *
|
|
|
* @return string
|
|
|
*/
|
|
|
public function getById($webservice, $id)
|
|
@@ -147,10 +170,9 @@ class Webservice
|
|
|
|
|
|
/**
|
|
|
* @param string $webservice
|
|
|
- * @param array $filters
|
|
|
- * @param array $order_by
|
|
|
- * @param integer $limit
|
|
|
- * @param integer $offset
|
|
|
+ * @param int $id
|
|
|
+ * @param array $data
|
|
|
+ *
|
|
|
* @return array
|
|
|
*/
|
|
|
public function putData($webservice, $id, $data)
|