88use AppBundle \Exception \WrongInputException ;
99use AppBundle \Exception \WrongInputExceptionArray ;
1010use AppBundle \Service \LxdApi \ImageAliasApi ;
11- use Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \Route ;
11+ use Symfony \ Component \ Routing \ Annotation \Route ;
1212use Symfony \Component \HttpFoundation \Request ;
1313use Swagger \Annotations as OAS ;
1414use Symfony \Component \HttpFoundation \Response ;
@@ -76,7 +76,7 @@ public function createAliasForImage($imageId, Request $request, ImageAliasApi $i
7676 );
7777 }
7878
79- if (!$ image ->isFinished ()){
79+ if (!$ image ->isFinished ()) {
8080 throw new WrongInputException ('ImageAlias creation is only supported for Images where the creation process is finished ' );
8181 }
8282
@@ -93,8 +93,8 @@ public function createAliasForImage($imageId, Request $request, ImageAliasApi $i
9393
9494 $ result = $ imageAliasApi ->createAliasForImageByFingerprint ($ image ->getHost (), $ imageAlias , $ image ->getFingerprint ());
9595
96- if ($ result ->code != 201 || $ result ->body ->status_code != 200 ){
97- throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
96+ if ($ result ->code != 201 || $ result ->body ->status_code != 200 ) {
97+ throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
9898 }
9999
100100 $ em = $ this ->getDoctrine ()->getManager ();
@@ -143,7 +143,8 @@ public function createAliasForImage($imageId, Request $request, ImageAliasApi $i
143143 * @throws WrongInputException
144144 * @throws \Httpful\Exception\ConnectionErrorException
145145 */
146- public function deleteImageAlias ($ aliasId , ImageAliasApi $ imageAliasApi ){
146+ public function deleteImageAlias ($ aliasId , ImageAliasApi $ imageAliasApi )
147+ {
147148 $ imageAlias = $ this ->getDoctrine ()->getRepository (ImageAlias::class)->find ($ aliasId );
148149
149150 if (!$ imageAlias ) {
@@ -154,14 +155,14 @@ public function deleteImageAlias($aliasId, ImageAliasApi $imageAliasApi){
154155
155156 $ image = $ imageAlias ->getImage ();
156157
157- if (!$ image ->isFinished ()){
158+ if (!$ image ->isFinished ()) {
158159 throw new WrongInputException ('Deleting of the ImageAlias for an Image which is in the creation process is not possible ' );
159160 }
160161
161162 $ result = $ imageAliasApi ->removeAliasByName ($ image ->getHost (), $ imageAlias ->getName ());
162163
163- if ($ result ->code != 200 || $ result ->body ->status_code != 200 ){
164- throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
164+ if ($ result ->code != 200 || $ result ->body ->status_code != 200 ) {
165+ throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
165166 }
166167
167168 $ image ->removeAlias ($ imageAlias );
@@ -229,7 +230,8 @@ public function deleteImageAlias($aliasId, ImageAliasApi $imageAliasApi){
229230 * @throws \Httpful\Exception\ConnectionErrorException
230231 * @throws WrongInputExceptionArray
231232 */
232- public function editImageAlias ($ aliasId , Request $ request ,ImageAliasApi $ imageAliasApi ){
233+ public function editImageAlias ($ aliasId , Request $ request , ImageAliasApi $ imageAliasApi )
234+ {
233235 $ imageAlias = $ this ->getDoctrine ()->getRepository (ImageAlias::class)->find ($ aliasId );
234236
235237 if (!$ imageAlias ) {
@@ -240,12 +242,12 @@ public function editImageAlias($aliasId, Request $request,ImageAliasApi $imageAl
240242
241243 $ image = $ imageAlias ->getImage ();
242244
243- if (!$ image ->isFinished ()){
245+ if (!$ image ->isFinished ()) {
244246 throw new WrongInputException ('Editing of the ImageAlias for an Image which is in the creation process is not possible ' );
245247 }
246248
247249 $ previousName = null ;
248- if ($ request ->request ->has ('name ' )){
250+ if ($ request ->request ->has ('name ' )) {
249251 $ previousName = $ imageAlias ->getName ();
250252 $ imageAlias ->setName ($ request ->request ->get ('name ' ));
251253 }
@@ -262,18 +264,18 @@ public function editImageAlias($aliasId, Request $request,ImageAliasApi $imageAl
262264 }
263265
264266 //Check if a name update via LXD is necessary
265- if ($ previousName != null && $ previousName != $ imageAlias ->getName ()){
267+ if ($ previousName != null && $ previousName != $ imageAlias ->getName ()) {
266268 $ result = $ imageAliasApi ->editAliasName ($ image ->getHost (), $ imageAlias , $ previousName );
267- if ($ result ->code != 201 || $ result ->body ->status_code != 200 ){
268- throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
269+ if ($ result ->code != 201 || $ result ->body ->status_code != 200 ) {
270+ throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
269271 }
270272 }
271273
272274 //Check if a description update via LXD is necessary
273- if ($ previousDescription != null && $ previousDescription != $ imageAlias ->getDescription ()){
275+ if ($ previousDescription != null && $ previousDescription != $ imageAlias ->getDescription ()) {
274276 $ result = $ imageAliasApi ->editAliasDescription ($ image ->getHost (), $ imageAlias );
275- if ($ result ->code != 200 || $ result ->body ->status_code != 200 ){
276- throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
277+ if ($ result ->code != 200 || $ result ->body ->status_code != 200 ) {
278+ throw new WrongInputException ('LXD-Error - ' . $ result ->body ->error );
277279 }
278280 }
279281
0 commit comments