@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Article\Controller; |
6 | 6 | |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | public function index(): \Psr\Http\Message\ResponseInterface |
58 | 58 | { |
59 | 59 | $params = $this->request->getQueryParams(); |
60 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
61 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
60 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
61 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
62 | 62 | |
63 | 63 | $discussions = $this->discussionService->fetchAllArticles($page, $limit); |
64 | 64 | |
65 | - return new HtmlResponse($this->template->render('article::discussion/index', ['list' => $discussions, 'layout' => 'layout/admin'])); |
|
65 | + return new HtmlResponse($this->template->render('article::discussion/index', [ 'list' => $discussions, 'layout' => 'layout/admin' ])); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return \Psr\Http\Message\ResponseInterface |
74 | 74 | */ |
75 | - public function edit($errors = []): \Psr\Http\Message\ResponseInterface |
|
75 | + public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface |
|
76 | 76 | { |
77 | 77 | $id = $this->request->getAttribute('id'); |
78 | 78 | $discussion = $this->discussionService->fetchSingleArticle($id); |
79 | 79 | $categories = $this->categoryService->getAll(); |
80 | 80 | |
81 | - if($this->request->getParsedBody()) { |
|
82 | - $discussion = (object)($this->request->getParsedBody() + (array)$discussion); |
|
81 | + if ($this->request->getParsedBody()) { |
|
82 | + $discussion = (object) ($this->request->getParsedBody() + (array) $discussion); |
|
83 | 83 | $discussion->article_id = $id; |
84 | 84 | } |
85 | 85 | |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | $data = $this->request->getParsedBody(); |
99 | 99 | $user = $this->session->getStorage()->user; |
100 | 100 | |
101 | - if($id) { |
|
101 | + if ($id) { |
|
102 | 102 | $this->discussionService->updateArticle($data, $id); |
103 | 103 | } else { |
104 | 104 | $this->discussionService->createArticle($user, $data); |
105 | 105 | } |
106 | 106 | } |
107 | - catch(FilterException $fe) { |
|
107 | + catch (FilterException $fe) { |
|
108 | 108 | return $this->edit($fe->getArrayMessages()); |
109 | 109 | } |
110 | - catch(\Exception $e) { |
|
110 | + catch (\Exception $e) { |
|
111 | 111 | throw $e; |
112 | 112 | } |
113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | try { |
120 | 120 | $this->discussionService->deleteArticle($this->request->getAttribute('id')); |
121 | 121 | } |
122 | - catch(\Exception $e) { |
|
122 | + catch (\Exception $e) { |
|
123 | 123 | throw $e; |
124 | 124 | } |
125 | 125 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | ->getMockForAbstractClass(); |
19 | 19 | $session = new \Zend\Session\SessionManager(); |
20 | 20 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
21 | - ->setMethods(['get']) |
|
21 | + ->setMethods([ 'get' ]) |
|
22 | 22 | ->getMockForAbstractClass(); |
23 | 23 | $container->expects(static::at(0)) |
24 | 24 | ->method('get') |
@@ -20,11 +20,11 @@ |
||
20 | 20 | ->getMockForAbstractClass(); |
21 | 21 | |
22 | 22 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
23 | - ->setMethods(['get']) |
|
23 | + ->setMethods([ 'get' ]) |
|
24 | 24 | ->getMockForAbstractClass(); |
25 | 25 | $container->expects(static::at(0)) |
26 | 26 | ->method('get') |
27 | - ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']])); |
|
27 | + ->will(static::returnValue([ 'upload' => [ 'public_path' => 'test', 'non_public_path' => 'test' ] ])); |
|
28 | 28 | $container->expects(static::at(1)) |
29 | 29 | ->method('get') |
30 | 30 | ->will(static::returnValue($articleMapper)); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | ->getMockForAbstractClass(); |
21 | 21 | |
22 | 22 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
23 | - ->setMethods(['get']) |
|
23 | + ->setMethods([ 'get' ]) |
|
24 | 24 | ->getMockForAbstractClass(); |
25 | 25 | $container->expects(static::at(0)) |
26 | 26 | ->method('get') |
@@ -10,7 +10,7 @@ |
||
10 | 10 | ->disableOriginalConstructor() |
11 | 11 | ->getMockForAbstractClass(); |
12 | 12 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
13 | - ->setMethods(['get']) |
|
13 | + ->setMethods([ 'get' ]) |
|
14 | 14 | ->getMockForAbstractClass(); |
15 | 15 | $container->expects(static::at(0)) |
16 | 16 | ->method('get') |
@@ -9,7 +9,7 @@ |
||
9 | 9 | $template = $this->getMockBuilder('Zend\Expressive\Template\TemplateRendererInterface') |
10 | 10 | ->getMockForAbstractClass(); |
11 | 11 | $container = $this->getMockBuilder('Interop\Container\ContainerInterface') |
12 | - ->setMethods(['get']) |
|
12 | + ->setMethods([ 'get' ]) |
|
13 | 13 | ->getMockForAbstractClass(); |
14 | 14 | $container->expects(static::once()) |
15 | 15 | ->method('get') |
@@ -18,7 +18,7 @@ |
||
18 | 18 | ->getMockForAbstractClass(); |
19 | 19 | $session = new \Zend\Session\SessionManager(); |
20 | 20 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
21 | - ->setMethods(['get']) |
|
21 | + ->setMethods([ 'get' ]) |
|
22 | 22 | ->getMockForAbstractClass(); |
23 | 23 | $container->expects(static::at(0)) |
24 | 24 | ->method('get') |
@@ -18,7 +18,7 @@ |
||
18 | 18 | ->getMockForAbstractClass(); |
19 | 19 | $session = new \Zend\Session\SessionManager(); |
20 | 20 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
21 | - ->setMethods(['get']) |
|
21 | + ->setMethods([ 'get' ]) |
|
22 | 22 | ->getMockForAbstractClass(); |
23 | 23 | $container->expects(static::at(0)) |
24 | 24 | ->method('get') |
@@ -18,7 +18,7 @@ |
||
18 | 18 | ->getMockForAbstractClass(); |
19 | 19 | $session = new \Zend\Session\SessionManager(); |
20 | 20 | $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class) |
21 | - ->setMethods(['get']) |
|
21 | + ->setMethods([ 'get' ]) |
|
22 | 22 | ->getMockForAbstractClass(); |
23 | 23 | $container->expects(static::at(0)) |
24 | 24 | ->method('get') |