Completed
Push — 2.7 ( f4a577 )
by
unknown
01:06
created
src/SWP/Bundle/CoreBundle/Controller/FbApplicationController.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -35,38 +35,38 @@  discard block
 block discarded – undo
35 35
 
36 36
 class FbApplicationController extends Controller {
37 37
 
38
-  private FormFactoryInterface $formFactory;
39
-  private RepositoryInterface $facebookAppRepository;
40
-  private RepositoryInterface $facebookPageRepository;
41
-  private Factory $facebookAppFactory;
42
-  private EventDispatcherInterface $eventDispatcher;
43
-
44
-  /**
45
-   * @param FormFactoryInterface $formFactory
46
-   * @param RepositoryInterface $facebookAppRepository
47
-   * @param RepositoryInterface $facebookPageRepository
48
-   * @param Factory $facebookAppFactory
49
-   * @param EventDispatcherInterface $eventDispatcher
50
-   */
51
-  public function __construct(FormFactoryInterface     $formFactory, RepositoryInterface $facebookAppRepository,
52
-                              RepositoryInterface      $facebookPageRepository, Factory $facebookAppFactory,
53
-                              EventDispatcherInterface $eventDispatcher) {
38
+    private FormFactoryInterface $formFactory;
39
+    private RepositoryInterface $facebookAppRepository;
40
+    private RepositoryInterface $facebookPageRepository;
41
+    private Factory $facebookAppFactory;
42
+    private EventDispatcherInterface $eventDispatcher;
43
+
44
+    /**
45
+     * @param FormFactoryInterface $formFactory
46
+     * @param RepositoryInterface $facebookAppRepository
47
+     * @param RepositoryInterface $facebookPageRepository
48
+     * @param Factory $facebookAppFactory
49
+     * @param EventDispatcherInterface $eventDispatcher
50
+     */
51
+    public function __construct(FormFactoryInterface     $formFactory, RepositoryInterface $facebookAppRepository,
52
+                                RepositoryInterface      $facebookPageRepository, Factory $facebookAppFactory,
53
+                                EventDispatcherInterface $eventDispatcher) {
54 54
     $this->formFactory = $formFactory;
55 55
     $this->facebookAppRepository = $facebookAppRepository;
56 56
     $this->facebookPageRepository = $facebookPageRepository;
57 57
     $this->facebookAppFactory = $facebookAppFactory;
58 58
     $this->eventDispatcher = $eventDispatcher;
59
-  }
59
+    }
60 60
 
61 61
 
62
-  /**
63
-   * @Route("/api/{version}/facebook/applications/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_facebook_applications")
64
-   */
65
-  public function listAction(Request $request): ResourcesListResponseInterface {
62
+    /**
63
+     * @Route("/api/{version}/facebook/applications/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_facebook_applications")
64
+     */
65
+    public function listAction(Request $request): ResourcesListResponseInterface {
66 66
     $repository = $this->facebookAppRepository;
67 67
     $sort = $request->query->all('sorting');
68 68
     if (empty($sort)) {
69
-      $sort = ['id' => 'asc'];
69
+        $sort = ['id' => 'asc'];
70 70
     }
71 71
     $items = $repository->getPaginatedByCriteria(
72 72
         $this->eventDispatcher,
@@ -76,51 +76,51 @@  discard block
 block discarded – undo
76 76
     );
77 77
 
78 78
     return new ResourcesListResponse($items);
79
-  }
79
+    }
80 80
 
81
-  /**
82
-   * @Route("/api/{version}/facebook/applications/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_create_facebook_applications")
83
-   */
84
-  public function createAction(Request $request) {
81
+    /**
82
+     * @Route("/api/{version}/facebook/applications/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_create_facebook_applications")
83
+     */
84
+    public function createAction(Request $request) {
85 85
     /* @var FacebookApplication $feed */
86 86
     $application = $this->facebookAppFactory->create();
87 87
     $form = $this->formFactory->createNamed('', FacebookApplicationType::class, $application, ['method' => $request->getMethod()]);
88 88
 
89 89
     $form->handleRequest($request);
90 90
     if ($form->isSubmitted() && $form->isValid()) {
91
-      $this->checkIfApplicationExists($application);
92
-      $this->facebookAppRepository->add($application);
91
+        $this->checkIfApplicationExists($application);
92
+        $this->facebookAppRepository->add($application);
93 93
 
94
-      return new SingleResourceResponse($application, new ResponseContext(201));
94
+        return new SingleResourceResponse($application, new ResponseContext(201));
95 95
     }
96 96
 
97 97
     return new SingleResourceResponse($form, new ResponseContext(400));
98
-  }
98
+    }
99 99
 
100
-  /**
101
-   * @Route("/api/{version}/facebook/applications/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_delete_facebook_applications")
102
-   */
103
-  public function deleteAction($id) {
100
+    /**
101
+     * @Route("/api/{version}/facebook/applications/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_delete_facebook_applications")
102
+     */
103
+    public function deleteAction($id) {
104 104
     $repository = $this->facebookAppRepository;
105 105
     if (null === $application = $repository->findOneBy(['id' => $id])) {
106
-      throw new NotFoundHttpException('There is no Application with provided id!');
106
+        throw new NotFoundHttpException('There is no Application with provided id!');
107 107
     }
108 108
 
109 109
     if (null !== $page = $this->facebookPageRepository->findOneBy(['id' => $id])) {
110
-      throw new ConflictHttpException(sprintf('This Application is used by page with id: %s!', $page->getId()));
110
+        throw new ConflictHttpException(sprintf('This Application is used by page with id: %s!', $page->getId()));
111 111
     }
112 112
 
113 113
     $repository->remove($application);
114 114
 
115 115
     return new SingleResourceResponse(null, new ResponseContext(204));
116
-  }
116
+    }
117 117
 
118
-  private function checkIfApplicationExists(ApplicationInterface $application) {
118
+    private function checkIfApplicationExists(ApplicationInterface $application) {
119 119
     if (null !== $this->facebookAppRepository->findOneBy([
120 120
             'appId' => $application->getAppId(),
121 121
         ])
122 122
     ) {
123
-      throw new ConflictHttpException('This Application already exists!');
123
+        throw new ConflictHttpException('This Application already exists!');
124
+    }
124 125
     }
125
-  }
126 126
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/FbiaArticleController.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -29,32 +29,32 @@  discard block
 block discarded – undo
29 29
 
30 30
 class FbiaArticleController extends Controller {
31 31
 
32
-  private FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository;
33
-  private FacebookInstantArticlesService $facebookInstantArticlesService;
34
-  private EventDispatcherInterface $eventDispatcher;
32
+    private FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository;
33
+    private FacebookInstantArticlesService $facebookInstantArticlesService;
34
+    private EventDispatcherInterface $eventDispatcher;
35 35
 
36
-  /**
37
-   * @param FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository
38
-   * @param FacebookInstantArticlesService $facebookInstantArticlesService
39
-   * @param EventDispatcherInterface $eventDispatcher
40
-   */
41
-  public function __construct(FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository,
42
-                              FacebookInstantArticlesService           $facebookInstantArticlesService,
43
-                              EventDispatcherInterface                 $eventDispatcher) {
36
+    /**
37
+     * @param FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository
38
+     * @param FacebookInstantArticlesService $facebookInstantArticlesService
39
+     * @param EventDispatcherInterface $eventDispatcher
40
+     */
41
+    public function __construct(FacebookInstantArticlesArticleRepository $facebookInstantArticlesArticleRepository,
42
+                                FacebookInstantArticlesService           $facebookInstantArticlesService,
43
+                                EventDispatcherInterface                 $eventDispatcher) {
44 44
     $this->facebookInstantArticlesArticleRepository = $facebookInstantArticlesArticleRepository;
45 45
     $this->facebookInstantArticlesService = $facebookInstantArticlesService;
46 46
     $this->eventDispatcher = $eventDispatcher;
47
-  }
47
+    }
48 48
 
49 49
 
50
-  /**
51
-   * @Route("/api/{version}/facebook/instantarticles/articles/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_facebook_instant_articles_articles")
52
-   */
53
-  public function listAction(Request $request): ResourcesListResponseInterface {
50
+    /**
51
+     * @Route("/api/{version}/facebook/instantarticles/articles/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_facebook_instant_articles_articles")
52
+     */
53
+    public function listAction(Request $request): ResourcesListResponseInterface {
54 54
     $repository = $this->facebookInstantArticlesArticleRepository;
55 55
     $sort = $request->query->all('sorting');
56 56
     if (empty($sort)) {
57
-      $sort = ['createdAt' => 'desc'];
57
+        $sort = ['createdAt' => 'desc'];
58 58
     }
59 59
     $items = $repository->getPaginatedByCriteria(
60 60
         $this->eventDispatcher,
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
     );
65 65
 
66 66
     return new ResourcesListResponse($items);
67
-  }
67
+    }
68 68
 
69
-  /**
70
-   * @Route("/api/{version}/facebook/instantarticles/articles/{submissionId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_facebook_instant_articles_articles_update")
71
-   */
72
-  public function updateSubmissionAction(string $submissionId): SingleResourceResponseInterface {
69
+    /**
70
+     * @Route("/api/{version}/facebook/instantarticles/articles/{submissionId}", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_facebook_instant_articles_articles_update")
71
+     */
72
+    public function updateSubmissionAction(string $submissionId): SingleResourceResponseInterface {
73 73
     $instantArticlesService = $this->facebookInstantArticlesService;
74 74
     $instantArticle = $instantArticlesService->updateSubmissionStatus($submissionId);
75 75
 
76 76
     return new SingleResourceResponse($instantArticle);
77
-  }
77
+    }
78 78
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Resolver/ArticleResolver.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,29 +43,29 @@
 block discarded – undo
43 43
     {
44 44
         $collectionRouteCacheKey = md5('route_'.$url);
45 45
         return $this->cacheProvider->get($collectionRouteCacheKey, function (ItemInterface $item, &$save) use ($url) {
46
-          try {
46
+            try {
47 47
             $route = $this->matcher->match($this->getFragmentFromUrl($url, 'path'));
48
-          } catch(ResourceNotFoundException $e) {
48
+            } catch(ResourceNotFoundException $e) {
49 49
             $save = false;
50 50
             return null;
51
-          }
52
-          if(!isset($route['_article_meta'])) {
51
+            }
52
+            if(!isset($route['_article_meta'])) {
53 53
             $save = false;
54 54
             return null;
55
-          }
55
+            }
56 56
 
57
-          if(!($route['_article_meta'] instanceof Meta)) {
57
+            if(!($route['_article_meta'] instanceof Meta)) {
58 58
             $save = false;
59 59
             return null;
60
-          }
60
+            }
61 61
 
62
-          $values = $route['_article_meta']->getValues();
63
-          if(!($values instanceof ArticleInterface)) {
62
+            $values = $route['_article_meta']->getValues();
63
+            if(!($values instanceof ArticleInterface)) {
64 64
             $save = false;
65 65
             return null;
66
-          }
66
+            }
67 67
 
68
-          return $values;
68
+            return $values;
69 69
         });
70 70
     }
71 71
 
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Command/ThemeSetupCommand.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,16 +64,16 @@
 block discarded – undo
64 64
         ParameterBagInterface $parameterBag,
65 65
         ThemeServiceInterface $themeService
66 66
     ) {
67
-      $this->tenantContext = $tenantContext;
68
-      $this->tenantRepository = $tenantRepository;
69
-      $this->eventDispatcher = $eventDispatcher;
70
-      $this->parameterBag = $parameterBag;
71
-      $this->themeService = $themeService;
72
-      parent::__construct();
67
+        $this->tenantContext = $tenantContext;
68
+        $this->tenantRepository = $tenantRepository;
69
+        $this->eventDispatcher = $eventDispatcher;
70
+        $this->parameterBag = $parameterBag;
71
+        $this->themeService = $themeService;
72
+        parent::__construct();
73 73
     }
74 74
 
75 75
 
76
-  /**
76
+    /**
77 77
      * {@inheritdoc}
78 78
      */
79 79
     protected function configure()
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Command/ThemeGenerateCommand.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@
 block discarded – undo
45 45
      * @param OrganizationRepositoryInterface $organizationRepository
46 46
      */
47 47
     public function __construct(ParameterBagInterface $parameterBag, OrganizationRepositoryInterface $organizationRepository) {
48
-      $this->parameterBag = $parameterBag;
49
-      $this->organizationRepository = $organizationRepository;
50
-      parent::__construct();
48
+        $this->parameterBag = $parameterBag;
49
+        $this->organizationRepository = $organizationRepository;
50
+        parent::__construct();
51 51
     }
52 52
 
53 53
     /**
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Provider/CachedSubscriptionsProvider.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
         $cacheKey = urlencode($this->generateCacheKey($subscriber).implode('_', $filters));
66 66
 
67 67
         return $this->cacheProvider->get($cacheKey, function (ItemInterface $item) use ($subscriber, $filters) {
68
-          $item->expiresAfter($this->cacheLifeTime);
69
-          return $this->decoratedProvider->getSubscriptions($subscriber, $filters);
68
+            $item->expiresAfter($this->cacheLifeTime);
69
+            return $this->decoratedProvider->getSubscriptions($subscriber, $filters);
70 70
         });
71 71
     }
72 72
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $cacheKey = urlencode($this->generateCacheKey($subscriber, self::CACHE_KEY_VALID).implode('_', $filters));
76 76
         return $this->cacheProvider->get($cacheKey, function (ItemInterface $item) use ($subscriber, $filters) {
77
-          $item->expiresAfter($this->cacheLifeTime);
78
-          return $this->decoratedProvider->getSubscription($subscriber, $filters);
77
+            $item->expiresAfter($this->cacheLifeTime);
78
+            return $this->decoratedProvider->getSubscription($subscriber, $filters);
79 79
         });
80 80
     }
81 81
 
Please login to merge, or discard this patch.
src/SWP/Bundle/MultiTenancyBundle/Command/CreateOrganizationCommand.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,18 +39,18 @@
 block discarded – undo
39 39
     /** @var OrganizationFactoryInterface */
40 40
     private  $organizationFactory;
41 41
 
42
-  /**
43
-   * @param OrganizationRepositoryInterface $organizationRepository
44
-   * @param OrganizationFactoryInterface $organizationFactory
45
-   */
46
-  public function __construct( OrganizationRepositoryInterface $organizationRepository, OrganizationFactoryInterface $organizationFactory) {
42
+    /**
43
+     * @param OrganizationRepositoryInterface $organizationRepository
44
+     * @param OrganizationFactoryInterface $organizationFactory
45
+     */
46
+    public function __construct( OrganizationRepositoryInterface $organizationRepository, OrganizationFactoryInterface $organizationFactory) {
47 47
     $this->organizationRepository = $organizationRepository;
48 48
     $this->organizationFactory = $organizationFactory;
49 49
     parent::__construct();
50
-  }
50
+    }
51 51
 
52 52
 
53
-  /**
53
+    /**
54 54
      * {@inheritdoc}
55 55
      */
56 56
     protected function configure()
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Controller/AuthorController.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@
 block discarded – undo
27 27
 
28 28
 class AuthorController extends AbstractController {
29 29
 
30
-  private ArticleAuthorRepositoryInterface $articleAuthorRepository; // swp.repository.author
30
+    private ArticleAuthorRepositoryInterface $articleAuthorRepository; // swp.repository.author
31 31
 
32
-  /**
33
-   * @param ArticleAuthorRepositoryInterface $articleAuthorRepository
34
-   */
35
-  public function __construct(ArticleAuthorRepositoryInterface $articleAuthorRepository) {
32
+    /**
33
+     * @param ArticleAuthorRepositoryInterface $articleAuthorRepository
34
+     */
35
+    public function __construct(ArticleAuthorRepositoryInterface $articleAuthorRepository) {
36 36
     $this->articleAuthorRepository = $articleAuthorRepository;
37
-  }
37
+    }
38 38
 
39
-  /**
40
-   * @Route("/api/{version}/authors/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_delete_author", requirements={"id"="\d+"})
41
-   */
42
-  public function deleteAction(int $id): SingleResourceResponseInterface {
39
+    /**
40
+     * @Route("/api/{version}/authors/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_core_delete_author", requirements={"id"="\d+"})
41
+     */
42
+    public function deleteAction(int $id): SingleResourceResponseInterface {
43 43
     $authorRepository = $this->articleAuthorRepository;
44 44
     $author = $this->findOr404($id);
45 45
 
46 46
     $authorRepository->remove($author);
47 47
 
48 48
     return new SingleResourceResponse(null, new ResponseContext(204));
49
-  }
49
+    }
50 50
 
51
-  private function findOr404(int $id): ArticleAuthorInterface {
51
+    private function findOr404(int $id): ArticleAuthorInterface {
52 52
     if (null === $author = $this->articleAuthorRepository->findOneById($id)) {
53
-      throw new NotFoundHttpException('Author was not found.');
53
+        throw new NotFoundHttpException('Author was not found.');
54 54
     }
55 55
 
56 56
     return $author;
57
-  }
57
+    }
58 58
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Controller/RouteController.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -42,31 +42,31 @@  discard block
 block discarded – undo
42 42
 
43 43
 class RouteController extends FOSRestController {
44 44
 
45
-  private FormFactoryInterface $formFactory;
46
-  private EventDispatcherInterface $eventDispatcher;
47
-  private RouteProviderInterface $routeProvider; // swp.provider.route
48
-  private RouteRepositoryInterface $routeRepository; // swp.repository.route
49
-  private RouteServiceInterface $routeService; // swp.service.route
50
-  private RouteFactoryInterface $routeFactory; // swp.factory.route
51
-  private KnpPaginatorRepresentationFactory $knpPaginatorRepresentationFactory; //swp_pagination_rep
52
-  private EntityManagerInterface $entityManager; // swp.object_manager.route
53
-
54
-  /**
55
-   * @param FormFactoryInterface $formFactory
56
-   * @param EventDispatcherInterface $eventDispatcher
57
-   * @param RouteProviderInterface $routeProvider
58
-   * @param RouteRepositoryInterface $routeRepository
59
-   * @param RouteServiceInterface $routeService
60
-   * @param RouteFactoryInterface $routeFactory
61
-   * @param KnpPaginatorRepresentationFactory $knpPaginatorRepresentationFactory
62
-   * @param EntityManagerInterface $entityManager
63
-   */
64
-  public function __construct(FormFactoryInterface              $formFactory, EventDispatcherInterface $eventDispatcher,
65
-                              RouteProviderInterface            $routeProvider,
66
-                              RouteRepositoryInterface          $routeRepository, RouteServiceInterface $routeService,
67
-                              RouteFactoryInterface             $routeFactory,
68
-                              KnpPaginatorRepresentationFactory $knpPaginatorRepresentationFactory,
69
-                              EntityManagerInterface            $entityManager) {
45
+    private FormFactoryInterface $formFactory;
46
+    private EventDispatcherInterface $eventDispatcher;
47
+    private RouteProviderInterface $routeProvider; // swp.provider.route
48
+    private RouteRepositoryInterface $routeRepository; // swp.repository.route
49
+    private RouteServiceInterface $routeService; // swp.service.route
50
+    private RouteFactoryInterface $routeFactory; // swp.factory.route
51
+    private KnpPaginatorRepresentationFactory $knpPaginatorRepresentationFactory; //swp_pagination_rep
52
+    private EntityManagerInterface $entityManager; // swp.object_manager.route
53
+
54
+    /**
55
+     * @param FormFactoryInterface $formFactory
56
+     * @param EventDispatcherInterface $eventDispatcher
57
+     * @param RouteProviderInterface $routeProvider
58
+     * @param RouteRepositoryInterface $routeRepository
59
+     * @param RouteServiceInterface $routeService
60
+     * @param RouteFactoryInterface $routeFactory
61
+     * @param KnpPaginatorRepresentationFactory $knpPaginatorRepresentationFactory
62
+     * @param EntityManagerInterface $entityManager
63
+     */
64
+    public function __construct(FormFactoryInterface              $formFactory, EventDispatcherInterface $eventDispatcher,
65
+                                RouteProviderInterface            $routeProvider,
66
+                                RouteRepositoryInterface          $routeRepository, RouteServiceInterface $routeService,
67
+                                RouteFactoryInterface             $routeFactory,
68
+                                KnpPaginatorRepresentationFactory $knpPaginatorRepresentationFactory,
69
+                                EntityManagerInterface            $entityManager) {
70 70
     $this->formFactory = $formFactory;
71 71
     $this->eventDispatcher = $eventDispatcher;
72 72
     $this->routeProvider = $routeProvider;
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
     $this->routeFactory = $routeFactory;
76 76
     $this->knpPaginatorRepresentationFactory = $knpPaginatorRepresentationFactory;
77 77
     $this->entityManager = $entityManager;
78
-  }
78
+    }
79 79
 
80 80
 
81
-  /**
82
-   * @Route("/api/{version}/content/routes/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_list_routes")
83
-   */
84
-  public function listAction(Request $request) {
81
+    /**
82
+     * @Route("/api/{version}/content/routes/", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_list_routes")
83
+     */
84
+    public function listAction(Request $request) {
85 85
     $routeRepository = $this->routeRepository;
86 86
 
87 87
     $routes = $routeRepository->getPaginatedByCriteria($this->eventDispatcher, new Criteria([
@@ -89,28 +89,28 @@  discard block
 block discarded – undo
89 89
     ]), $request->query->all('sorting'), new PaginationData($request));
90 90
 
91 91
     return $this->handleView(View::create($this->knpPaginatorRepresentationFactory->createRepresentation($routes, $request), 200));
92
-  }
92
+    }
93 93
 
94
-  /**
95
-   * @Route("/api/{version}/content/routes/{id}", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_show_routes", requirements={"id"=".+"})
96
-   */
97
-  public function getAction($id) {
94
+    /**
95
+     * @Route("/api/{version}/content/routes/{id}", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_show_routes", requirements={"id"=".+"})
96
+     */
97
+    public function getAction($id) {
98 98
     return new SingleResourceResponse($this->findOr404($id));
99
-  }
99
+    }
100 100
 
101
-  /**
102
-   * @Route("/api/{version}/content/routes/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_delete_routes", requirements={"id"=".+"})
103
-   */
104
-  public function deleteAction(int $id): Response {
101
+    /**
102
+     * @Route("/api/{version}/content/routes/{id}", methods={"DELETE"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_delete_routes", requirements={"id"=".+"})
103
+     */
104
+    public function deleteAction(int $id): Response {
105 105
     $repository = $this->routeRepository;
106 106
     $route = $this->findOr404($id);
107 107
 
108 108
     if (null !== $route->getContent()) {
109
-      throw new ConflictHttpException('Route has content attached to it.');
109
+        throw new ConflictHttpException('Route has content attached to it.');
110 110
     }
111 111
 
112 112
     if (0 < $route->getChildren()->count()) {
113
-      throw new ConflictHttpException('Remove route children before removing this route.');
113
+        throw new ConflictHttpException('Remove route children before removing this route.');
114 114
     }
115 115
 
116 116
     $eventDispatcher = $this->eventDispatcher;
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
     $eventDispatcher->dispatch(new RouteEvent($route, RouteEvents::POST_DELETE), RouteEvents::POST_DELETE);
120 120
 
121 121
     return $this->handleView(View::create(true, 204));
122
-  }
122
+    }
123 123
 
124
-  /**
125
-   * @Route("/api/{version}/content/routes/", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_create_routes")
126
-   */
127
-  public function createAction(Request $request): SingleResourceResponseInterface {
124
+    /**
125
+     * @Route("/api/{version}/content/routes/", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_create_routes")
126
+     */
127
+    public function createAction(Request $request): SingleResourceResponseInterface {
128 128
     /** @var RouteInterface $route */
129 129
     $route = $this->routeFactory->create();
130 130
     $form = $this->formFactory->createNamed('', RouteType::class, $route, ['method' => $request->getMethod()]);
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
     $this->ensureRouteExists($route->getName());
134 134
 
135 135
     if ($form->isSubmitted() && $form->isValid()) {
136
-      $route = $this->routeService->createRoute($form->getData());
136
+        $route = $this->routeService->createRoute($form->getData());
137 137
 
138
-      $this->routeRepository->add($route);
138
+        $this->routeRepository->add($route);
139 139
 
140
-      return new SingleResourceResponse($route, new ResponseContext(201));
140
+        return new SingleResourceResponse($route, new ResponseContext(201));
141 141
     }
142 142
 
143 143
     return new SingleResourceResponse($form, new ResponseContext(400));
144
-  }
144
+    }
145 145
 
146
-  /**
147
-   * @Route("/api/{version}/content/routes/{id}", methods={"PATCH"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_update_routes", requirements={"id"=".+"})
148
-   */
149
-  public function updateAction(Request $request, $id): Response {
146
+    /**
147
+     * @Route("/api/{version}/content/routes/{id}", methods={"PATCH"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_update_routes", requirements={"id"=".+"})
148
+     */
149
+    public function updateAction(Request $request, $id): Response {
150 150
     $objectManager = $this->entityManager;
151 151
     $route = $this->findOr404($id);
152 152
     $previousRoute = clone $route;
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
     $form->handleRequest($request);
155 155
 
156 156
     if ($form->isSubmitted() && $form->isValid()) {
157
-      $route = $this->routeService->updateRoute($previousRoute, $form->getData());
157
+        $route = $this->routeService->updateRoute($previousRoute, $form->getData());
158 158
 
159
-      $objectManager->flush();
159
+        $objectManager->flush();
160 160
 
161
-      return $this->handleView(View::create($route, 200));
161
+        return $this->handleView(View::create($route, 200));
162 162
     }
163 163
 
164 164
     return $this->handleView(View::create($form, 400));
165
-  }
165
+    }
166 166
 
167
-  private function findOr404($id) {
167
+    private function findOr404($id) {
168 168
     if (null === $route = $this->routeProvider->getOneById($id)) {
169
-      throw new NotFoundHttpException('Route was not found.');
169
+        throw new NotFoundHttpException('Route was not found.');
170 170
     }
171 171
 
172 172
     return $route;
173
-  }
173
+    }
174 174
 
175
-  private function ensureRouteExists($name) {
175
+    private function ensureRouteExists($name) {
176 176
     if (null !== $this->routeRepository->findOneByName($name)) {
177
-      throw new ConflictHttpException(sprintf('Route "%s" already exists!', $name));
177
+        throw new ConflictHttpException(sprintf('Route "%s" already exists!', $name));
178
+    }
178 179
     }
179
-  }
180 180
 }
Please login to merge, or discard this patch.