@@ -8,7 +8,6 @@ class Api
88{
99 public const ROUTES_LAYER = 5827 ;
1010 public const CARRIAGES_LAYER = 5764 ;
11-
1211 public const STATIONS_STRUCTURE_ID = 704 ;
1312
1413 /**
@@ -50,93 +49,93 @@ public function __construct(Config $config = null)
5049 *
5150 * @param array $params Массив параметров
5251 *
53- * @return array<object>
52+ * @return string
5453 * @throws GuzzleException
5554 */
56- public function trainRoutes (array $ params ): array
55+ public function trainRoutes (array $ params ): string
5756 {
5857 $ layer = [
5958 'layer_id ' => static ::ROUTES_LAYER ,
6059 ];
6160 $ routes = $ this ->query ->get ($ this ->path , $ layer + $ params );
6261
63- return $ routes ->tp [0 ]->list ;
62+ return json_encode ( $ routes ->tp [0 ]->list , JSON_UNESCAPED_UNICODE ) ;
6463 }
6564
6665 /**
6766 * Получает маршруты туда-обратно
6867 *
6968 * @param array $params Массив параметров
7069 *
71- * @return array<object>
70+ * @return string
7271 * @throws GuzzleException
7372 */
74- public function trainRoutesReturn (array $ params ): array
73+ public function trainRoutesReturn (array $ params ): string
7574 {
7675 $ layer = [
7776 'layer_id ' => static ::ROUTES_LAYER ,
7877 ];
7978 $ routes = $ this ->query ->get ($ this ->path , $ layer + $ params );
8079
81- return [
80+ return json_encode ( [
8281 'forward ' => $ routes ->tp [0 ]->list ,
8382 'back ' => $ routes ->tp [1 ]->list
84- ];
83+ ], JSON_UNESCAPED_UNICODE ) ;
8584 }
8685
8786 /**
8887 * Получение списка вагонов
8988 *
9089 * @param array $params Массив параметров
9190 *
92- * @return array<object>
91+ * @return string
9392 * @throws GuzzleException
9493 */
95- public function trainCarriages (array $ params ): array
94+ public function trainCarriages (array $ params ): string
9695 {
9796 $ layer = [
9897 'layer_id ' => static ::CARRIAGES_LAYER ,
9998 ];
10099 $ carriages = $ this ->query ->get ($ this ->path , $ layer + $ params );
101100
102- return [
101+ return json_encode ( [
103102 'cars ' => $ carriages ->lst [0 ]->cars ?? null ,
104103 'functionBlocks ' => $ carriages ->lst [0 ]->functionBlocks ?? null ,
105104 'schemes ' => $ carriages ->schemes ?? null ,
106105 'companies ' => $ carriages ->insuranceCompany ?? null ,
107- ];
106+ ], JSON_UNESCAPED_UNICODE ) ;
108107 }
109108
110109 /**
111110 * Получение списка станций
112111 *
113112 * @param array $params Массив параметров
114113 *
115- * @return array
114+ * @return string
116115 * @throws GuzzleException
117116 */
118- public function trainStationList (array $ params ): array
117+ public function trainStationList (array $ params ): string
119118 {
120119 $ layer = [
121120 'STRUCTURE_ID ' => static ::STATIONS_STRUCTURE_ID ,
122121 ];
123122 $ stations = $ this ->query ->get ($ this ->stationListPath , $ layer + $ params );
124123
125- return [
124+ return json_encode ( [
126125 'train ' => $ stations ->data ->trainInfo ,
127126 'routes ' => $ stations ->data ->routes ,
128- ];
127+ ], JSON_UNESCAPED_UNICODE ) ;
129128 }
130129
131130 /**
132131 * Получение списка кодов станций
133132 *
134133 * @param array $params Массив параметров
135134 *
136- * @return array
135+ * @return string
137136 * @throws GuzzleException
138137 */
139- public function stationCode (array $ params ): array
138+ public function stationCode (array $ params ): string
140139 {
141140 $ lang = [
142141 'lang ' => $ this ->lang ,
@@ -156,6 +155,6 @@ public function stationCode(array $params): array
156155 }
157156 }
158157
159- return $ stations ;
158+ return json_encode ( $ stations, JSON_UNESCAPED_UNICODE ) ;
160159 }
161160}
0 commit comments