Completed
Push — SWP-2230-php7-fix ( 3795ee )
by
unknown
30s
created
src/SWP/Bundle/CoreBundle/Twig/DecoratingRoutingExtension.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,88 +36,88 @@
 block discarded – undo
36 36
 use Twig\TwigFunction;
37 37
 
38 38
 final class DecoratingRoutingExtension extends AbstractExtension {
39
-  private RoutingExtension $routingExtension;
39
+    private RoutingExtension $routingExtension;
40 40
 
41
-  public function __construct(RoutingExtension $routingExtension) {
41
+    public function __construct(RoutingExtension $routingExtension) {
42 42
     $this->routingExtension = $routingExtension;
43
-  }
43
+    }
44 44
 
45
-  public function getPath($name, $parameters = [], $relative = false): ?string {
45
+    public function getPath($name, $parameters = [], $relative = false): ?string {
46 46
     if ($name == null) {
47
-      return null;
47
+        return null;
48 48
     }
49 49
 
50 50
     if (is_object($name)) {
51
-      $object = $name;
52
-      $name = null;
53
-      self::setupParams($object, $name, $parameters);
51
+        $object = $name;
52
+        $name = null;
53
+        self::setupParams($object, $name, $parameters);
54 54
     }
55 55
 
56 56
     try {
57
-      return $this->routingExtension->getPath($name, $parameters, $relative);
57
+        return $this->routingExtension->getPath($name, $parameters, $relative);
58 58
     } catch (RouteNotFoundException|MissingMandatoryParametersException|InvalidParameterException $e) {
59
-      // allow empty path
59
+        // allow empty path
60 60
     }
61 61
 
62 62
     return null;
63
-  }
63
+    }
64 64
 
65
-  public function getUrl($name, $parameters = [], $schemeRelative = false): ?string {
65
+    public function getUrl($name, $parameters = [], $schemeRelative = false): ?string {
66 66
     if ($name == null) {
67
-      return null;
67
+        return null;
68 68
     }
69 69
 
70 70
     if (is_object($name)) {
71
-      $object = $name;
72
-      $name = null;
73
-      self::setupParams($object, $name, $parameters);
71
+        $object = $name;
72
+        $name = null;
73
+        self::setupParams($object, $name, $parameters);
74 74
     }
75 75
 
76 76
     try {
77
-      return $this->routingExtension->getUrl($name, $parameters, $schemeRelative);
77
+        return $this->routingExtension->getUrl($name, $parameters, $schemeRelative);
78 78
     } catch (RouteNotFoundException|MissingMandatoryParametersException|InvalidParameterException $e) {
79
-      // allow empty url
79
+        // allow empty url
80 80
     }
81 81
 
82 82
     return null;
83
-  }
83
+    }
84 84
 
85
-  public static function setupParams(object $object, &$name, &$parameters) {
85
+    public static function setupParams(object $object, &$name, &$parameters) {
86 86
     $name = RouteObjectInterface::OBJECT_BASED_ROUTE_NAME;
87 87
     $parameters[RouteObjectInterface::ROUTE_OBJECT] = $object;
88 88
 
89 89
     if ($object instanceof Meta) {
90
-      $values = $object->getValues();
91
-      if (($values instanceof ArticleMediaInterface || $values instanceof ImageRenditionInterface)) {
90
+        $values = $object->getValues();
91
+        if (($values instanceof ArticleMediaInterface || $values instanceof ImageRenditionInterface)) {
92 92
         $name = MediaRouter::OBJECT_BASED_ROUTE_NAME;
93 93
         return;
94
-      }
94
+        }
95 95
 
96
-      if ($values instanceof ArticleSeoMediaInterface) {
96
+        if ($values instanceof ArticleSeoMediaInterface) {
97 97
         $name = SeoMediaRouter::OBJECT_BASED_ROUTE_NAME;
98 98
         return;
99
-      }
99
+        }
100 100
 
101
-      if ($values instanceof AuthorMediaInterface) {
101
+        if ($values instanceof AuthorMediaInterface) {
102 102
         $name = ArticleAuthorMediaRouter::OBJECT_BASED_ROUTE_NAME;
103 103
         return;
104
-      }
104
+        }
105 105
 
106
-      if ($values instanceof ArticleInterface || $values instanceof RouteInterface) {
106
+        if ($values instanceof ArticleInterface || $values instanceof RouteInterface) {
107 107
         $name = MetaRouter::OBJECT_BASED_ROUTE_NAME;
108 108
         return;
109
-      }
109
+        }
110 110
     }
111 111
 
112 112
     if ($object instanceof RouteInterface || $object instanceof ArticleInterface) {
113
-      $name = MetaRouter::OBJECT_BASED_ROUTE_NAME;
113
+        $name = MetaRouter::OBJECT_BASED_ROUTE_NAME;
114
+    }
114 115
     }
115
-  }
116 116
 
117
-  public function getFunctions(): array {
117
+    public function getFunctions(): array {
118 118
     return [
119 119
         new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this->routingExtension, 'isUrlGenerationSafe']]),
120 120
         new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this->routingExtension, 'isUrlGenerationSafe']]),
121 121
     ];
122
-  }
122
+    }
123 123
 }
Please login to merge, or discard this patch.
src/BypassFinalHook.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 
7 7
 final class BypassFinalHook implements BeforeTestHook
8 8
 {
9
-  public function executeBeforeTest(string $test): void
10
-  {
9
+    public function executeBeforeTest(string $test): void
10
+    {
11 11
     BypassFinals::enable();
12
-  }
12
+    }
13 13
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/MenuController.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -37,83 +37,83 @@  discard block
 block discarded – undo
37 37
 
38 38
 class MenuController extends AbstractFOSRestController {
39 39
 
40
-  private FormFactoryInterface $formFactory;
41
-  private EventDispatcherInterface $eventDispatcher;
42
-  private MenuItemRepositoryInterface $menuItemRepository;
43
-  private MenuItemManager $menuItemManager;
44
-  private MenuFactoryInterface $menuFactory;
45
-
46
-  /**
47
-   * @param FormFactoryInterface $formFactory
48
-   * @param EventDispatcherInterface $eventDispatcher
49
-   * @param MenuItemRepositoryInterface $menuItemRepository
50
-   * @param MenuItemManager $menuItemManager
51
-   * @param MenuFactoryInterface $menuFactory
52
-   */
53
-  public function __construct(FormFactoryInterface        $formFactory, EventDispatcherInterface $eventDispatcher,
54
-                              MenuItemRepositoryInterface $menuItemRepository, MenuItemManager $menuItemManager,
55
-                              MenuFactoryInterface        $menuFactory) {
40
+    private FormFactoryInterface $formFactory;
41
+    private EventDispatcherInterface $eventDispatcher;
42
+    private MenuItemRepositoryInterface $menuItemRepository;
43
+    private MenuItemManager $menuItemManager;
44
+    private MenuFactoryInterface $menuFactory;
45
+
46
+    /**
47
+     * @param FormFactoryInterface $formFactory
48
+     * @param EventDispatcherInterface $eventDispatcher
49
+     * @param MenuItemRepositoryInterface $menuItemRepository
50
+     * @param MenuItemManager $menuItemManager
51
+     * @param MenuFactoryInterface $menuFactory
52
+     */
53
+    public function __construct(FormFactoryInterface        $formFactory, EventDispatcherInterface $eventDispatcher,
54
+                                MenuItemRepositoryInterface $menuItemRepository, MenuItemManager $menuItemManager,
55
+                                MenuFactoryInterface        $menuFactory) {
56 56
     $this->formFactory = $formFactory;
57 57
     $this->eventDispatcher = $eventDispatcher;
58 58
     $this->menuItemRepository = $menuItemRepository;
59 59
     $this->menuItemManager = $menuItemManager;
60 60
     $this->menuFactory = $menuFactory;
61
-  }
61
+    }
62 62
 
63 63
 
64
-  /**
65
-   * @Route("/api/{version}/menus/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_menu")
66
-   */
67
-  public function listAction(Request $request): ResourcesListResponseInterface {
64
+    /**
65
+     * @Route("/api/{version}/menus/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_menu")
66
+     */
67
+    public function listAction(Request $request): ResourcesListResponseInterface {
68 68
     $menuRepository = $this->menuItemRepository;
69 69
     $page = $request->query->get('page', 1);
70 70
     $limit = $request->query->get('limit', 10);
71 71
 
72 72
     return new ResourcesListResponse($menuRepository->findRootNodes($this->eventDispatcher, $page, $limit));
73
-  }
73
+    }
74 74
 
75
-  /**
76
-   * @Route("/api/{version}/menus/{id}/children/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_children_menu")
77
-   */
78
-  public function listChildrenAction($id): ResourcesListResponseInterface {
75
+    /**
76
+     * @Route("/api/{version}/menus/{id}/children/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_list_children_menu")
77
+     */
78
+    public function listChildrenAction($id): ResourcesListResponseInterface {
79 79
     $menuRepository = $this->menuItemRepository;
80 80
 
81 81
     $menus = $menuRepository->findChildrenAsTree($this->eventDispatcher, $this->findOr404($id));
82 82
 
83 83
     return new ResourcesListResponse($menus);
84
-  }
84
+    }
85 85
 
86
-  /**
87
-   * @Route("/api/{version}/menus/{id}/move/", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_move_menu", requirements={"id"="\d+"})
88
-   */
89
-  public function moveAction(Request $request, $id): SingleResourceResponseInterface {
86
+    /**
87
+     * @Route("/api/{version}/menus/{id}/move/", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_move_menu", requirements={"id"="\d+"})
88
+     */
89
+    public function moveAction(Request $request, $id): SingleResourceResponseInterface {
90 90
     $menuItem = $this->findOr404($id);
91 91
     $form = $this->formFactory->createNamed('', MenuItemMoveType::class, [], ['method' => $request->getMethod()]);
92 92
     $form->handleRequest($request);
93 93
 
94 94
     if ($form->isSubmitted() && $form->isValid()) {
95
-      $menuItemManager = $this->menuItemManager;
96
-      $formData = $form->getData();
95
+        $menuItemManager = $this->menuItemManager;
96
+        $formData = $form->getData();
97 97
 
98
-      $menuItemManager->move($menuItem, $formData['parent'], $formData['position']);
98
+        $menuItemManager->move($menuItem, $formData['parent'], $formData['position']);
99 99
 
100
-      return new SingleResourceResponse($menuItem);
100
+        return new SingleResourceResponse($menuItem);
101 101
     }
102 102
 
103 103
     return new SingleResourceResponse($form, new ResponseContext(400));
104
-  }
104
+    }
105 105
 
106
-  /**
107
-   * @Route("/api/{version}/menus/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_get_menu")
108
-   */
109
-  public function getAction($id): SingleResourceResponseInterface {
106
+    /**
107
+     * @Route("/api/{version}/menus/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_core_get_menu")
108
+     */
109
+    public function getAction($id): SingleResourceResponseInterface {
110 110
     return new SingleResourceResponse($this->findOr404($id));
111
-  }
111
+    }
112 112
 
113
-  /**
114
-   * @Route("/api/{version}/menus/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_create_menu")
115
-   */
116
-  public function createAction(Request $request): SingleResourceResponseInterface {
113
+    /**
114
+     * @Route("/api/{version}/menus/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_core_create_menu")
115
+     */
116
+    public function createAction(Request $request): SingleResourceResponseInterface {
117 117
     /* @var MenuItemInterface $menu */
118 118
     $menu = $this->menuFactory->create();
119 119
     $form = $this->formFactory->createNamed('', MenuType::class, $menu, ['method' => $request->getMethod()]);
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
     $form->handleRequest($request);
122 122
 
123 123
     if ($form->isSubmitted() && $form->isValid()) {
124
-      $this->menuItemManager->update($menu);
125
-      $this->menuItemRepository->add($menu);
126
-      $this->eventDispatcher->dispatch(new GenericEvent($menu), MenuEvents::MENU_CREATED);
124
+        $this->menuItemManager->update($menu);
125
+        $this->menuItemRepository->add($menu);
126
+        $this->eventDispatcher->dispatch(new GenericEvent($menu), MenuEvents::MENU_CREATED);
127 127
 
128
-      return new SingleResourceResponse($menu, new ResponseContext(201));
128
+        return new SingleResourceResponse($menu, new ResponseContext(201));
129 129
     }
130 130
 
131 131
     return new SingleResourceResponse($form, new ResponseContext(400));
132
-  }
132
+    }
133 133
 
134
-  /**
135
-   * @Route("/api/{version}/menus/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_core_delete_menu")
136
-   */
137
-  public function deleteAction(int $id) {
134
+    /**
135
+     * @Route("/api/{version}/menus/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"DELETE"}, name="swp_api_core_delete_menu")
136
+     */
137
+    public function deleteAction(int $id) {
138 138
     $repository = $this->menuItemRepository;
139 139
     $menu = $this->findOr404($id);
140 140
 
@@ -142,35 +142,35 @@  discard block
 block discarded – undo
142 142
     $this->eventDispatcher->dispatch(new GenericEvent($menu), MenuEvents::MENU_DELETED);
143 143
 
144 144
     return new SingleResourceResponse(null, new ResponseContext(204));
145
-  }
145
+    }
146 146
 
147
-  /**
148
-   * @Route("/api/{version}/menus/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_update_menu")
149
-   */
150
-  public function updateAction(Request $request, $id): SingleResourceResponseInterface {
147
+    /**
148
+     * @Route("/api/{version}/menus/{id}", options={"expose"=true}, defaults={"version"="v2"}, methods={"PATCH"}, name="swp_api_core_update_menu")
149
+     */
150
+    public function updateAction(Request $request, $id): SingleResourceResponseInterface {
151 151
     $menu = $this->findOr404($id);
152 152
     $parent = $menu->getParent();
153 153
     $form = $this->formFactory->createNamed('', MenuType::class, $menu, ['method' => $request->getMethod()]);
154 154
     $form->handleRequest($request);
155 155
     if ($form->isSubmitted() && $form->isValid()) {
156
-      $this->menuItemManager->update($menu);
157
-      if($parent !== $menu->getParent()) {
158
-          $this->menuItemManager->update($parent);
159
-      }
160
-      $this->menuItemRepository->flush();
161
-      $this->eventDispatcher->dispatch(new GenericEvent($menu), MenuEvents::MENU_UPDATED);
162
-      return new SingleResourceResponse($menu);
156
+        $this->menuItemManager->update($menu);
157
+        if($parent !== $menu->getParent()) {
158
+            $this->menuItemManager->update($parent);
159
+        }
160
+        $this->menuItemRepository->flush();
161
+        $this->eventDispatcher->dispatch(new GenericEvent($menu), MenuEvents::MENU_UPDATED);
162
+        return new SingleResourceResponse($menu);
163 163
     }
164 164
 
165 165
     return new SingleResourceResponse($form, new ResponseContext(400));
166
-  }
166
+    }
167 167
 
168
-  private function findOr404($id): MenuItemInterface {
168
+    private function findOr404($id): MenuItemInterface {
169 169
     /* @var MenuItemInterface $menu */
170 170
     if (null === $menu = $this->menuItemRepository->findOneBy(['id' => $id])) {
171
-      throw new NotFoundHttpException('Menu item was not found.');
171
+        throw new NotFoundHttpException('Menu item was not found.');
172 172
     }
173 173
 
174 174
     return $menu;
175
-  }
175
+    }
176 176
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Twig/MenuExtension.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,58 +21,58 @@
 block discarded – undo
21 21
 use Twig\TwigFunction;
22 22
 
23 23
 class MenuExtension extends KnpMenuExtension {
24
-  /**
25
-   * {@inheritdoc}
26
-   */
27
-  public function getMy($menu, array $path = [], array $options = []): ?ItemInterface {
24
+    /**
25
+     * {@inheritdoc}
26
+     */
27
+    public function getMy($menu, array $path = [], array $options = []): ?ItemInterface {
28 28
     try {
29
-      return parent::get($menu, $path, $options);
29
+        return parent::get($menu, $path, $options);
30 30
     } catch (\InvalidArgumentException $e) {
31
-      return null;
31
+        return null;
32
+    }
32 33
     }
33
-  }
34 34
 
35
-  /**
36
-   * {@inheritdoc}
37
-   */
38
-  public function render($menu, array $options = [], $renderer = null): string {
35
+    /**
36
+     * {@inheritdoc}
37
+     */
38
+    public function render($menu, array $options = [], $renderer = null): string {
39 39
     try {
40
-      return parent::render($menu, $options, $renderer);
40
+        return parent::render($menu, $options, $renderer);
41 41
     } catch (\InvalidArgumentException $e) {
42
-      // allow to render empty value
43
-      return "";
42
+        // allow to render empty value
43
+        return "";
44
+    }
44 45
     }
45
-  }
46 46
 
47
-  /**
48
-   * {@inheritdoc}
49
-   */
50
-  public function getBreadcrumbsArrayMy($menu, $subItem = null): ?array {
47
+    /**
48
+     * {@inheritdoc}
49
+     */
50
+    public function getBreadcrumbsArrayMy($menu, $subItem = null): ?array {
51 51
     try {
52
-      return parent::getBreadcrumbsArray($menu, $subItem);
52
+        return parent::getBreadcrumbsArray($menu, $subItem);
53 53
     } catch (\InvalidArgumentException $e) {
54
-      // allow to render empty value
55
-      return null;
54
+        // allow to render empty value
55
+        return null;
56
+    }
56 57
     }
57
-  }
58 58
 
59
-  /**
60
-   * {@inheritdoc}
61
-   */
62
-  public function getCurrentItemMy($menu): ?ItemInterface {
59
+    /**
60
+     * {@inheritdoc}
61
+     */
62
+    public function getCurrentItemMy($menu): ?ItemInterface {
63 63
     try {
64
-      return parent::getCurrentItem($menu);
64
+        return parent::getCurrentItem($menu);
65 65
     } catch (\InvalidArgumentException $e) {
66
-      return null;
66
+        return null;
67
+    }
67 68
     }
68
-  }
69 69
 
70
-  public function getFunctions(): array {
70
+    public function getFunctions(): array {
71 71
     return [
72 72
         new TwigFunction('knp_menu_get', [$this, 'getMy']),
73 73
         new TwigFunction('knp_menu_render', [$this, 'render'], ['is_safe' => ['html']]),
74 74
         new TwigFunction('knp_menu_get_breadcrumbs_array', [$this, 'getBreadcrumbsArrayMy']),
75 75
         new TwigFunction('knp_menu_get_current_item', [$this, 'getCurrentItemMy']),
76 76
     ];
77
-  }
77
+    }
78 78
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/MenuBundle/Doctrine/ORM/MenuItemRepository.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -128,19 +128,19 @@
 block discarded – undo
128 128
     }
129 129
 
130 130
 
131
-  /**
132
-   * @param MenuItemInterface $node
133
-   * @param MenuItemInterface $parent
134
-   */
135
-  public function persistAsFirstChildOf(MenuItemInterface $node, MenuItemInterface $parent) {
131
+    /**
132
+     * @param MenuItemInterface $node
133
+     * @param MenuItemInterface $parent
134
+     */
135
+    public function persistAsFirstChildOf(MenuItemInterface $node, MenuItemInterface $parent) {
136 136
     parent::persistAsFirstChildOf($node, $parent);
137
-  }
137
+    }
138 138
 
139
-  /**
140
-   * @param MenuItemInterface $node
141
-   * @param MenuItemInterface $sibling
142
-   */
143
-  public function persistAsNextSiblingOf(MenuItemInterface $node, MenuItemInterface $sibling) {
139
+    /**
140
+     * @param MenuItemInterface $node
141
+     * @param MenuItemInterface $sibling
142
+     */
143
+    public function persistAsNextSiblingOf(MenuItemInterface $node, MenuItemInterface $sibling) {
144 144
     parent::persistAsNextSiblingOf($node, $sibling);
145
-  }
145
+    }
146 146
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/CoreBundle/Controller/ThemesController.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -36,34 +36,34 @@  discard block
 block discarded – undo
36 36
 
37 37
 class ThemesController extends Controller {
38 38
 
39
-  private CachedTenantContextInterface $cachedTenantContext;
40
-  private FormFactoryInterface $formFactory;
41
-  private ThemeLoader $themeLoader;
42
-  private ThemeServiceInterface $themeService;
43
-  private ThemeUploaderInterface $themeUploader;
44
-
45
-  /**
46
-   * @param CachedTenantContextInterface $cachedTenantContext
47
-   * @param FormFactoryInterface $formFactory
48
-   * @param ThemeLoader $themeLoader
49
-   * @param ThemeServiceInterface $themeService
50
-   * @param ThemeUploaderInterface $themeUploader
51
-   */
52
-  public function __construct(CachedTenantContextInterface $cachedTenantContext, FormFactoryInterface $formFactory,
53
-                              ThemeLoader         $themeLoader, ThemeServiceInterface $themeService,
54
-                              ThemeUploaderInterface       $themeUploader) {
39
+    private CachedTenantContextInterface $cachedTenantContext;
40
+    private FormFactoryInterface $formFactory;
41
+    private ThemeLoader $themeLoader;
42
+    private ThemeServiceInterface $themeService;
43
+    private ThemeUploaderInterface $themeUploader;
44
+
45
+    /**
46
+     * @param CachedTenantContextInterface $cachedTenantContext
47
+     * @param FormFactoryInterface $formFactory
48
+     * @param ThemeLoader $themeLoader
49
+     * @param ThemeServiceInterface $themeService
50
+     * @param ThemeUploaderInterface $themeUploader
51
+     */
52
+    public function __construct(CachedTenantContextInterface $cachedTenantContext, FormFactoryInterface $formFactory,
53
+                                ThemeLoader         $themeLoader, ThemeServiceInterface $themeService,
54
+                                ThemeUploaderInterface       $themeUploader) {
55 55
     $this->cachedTenantContext = $cachedTenantContext;
56 56
     $this->formFactory = $formFactory;
57 57
     $this->themeLoader = $themeLoader;
58 58
     $this->themeService = $themeService;
59 59
     $this->themeUploader = $themeUploader;
60
-  }
60
+    }
61 61
 
62 62
 
63
-  /**
64
-   * @Route("/api/{version}/organization/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_available_themes")
65
-   */
66
-  public function listAvailableAction(): ResourcesListResponseInterface {
63
+    /**
64
+     * @Route("/api/{version}/organization/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_available_themes")
65
+     */
66
+    public function listAvailableAction(): ResourcesListResponseInterface {
67 67
     $themeLoader = $this->themeLoader;
68 68
     $themes = $themeLoader->load();
69 69
     $pagination = new SlidingPagination();
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
     $pagination->setTotalItemCount(count($themes));
74 74
 
75 75
     return new ResourcesListResponse($pagination);
76
-  }
76
+    }
77 77
 
78
-  /**
79
-   * @Route("/api/{version}/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_tenant_themes")
80
-   */
81
-  public function listInstalledAction(ThemeRepositoryInterface $themeRepository): ResourcesListResponseInterface {
78
+    /**
79
+     * @Route("/api/{version}/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"GET"}, name="swp_api_list_tenant_themes")
80
+     */
81
+    public function listInstalledAction(ThemeRepositoryInterface $themeRepository): ResourcesListResponseInterface {
82 82
     /** @var TenantInterface $tenant */
83 83
     $tenant = $this->cachedTenantContext->getTenant();
84 84
     $tenantCode = $tenant->getCode();
85 85
     $themes = array_filter(
86 86
         $themeRepository->findAll(),
87 87
         static function ($element) use (&$tenantCode) {
88
-          if (strpos($element->getName(), ThemeHelper::SUFFIX_SEPARATOR . $tenantCode)) {
88
+            if (strpos($element->getName(), ThemeHelper::SUFFIX_SEPARATOR . $tenantCode)) {
89 89
             return true;
90
-          }
90
+            }
91 91
         }
92 92
     );
93 93
 
@@ -98,46 +98,46 @@  discard block
 block discarded – undo
98 98
     $pagination->setTotalItemCount(count($themes));
99 99
 
100 100
     return new ResourcesListResponse($pagination);
101
-  }
101
+    }
102 102
 
103
-  /**
104
-   * @Route("/api/{version}/organization/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_upload_theme")
105
-   */
106
-  public function uploadThemeAction(Request $request): SingleResourceResponseInterface {
103
+    /**
104
+     * @Route("/api/{version}/organization/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_upload_theme")
105
+     */
106
+    public function uploadThemeAction(Request $request): SingleResourceResponseInterface {
107 107
     $form = $this->formFactory->createNamed('', ThemeUploadType::class, []);
108 108
     $form->handleRequest($request);
109 109
     if ($form->isSubmitted() && $form->isValid()) {
110
-      $formData = $form->getData();
111
-      $themeUploader = $this->themeUploader;
110
+        $formData = $form->getData();
111
+        $themeUploader = $this->themeUploader;
112 112
 
113
-      try {
113
+        try {
114 114
         $themePath = $themeUploader->upload($formData['file']);
115
-      } catch (\Exception $e) {
115
+        } catch (\Exception $e) {
116 116
         return new SingleResourceResponse(['message' => $e->getMessage()], new ResponseContext(400));
117
-      }
118
-      $themeConfig = json_decode(file_get_contents($themePath . DIRECTORY_SEPARATOR . 'theme.json'), true);
117
+        }
118
+        $themeConfig = json_decode(file_get_contents($themePath . DIRECTORY_SEPARATOR . 'theme.json'), true);
119 119
 
120
-      return new SingleResourceResponse($themeConfig, new ResponseContext(201));
120
+        return new SingleResourceResponse($themeConfig, new ResponseContext(201));
121 121
     }
122 122
 
123 123
     return new SingleResourceResponse($form, new ResponseContext(400));
124
-  }
124
+    }
125 125
 
126
-  /**
127
-   * @Route("/api/{version}/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_install_theme")
128
-   */
129
-  public function installThemeAction(Request $request): SingleResourceResponseInterface {
126
+    /**
127
+     * @Route("/api/{version}/themes/", options={"expose"=true}, defaults={"version"="v2"}, methods={"POST"}, name="swp_api_install_theme")
128
+     */
129
+    public function installThemeAction(Request $request): SingleResourceResponseInterface {
130 130
     $form = $this->formFactory->createNamed('', ThemeInstallType::class, []);
131 131
     $form->handleRequest($request);
132 132
     if ($form->isSubmitted() && $form->isValid()) {
133
-      $formData = $form->getData();
134
-      $themeService = $this->themeService;
135
-      [$sourceDir, $themeDir] = $themeService->getDirectoriesForTheme($formData['name']);
136
-      $themeService->installAndProcessGeneratedData($sourceDir, $themeDir, $formData['processGeneratedData']);
133
+        $formData = $form->getData();
134
+        $themeService = $this->themeService;
135
+        [$sourceDir, $themeDir] = $themeService->getDirectoriesForTheme($formData['name']);
136
+        $themeService->installAndProcessGeneratedData($sourceDir, $themeDir, $formData['processGeneratedData']);
137 137
 
138
-      return new SingleResourceResponse(['status' => 'installed'], new ResponseContext(201));
138
+        return new SingleResourceResponse(['status' => 'installed'], new ResponseContext(201));
139 139
     }
140 140
 
141 141
     return new SingleResourceResponse($form, new ResponseContext(400));
142
-  }
142
+    }
143 143
 }
Please login to merge, or discard this patch.
src/SWP/Bundle/FixturesBundle/WebTestCase.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,71 +23,71 @@  discard block
 block discarded – undo
23 23
 use Symfony\Component\Cache\Adapter\ArrayAdapter;
24 24
 
25 25
 class WebTestCase extends BaseWebTestCase {
26
-  protected ?AbstractDatabaseTool $databaseTool;
27
-  private static ?KernelBrowser $client = null;
26
+    protected ?AbstractDatabaseTool $databaseTool;
27
+    private static ?KernelBrowser $client = null;
28 28
 
29
-  public function setUp(): void {
29
+    public function setUp(): void {
30 30
     if (self::$client == null) {
31
-      self::$client = parent::createClient();
31
+        self::$client = parent::createClient();
32 32
     }
33 33
     $this->databaseTool = static::getContainer()->get(DatabaseToolCollection::class)->get();
34
-  }
34
+    }
35 35
 
36
-  /**
37
-   * Initializes database.
38
-   */
39
-  protected function initDatabase() {
36
+    /**
37
+     * Initializes database.
38
+     */
39
+    protected function initDatabase() {
40 40
     $this->clearMetadataCache();
41
-  }
41
+    }
42 42
 
43
-  /**
44
-   * Clears metadata cache of the various cache drivers.
45
-   */
46
-  private function clearMetadataCache() {
43
+    /**
44
+     * Clears metadata cache of the various cache drivers.
45
+     */
46
+    private function clearMetadataCache() {
47 47
     $entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
48 48
 
49 49
     $cacheDriver = $entityManager->getConfiguration()->getMetadataCacheImpl();
50 50
 
51 51
     if (!$cacheDriver instanceof ArrayAdapter) {
52
-      $cacheDriver->deleteAll();
52
+        $cacheDriver->deleteAll();
53
+    }
53 54
     }
54
-  }
55 55
 
56
-  protected function tearDown(): void {
56
+    protected function tearDown(): void {
57 57
     unset($this->databaseTool);
58 58
     $reflection = new \ReflectionObject($this);
59 59
     foreach ($reflection->getProperties() as $prop) {
60
-      if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) {
60
+        if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) {
61 61
         $prop->setAccessible(true);
62 62
         if ($prop->name == 'databaseTool') {
63
-          continue;
63
+            continue;
64 64
         }
65 65
         $prop->setValue($this, null);
66
-      }
66
+        }
67 67
     }
68 68
     parent::tearDown();
69
-  }
69
+    }
70 70
 
71
-  protected function loadCustomFixtures(array $fixtures) {
71
+    protected function loadCustomFixtures(array $fixtures) {
72 72
     $env = $this->getContainer()->getParameter('test_env');
73 73
 
74 74
     $registry = new FixtureRegistry();
75 75
     $registry->setEnvironment($env);
76 76
 
77 77
     return $this->databaseTool->loadFixtures($registry->getFixtures($fixtures))->getReferenceRepository();
78
-  }
78
+    }
79 79
 
80
-  public static function createClient(array $options = [], array $server = []) {
80
+    public static function createClient(array $options = [], array $server = []) {
81 81
     if (!array_key_exists('HTTP_Authorization', $server)) {
82
-      $server['HTTP_Authorization'] = base64_encode('test_token:');
82
+        $server['HTTP_Authorization'] = base64_encode('test_token:');
83 83
     }
84 84
 
85 85
     if (null === $server['HTTP_Authorization']) {
86
-      unset($server['HTTP_Authorization']);
86
+        unset($server['HTTP_Authorization']);
87 87
     }
88 88
 
89 89
     if(!array_key_exists("HTTP_HOST", $server)) {
90
-      $server['HTTP_HOST'] = 'localhost';
90
+        $server['HTTP_HOST'] = 'localhost';
91 91
     }
92 92
 
93 93
     $newClient = clone self::$client;
@@ -95,5 +95,5 @@  discard block
 block discarded – undo
95 95
     $newClient->getKernel()->shutdown();
96 96
     $newClient->getKernel()->boot();
97 97
     return $newClient;
98
-  }
98
+    }
99 99
 }
Please login to merge, or discard this patch.
src/SWP/Component/TemplatesSystem/Gimme/Meta/Meta.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
         }
103 103
         $this->load($name);
104 104
         if (array_key_exists($name, $this->copiedValues)) {
105
-          return $this->copiedValues[$name];
105
+            return $this->copiedValues[$name];
106 106
         }
107 107
         return null;
108 108
     }
Please login to merge, or discard this patch.
src/SWP/Bundle/ContentBundle/Controller/ContentPushController.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -40,30 +40,30 @@  discard block
 block discarded – undo
40 40
 use FOS\RestBundle\Controller\Annotations\Route;
41 41
 
42 42
 class ContentPushController extends AbstractController {
43
-  private EventDispatcherInterface $eventDispatcher;
44
-  private FormFactoryInterface $formFactory;
45
-  private MessageBusInterface $messageBus;//swp_multi_tenancy.tenant_context
46
-  private DataTransformerInterface $dataTransformer; // swp_bridge.transformer.json_to_package
47
-  private MediaManagerInterface $mediaManager; // swp_content_bundle.manager.media
48
-  private EntityManagerInterface $entityManager; // swp.object_manager.media
49
-  private PackageRepository $packageRepository;//swp.repository.package
50
-  private FileProviderInterface $fileProvider;
51
-
52
-  /**
53
-   * @param EventDispatcherInterface $eventDispatcher
54
-   * @param FormFactoryInterface $formFactory
55
-   * @param MessageBusInterface $messageBus
56
-   * @param DataTransformerInterface $dataTransformer
57
-   * @param MediaManagerInterface $mediaManager
58
-   * @param EntityManagerInterface $entityManager
59
-   * @param PackageRepositoryInterface $packageRepository
60
-   * @param FileProviderInterface $fileProvider
61
-   */
62
-  public function __construct(EventDispatcherInterface $eventDispatcher, FormFactoryInterface $formFactory,
63
-                              MessageBusInterface      $messageBus,
64
-                              DataTransformerInterface $dataTransformer, MediaManagerInterface $mediaManager,
65
-                              EntityManagerInterface   $entityManager, PackageRepository $packageRepository,
66
-                              FileProviderInterface    $fileProvider) {
43
+    private EventDispatcherInterface $eventDispatcher;
44
+    private FormFactoryInterface $formFactory;
45
+    private MessageBusInterface $messageBus;//swp_multi_tenancy.tenant_context
46
+    private DataTransformerInterface $dataTransformer; // swp_bridge.transformer.json_to_package
47
+    private MediaManagerInterface $mediaManager; // swp_content_bundle.manager.media
48
+    private EntityManagerInterface $entityManager; // swp.object_manager.media
49
+    private PackageRepository $packageRepository;//swp.repository.package
50
+    private FileProviderInterface $fileProvider;
51
+
52
+    /**
53
+     * @param EventDispatcherInterface $eventDispatcher
54
+     * @param FormFactoryInterface $formFactory
55
+     * @param MessageBusInterface $messageBus
56
+     * @param DataTransformerInterface $dataTransformer
57
+     * @param MediaManagerInterface $mediaManager
58
+     * @param EntityManagerInterface $entityManager
59
+     * @param PackageRepositoryInterface $packageRepository
60
+     * @param FileProviderInterface $fileProvider
61
+     */
62
+    public function __construct(EventDispatcherInterface $eventDispatcher, FormFactoryInterface $formFactory,
63
+                                MessageBusInterface      $messageBus,
64
+                                DataTransformerInterface $dataTransformer, MediaManagerInterface $mediaManager,
65
+                                EntityManagerInterface   $entityManager, PackageRepository $packageRepository,
66
+                                FileProviderInterface    $fileProvider) {
67 67
     $this->eventDispatcher = $eventDispatcher;
68 68
     $this->formFactory = $formFactory;
69 69
     $this->messageBus = $messageBus;
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
     $this->entityManager = $entityManager;
73 73
     $this->packageRepository = $packageRepository;
74 74
     $this->fileProvider = $fileProvider;
75
-  }
75
+    }
76 76
 
77 77
 
78
-  /**
79
-   * @Route("/api/{version}/content/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_push")
80
-   */
81
-  public function pushContentAction(Request $request, TenantContextInterface $tenantContext): SingleResourceResponseInterface {
78
+    /**
79
+     * @Route("/api/{version}/content/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_content_push")
80
+     */
81
+    public function pushContentAction(Request $request, TenantContextInterface $tenantContext): SingleResourceResponseInterface {
82 82
     $package = $this->dataTransformer->transform($request->getContent());
83 83
     $this->eventDispatcher->dispatch(new GenericEvent($package), Events::SWP_VALIDATION);
84 84
 
@@ -87,27 +87,27 @@  discard block
 block discarded – undo
87 87
     $this->messageBus->dispatch(new ContentPushMessage($currentTenant->getId(), $request->getContent()));
88 88
 
89 89
     return new SingleResourceResponse(['status' => 'OK'], new ResponseContext(201));
90
-  }
90
+    }
91 91
 
92
-  /**
93
-   * @Route("/api/{version}/assets/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_assets_push")
94
-   */
95
-  public function pushAssetsAction(Request $request): SingleResourceResponseInterface {
92
+    /**
93
+     * @Route("/api/{version}/assets/push", methods={"POST"}, options={"expose"=true}, defaults={"version"="v2"}, name="swp_api_assets_push")
94
+     */
95
+    public function pushAssetsAction(Request $request): SingleResourceResponseInterface {
96 96
     $form = $this->formFactory->createNamed('', MediaFileType::class);
97 97
     $form->handleRequest($request);
98 98
 
99 99
     if ($form->isSubmitted() && $form->isValid()) {
100
-      $mediaManager = $this->mediaManager;
101
-      $uploadedFile = $form->getData()['media'];
102
-      $mediaId = $request->request->get('mediaId');
100
+        $mediaManager = $this->mediaManager;
101
+        $uploadedFile = $form->getData()['media'];
102
+        $mediaId = $request->request->get('mediaId');
103 103
 
104
-      if ($uploadedFile->isValid()) {
104
+        if ($uploadedFile->isValid()) {
105 105
         $fileProvider = $this->fileProvider;
106 106
         $file = $fileProvider->getFile(ArticleMedia::handleMediaId($mediaId), $uploadedFile->guessExtension());
107 107
 
108 108
         if (null === $file) {
109
-          $file = $mediaManager->handleUploadedFile($uploadedFile, $mediaId);
110
-          $this->entityManager->flush();
109
+            $file = $mediaManager->handleUploadedFile($uploadedFile, $mediaId);
110
+            $this->entityManager->flush();
111 111
         }
112 112
 
113 113
         return new SingleResourceResponse(
@@ -120,23 +120,23 @@  discard block
 block discarded – undo
120 120
             ],
121 121
             new ResponseContext(201)
122 122
         );
123
-      }
123
+        }
124 124
 
125
-      throw new \Exception('Uploaded file is not valid:' . $uploadedFile->getErrorMessage());
125
+        throw new \Exception('Uploaded file is not valid:' . $uploadedFile->getErrorMessage());
126 126
     }
127 127
 
128 128
     return new SingleResourceResponse($form);
129
-  }
129
+    }
130 130
 
131
-  /**
132
-   * @Route("/api/{version}/assets/{action}/{mediaId}.{extension}", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, requirements={"mediaId"=".+", "action"="get|push"}, name="swp_api_assets_get")
133
-   */
134
-  public function getAssetsAction(string $mediaId, string $extension): SingleResourceResponseInterface {
131
+    /**
132
+     * @Route("/api/{version}/assets/{action}/{mediaId}.{extension}", methods={"GET"}, options={"expose"=true}, defaults={"version"="v2"}, requirements={"mediaId"=".+", "action"="get|push"}, name="swp_api_assets_get")
133
+     */
134
+    public function getAssetsAction(string $mediaId, string $extension): SingleResourceResponseInterface {
135 135
     $fileProvider = $this->fileProvider;
136 136
     $file = $fileProvider->getFile(ArticleMedia::handleMediaId($mediaId), $extension);
137 137
 
138 138
     if (null === $file) {
139
-      throw new NotFoundHttpException('Media don\'t exist in storage');
139
+        throw new NotFoundHttpException('Media don\'t exist in storage');
140 140
     }
141 141
 
142 142
     $mediaManager = $this->mediaManager;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
         'mime_type' => Mime::getMimeFromExtension($file->getFileExtension()),
149 149
         'filemeta' => [],
150 150
     ]);
151
-  }
151
+    }
152 152
 
153
-  protected function getPackageRepository() {
153
+    protected function getPackageRepository() {
154 154
     return $this->packageRepository;
155
-  }
155
+    }
156 156
 }
Please login to merge, or discard this patch.