11<?php
2+ declare (strict_types=1 );
3+
24namespace Flowpack \ElasticSearch \Domain \Model ;
35
46/*
@@ -114,7 +116,7 @@ public function __construct($name, Client $client = null)
114116 * @param array $settings
115117 * @return void
116118 */
117- public function injectSettings (array $ settings )
119+ public function injectSettings (array $ settings ): void
118120 {
119121 $ this ->settings = $ settings ;
120122 }
@@ -123,7 +125,7 @@ public function injectSettings(array $settings)
123125 * @param string $typeName
124126 * @return AbstractType
125127 */
126- public function findType ($ typeName )
128+ public function findType ($ typeName ): AbstractType
127129 {
128130 return new GenericType ($ this , $ typeName );
129131 }
@@ -132,15 +134,16 @@ public function findType($typeName)
132134 * @param array <AbstractType> $types
133135 * @return TypeGroup
134136 */
135- public function findTypeGroup (array $ types )
137+ public function findTypeGroup (array $ types ): TypeGroup
136138 {
137139 return new TypeGroup ($ this , $ types );
138140 }
139141
140142 /**
141- * @return boolean
143+ * @return bool
144+ * @throws \Exception
142145 */
143- public function exists ()
146+ public function exists (): bool
144147 {
145148 $ response = $ this ->request ('HEAD ' );
146149
@@ -152,14 +155,14 @@ public function exists()
152155 * @param string $path
153156 * @param array $arguments
154157 * @param string $content
155- * @param boolean $prefixIndex
158+ * @param bool $prefixIndex
156159 * @return Response
157- * @throws ElasticSearchException
160+ * @throws \Exception
158161 */
159- public function request ($ method , $ path = null , array $ arguments = [], $ content = null , $ prefixIndex = true )
162+ public function request (string $ method , ? string $ path = null , array $ arguments = [], ? string $ content = null , bool $ prefixIndex = true ): Response
160163 {
161164 if ($ this ->client === null ) {
162- throw new Exception ('The client of the index " ' . $ this ->name . '" is not set, hence no requests can be done. ' );
165+ throw new \ Exception ('The client of the index " ' . $ this ->name . '" is not set, hence no requests can be done. ' , 1566313883 );
163166 }
164167 $ path = ($ path ? trim ($ path ) : '' );
165168 if ($ prefixIndex === true ) {
@@ -173,8 +176,9 @@ public function request($method, $path = null, array $arguments = [], $content =
173176
174177 /**
175178 * @return void
179+ * @throws \Exception
176180 */
177- public function create ()
181+ public function create (): void
178182 {
179183 $ this ->request ('PUT ' , null , [], json_encode ($ this ->getSettings ()));
180184 }
@@ -196,6 +200,7 @@ protected function getSettings()
196200
197201 /**
198202 * @return void
203+ * @throws \Exception
199204 */
200205 public function updateSettings ()
201206 {
0 commit comments