Просмотр исходного кода

Merge branch 'master' of ssh://200.50.168.30:222/VendorSoftwareFlowdat3/Webservice

Maxi Schvindt 7 лет назад
Родитель
Сommit
2051a376f1
1 измененных файлов с 7 добавлено и 2 удалено
  1. 7 2
      Twig/GetJSONExtension.php

+ 7 - 2
Twig/GetJSONExtension.php

@@ -36,13 +36,18 @@ class GetJSONExtension extends \Twig_Extension
     /**
      * @param int $clientId
      *
-     * @return string
+     * @return array
      */
     public function getJSON($parameter = 'client', $filters = [])
     {
         $url = $this->webservice->buildUrl($parameter, $filters);
+        $result = json_decode($this->webservice->makeGetRequest($url), true);
+
+        if ($result) {
+            return current(json_decode($this->webservice->makeGetRequest($url), true));
+        }
 
-        return current(json_decode($this->webservice->makeGetRequest($url), true));
+        return [];
     }
 
     /**