@@ -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,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)); |
@@ -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') |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | /** |
158 | 158 | * Return categories with posts/articles |
159 | 159 | * |
160 | - * @param null $inHomepage |
|
160 | + * @param boolean $inHomepage |
|
161 | 161 | * @param null $inCategoryList |
162 | 162 | * @return mixed |
163 | 163 | */ |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Return categories posts/articles |
179 | 179 | * |
180 | - * @param null $inCategoryList |
|
180 | + * @param boolean $inCategoryList |
|
181 | 181 | * @return null|\Zend\Db\ResultSet\ResultSetInterface |
182 | 182 | */ |
183 | 183 | public function getCategories($inCategoryList = null) |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Category\Service; |
5 | 5 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getCategoryBySlug($urlSlug) |
78 | 78 | { |
79 | - return $this->categoryMapper->select(['slug' => $urlSlug])->current(); |
|
79 | + return $this->categoryMapper->select([ 'slug' => $urlSlug ])->current(); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | { |
90 | 90 | $filter = $this->categoryFilter->getInputFilter()->setData($data); |
91 | 91 | |
92 | - if(!$filter->isValid()) { |
|
92 | + if (!$filter->isValid()) { |
|
93 | 93 | throw new FilterException($filter->getMessages()); |
94 | 94 | } |
95 | 95 | |
96 | 96 | $values = $filter->getValues(); |
97 | - $values['category_id'] = Uuid::uuid1()->toString(); |
|
98 | - $values['category_uuid'] = (new MysqlUuid($values['category_id']))->toFormat(new Binary); |
|
99 | - $values['main_img'] = $this->upload->uploadImage($data, 'main_img'); |
|
97 | + $values[ 'category_id' ] = Uuid::uuid1()->toString(); |
|
98 | + $values[ 'category_uuid' ] = (new MysqlUuid($values[ 'category_id' ]))->toFormat(new Binary); |
|
99 | + $values[ 'main_img' ] = $this->upload->uploadImage($data, 'main_img'); |
|
100 | 100 | |
101 | 101 | $this->categoryMapper->insert($values); |
102 | 102 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $filter = $this->categoryFilter->getInputFilter()->setData($data); |
119 | 119 | |
120 | - if(!$filter->isValid()) { |
|
120 | + if (!$filter->isValid()) { |
|
121 | 121 | throw new FilterException($filter->getMessages()); |
122 | 122 | } |
123 | 123 | |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | ]; |
127 | 127 | |
128 | 128 | // We don't want to force user to re-upload image on edit |
129 | - if(!$values['main_img']) { |
|
130 | - unset($values['main_img']); |
|
129 | + if (!$values[ 'main_img' ]) { |
|
130 | + unset($values[ 'main_img' ]); |
|
131 | 131 | } |
132 | - else{ |
|
132 | + else { |
|
133 | 133 | $this->upload->deleteFile($oldCategory->main_img); |
134 | 134 | } |
135 | 135 | |
136 | - $this->categoryMapper->update($values, ['category_id' => $categoryId]); |
|
136 | + $this->categoryMapper->update($values, [ 'category_id' => $categoryId ]); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $this->upload->deleteFile($category->main_img); |
150 | 150 | |
151 | - return (bool)$this->categoryMapper->delete(['category_id' => $categoryId]); |
|
151 | + return (bool) $this->categoryMapper->delete([ 'category_id' => $categoryId ]); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | { |
173 | 173 | $categories = $this->categoryMapper->getWeb(7, null, $inHomepage, $inCategoryList)->toArray(); |
174 | 174 | |
175 | - foreach($categories as $ctn => $category) { |
|
176 | - $select = $this->categoryMapper->getCategoryPostsSelect($category['category_id'], 4); |
|
175 | + foreach ($categories as $ctn => $category) { |
|
176 | + $select = $this->categoryMapper->getCategoryPostsSelect($category[ 'category_id' ], 4); |
|
177 | 177 | $posts = $this->categoryMapper->selectWith($select)->toArray(); |
178 | - $categories[$ctn]['posts'] = $posts; |
|
178 | + $categories[ $ctn ][ 'posts' ] = $posts; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $categories; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function getCategories($inCategoryList = null) |
191 | 191 | { |
192 | - return $this->categoryMapper->getWeb(null, ['name' => 'asc'], null, $inCategoryList); |
|
192 | + return $this->categoryMapper->getWeb(null, [ 'name' => 'asc' ], null, $inCategoryList); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -128,8 +128,7 @@ |
||
128 | 128 | // We don't want to force user to re-upload image on edit |
129 | 129 | if(!$values['main_img']) { |
130 | 130 | unset($values['main_img']); |
131 | - } |
|
132 | - else{ |
|
131 | + } else{ |
|
133 | 132 | $this->upload->deleteFile($oldCategory->main_img); |
134 | 133 | } |
135 | 134 |
@@ -9,16 +9,16 @@ |
||
9 | 9 | |
10 | 10 | public function up() |
11 | 11 | { |
12 | - $this->table('category', ['id' => false, 'primary_key' => 'category_uuid']) |
|
13 | - ->addColumn('category_uuid', 'binary', ['limit' => 16]) |
|
12 | + $this->table('category', [ 'id' => false, 'primary_key' => 'category_uuid' ]) |
|
13 | + ->addColumn('category_uuid', 'binary', [ 'limit' => 16 ]) |
|
14 | 14 | ->addColumn('category_id', 'text') |
15 | 15 | ->addColumn('name', 'text') |
16 | 16 | ->addColumn('slug', 'text') |
17 | - ->addColumn('title', 'text', ['null' => true]) |
|
18 | - ->addColumn('description', 'text', ['null' => true]) |
|
19 | - ->addColumn('main_img', 'text', ['null' => true]) |
|
20 | - ->addColumn('is_in_homepage', 'boolean', ['default' => false]) |
|
21 | - ->addColumn('is_in_category_list', 'boolean', ['default' => true]) |
|
17 | + ->addColumn('title', 'text', [ 'null' => true ]) |
|
18 | + ->addColumn('description', 'text', [ 'null' => true ]) |
|
19 | + ->addColumn('main_img', 'text', [ 'null' => true ]) |
|
20 | + ->addColumn('is_in_homepage', 'boolean', [ 'default' => false ]) |
|
21 | + ->addColumn('is_in_category_list', 'boolean', [ 'default' => true ]) |
|
22 | 22 | ->create(); |
23 | 23 | } |
24 | 24 |
@@ -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 Web\Action; |
6 | 6 | |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | public function __invoke(Request $request, Response $response, callable $next = null) |
52 | 52 | { |
53 | 53 | $params = $request->getQueryParams(); |
54 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
54 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
55 | 55 | $urlSlug = $request->getAttribute('category'); |
56 | 56 | $categories = $this->categoryService->getCategories(true); |
57 | 57 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
58 | 58 | |
59 | - if(!$category) { |
|
60 | - if($urlSlug !== 'all') { |
|
59 | + if (!$category) { |
|
60 | + if ($urlSlug !== 'all') { |
|
61 | 61 | return $next($request, $response); |
62 | 62 | } |
63 | 63 | |
64 | - $category = (object)[ |
|
64 | + $category = (object) [ |
|
65 | 65 | 'name' => 'Svi članci', |
66 | 66 | 'slug' => 'all', |
67 | 67 | 'title' => 'Svi članci', |
@@ -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 Web\Action; |
6 | 6 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function __invoke(Request $request, Response $response, callable $next = null) |
54 | 54 | { |
55 | 55 | $params = $request->getQueryParams(); |
56 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
56 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
57 | 57 | $futureEvents = $this->eventService->fetchFutureEvents(); |
58 | 58 | $pastEvents = $this->eventService->fetchPastEventsPagination($page, 10); |
59 | 59 | $category = $this->categoryService->getCategoryBySlug('events'); |
@@ -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 Web\Action; |
6 | 6 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function __invoke(Request $request, Response $response, callable $next = null) |
52 | 52 | { |
53 | 53 | $params = $request->getQueryParams(); |
54 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
54 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
55 | 55 | $videos = $this->videoService->fetchWebArticles($page, 5); |
56 | 56 | $category = $this->categoryService->getCategoryBySlug('videos'); |
57 | 57 |
@@ -12,59 +12,59 @@ |
||
12 | 12 | |
13 | 13 | public function getInputFilter() |
14 | 14 | { |
15 | - if(!$this->inputFilter) { |
|
15 | + if (!$this->inputFilter) { |
|
16 | 16 | $inputFilter = new InputFilter(); |
17 | 17 | |
18 | 18 | $inputFilter->add([ |
19 | 19 | 'name' => 'name', |
20 | 20 | 'required' => true, |
21 | - 'filters' => [['name' => 'StringTrim']], |
|
21 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
22 | 22 | 'validators' => [ |
23 | - ['name' => 'NotEmpty'], |
|
24 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]], |
|
23 | + [ 'name' => 'NotEmpty' ], |
|
24 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ], |
|
25 | 25 | ], |
26 | 26 | ]); |
27 | 27 | |
28 | 28 | $inputFilter->add([ |
29 | 29 | 'name' => 'slug', |
30 | 30 | 'required' => true, |
31 | - 'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]], |
|
31 | + 'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ], |
|
32 | 32 | 'validators' => [ |
33 | - ['name' => 'NotEmpty'], |
|
34 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
33 | + [ 'name' => 'NotEmpty' ], |
|
34 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
35 | 35 | ], |
36 | 36 | ]); |
37 | 37 | |
38 | 38 | $inputFilter->add([ |
39 | 39 | 'name' => 'title', |
40 | 40 | 'required' => false, |
41 | - 'filters' => [['name' => 'StringTrim']], |
|
41 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
42 | 42 | 'validators' => [ |
43 | - ['name' => 'NotEmpty'], |
|
44 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
43 | + [ 'name' => 'NotEmpty' ], |
|
44 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
45 | 45 | ], |
46 | 46 | ]); |
47 | 47 | |
48 | 48 | $inputFilter->add([ |
49 | 49 | 'name' => 'description', |
50 | 50 | 'required' => false, |
51 | - 'filters' => [['name' => 'StringTrim']], |
|
51 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
52 | 52 | 'validators' => [ |
53 | - ['name' => 'NotEmpty'], |
|
54 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1000]], |
|
53 | + [ 'name' => 'NotEmpty' ], |
|
54 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1000 ] ], |
|
55 | 55 | ], |
56 | 56 | ]); |
57 | 57 | |
58 | 58 | $inputFilter->add([ |
59 | 59 | 'name' => 'is_in_homepage', |
60 | 60 | 'required' => false, |
61 | - 'filters' => [['name' => 'Boolean']], |
|
61 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
62 | 62 | ]); |
63 | 63 | |
64 | 64 | $inputFilter->add([ |
65 | 65 | 'name' => 'is_in_category_list', |
66 | 66 | 'required' => false, |
67 | - 'filters' => [['name' => 'Boolean']], |
|
67 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
68 | 68 | ]); |
69 | 69 | |
70 | 70 | $this->inputFilter = $inputFilter; |