@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Article\Mapper; |
5 | 5 | |
@@ -34,24 +34,24 @@ discard block |
||
34 | 34 | public function getPaginationSelect() |
35 | 35 | { |
36 | 36 | return $this->getSql()->select() |
37 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
37 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
38 | 38 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
39 | - ->join('category', 'articles.category_uuid = category.category_uuid', ['category_name' => 'name'], 'left') |
|
40 | - ->where(['articles.type' => ArticleType::POST]) |
|
41 | - ->order(['created_at' => 'desc']); |
|
39 | + ->join('category', 'articles.category_uuid = category.category_uuid', [ 'category_name' => 'name' ], 'left') |
|
40 | + ->where([ 'articles.type' => ArticleType::POST ]) |
|
41 | + ->order([ 'created_at' => 'desc' ]); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function get($id) |
45 | 45 | { |
46 | 46 | $select = $this->getSql()->select() |
47 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout']) |
|
47 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'has_layout' ]) |
|
48 | 48 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
49 | 49 | ->join( |
50 | 50 | 'category', 'category.category_uuid = articles.category_uuid', |
51 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
51 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
52 | 52 | ) |
53 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
54 | - ->where(['articles.article_id' => $id]); |
|
53 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
54 | + ->where([ 'articles.article_id' => $id ]); |
|
55 | 55 | |
56 | 56 | return $this->selectWith($select)->current(); |
57 | 57 | } |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | { |
61 | 61 | $select = $this->getSql()->select() |
62 | 62 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
63 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_slug' => 'slug']) |
|
64 | - ->where(['articles.status' => 1]) |
|
63 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_slug' => 'slug' ]) |
|
64 | + ->where([ 'articles.status' => 1 ]) |
|
65 | 65 | ->limit(1); |
66 | 66 | |
67 | - if($direction > 0) { |
|
67 | + if ($direction > 0) { |
|
68 | 68 | $select->where->greaterThan('published_at', $publishedAt); |
69 | - $select->order(['published_at' => 'asc']); |
|
70 | - } elseif($direction < 0) { |
|
69 | + $select->order([ 'published_at' => 'asc' ]); |
|
70 | + } elseif ($direction < 0) { |
|
71 | 71 | $select->where->lessThan('published_at', $publishedAt); |
72 | - $select->order(['published_at' => 'desc']); |
|
72 | + $select->order([ 'published_at' => 'desc' ]); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $this->selectWith($select)->current(); |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | public function getBySlug($slug) |
79 | 79 | { |
80 | 80 | $select = $this->getSql()->select() |
81 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img']) |
|
81 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img' ]) |
|
82 | 82 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
83 | - ->join('category', 'category.category_uuid = articles.category_uuid', ['category_name' => 'name', 'category_slug' => 'slug']) |
|
84 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
85 | - ->where(['articles.slug' => $slug, 'articles.status' => 1]); |
|
83 | + ->join('category', 'category.category_uuid = articles.category_uuid', [ 'category_name' => 'name', 'category_slug' => 'slug' ]) |
|
84 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
85 | + ->where([ 'articles.slug' => $slug, 'articles.status' => 1 ]); |
|
86 | 86 | |
87 | 87 | return $this->selectWith($select)->current(); |
88 | 88 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function getAll() |
91 | 91 | { |
92 | 92 | $select = $this->getSql()->select() |
93 | - ->join('articles', 'article_posts.article_uuid = articles.article_uuid', ['article_id', 'slug']); |
|
93 | + ->join('articles', 'article_posts.article_uuid = articles.article_uuid', [ 'article_id', 'slug' ]); |
|
94 | 94 | |
95 | 95 | return $this->selectWith($select); |
96 | 96 | } |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | { |
100 | 100 | $select = $this->getSql()->select() |
101 | 101 | ->join('articles', 'article_posts.article_uuid = articles.article_uuid') |
102 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['first_name', 'last_name']) |
|
102 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'first_name', 'last_name' ]) |
|
103 | 103 | ->join( |
104 | 104 | 'category', 'category.category_uuid = articles.category_uuid', |
105 | - ['category_name' => 'name', 'category_id', 'category_slug' => 'slug'] |
|
105 | + [ 'category_name' => 'name', 'category_id', 'category_slug' => 'slug' ] |
|
106 | 106 | ) |
107 | - ->where(['articles.status' => 1]) |
|
108 | - ->order(['articles.published_at' => 'desc']) |
|
107 | + ->where([ 'articles.status' => 1 ]) |
|
108 | + ->order([ 'articles.published_at' => 'desc' ]) |
|
109 | 109 | ->limit($limit); |
110 | 110 | |
111 | 111 | return $this->selectWith($select); |
@@ -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\Mapper; |
6 | 6 | |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | public function getPaginationSelect() |
25 | 25 | { |
26 | 26 | return $this->getSql()->select() |
27 | - ->columns(['title', 'body']) |
|
27 | + ->columns([ 'title', 'body' ]) |
|
28 | 28 | ->join('articles', 'article_discussions.article_uuid = articles.article_uuid') |
29 | - ->where(['articles.type' => ArticleType::DISCUSSION]) |
|
30 | - ->order(['created_at' => 'desc']); |
|
29 | + ->where([ 'articles.type' => ArticleType::DISCUSSION ]) |
|
30 | + ->order([ 'created_at' => 'desc' ]); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function get($id) |
34 | 34 | { |
35 | 35 | $select = $this->getSql()->select() |
36 | - ->columns(['title', 'body']) |
|
36 | + ->columns([ 'title', 'body' ]) |
|
37 | 37 | ->join('articles', 'article_discussions.article_uuid = articles.article_uuid') |
38 | 38 | ->join( |
39 | 39 | 'category', 'category.category_uuid = articles.category_uuid', |
40 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
40 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
41 | 41 | ) |
42 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
43 | - ->where(['articles.article_id' => $id]); |
|
42 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
43 | + ->where([ 'articles.article_id' => $id ]); |
|
44 | 44 | |
45 | 45 | return $this->selectWith($select)->current(); |
46 | 46 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Article\Mapper; |
5 | 5 | |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | public function getPaginationSelect($isActive = null) |
35 | 35 | { |
36 | 36 | $select = $this->getSql()->select() |
37 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['slug', 'published_at', 'status', 'article_id']) |
|
38 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id', 'first_name', 'last_name']) |
|
39 | - ->where(['articles.type' => ArticleType::VIDEO]) |
|
40 | - ->order(['articles.created_at' => 'desc']); |
|
37 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'slug', 'published_at', 'status', 'article_id' ]) |
|
38 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id', 'first_name', 'last_name' ]) |
|
39 | + ->where([ 'articles.type' => ArticleType::VIDEO ]) |
|
40 | + ->order([ 'articles.created_at' => 'desc' ]); |
|
41 | 41 | |
42 | - if($isActive !== null) { |
|
43 | - $select->where(['articles.status' => (int)$isActive]); |
|
42 | + if ($isActive !== null) { |
|
43 | + $select->where([ 'articles.status' => (int) $isActive ]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $select; |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | public function get($id) |
50 | 50 | { |
51 | 51 | $select = $this->getSql()->select() |
52 | - ->columns(['title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title']) |
|
52 | + ->columns([ 'title', 'body', 'lead', 'featured_img', 'main_img', 'video_url', 'sub_title' ]) |
|
53 | 53 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
54 | 54 | ->join( |
55 | 55 | 'category', 'category.category_uuid = articles.category_uuid', |
56 | - ['category_slug' => 'slug', 'category_name' => 'name', 'category_id'], 'left' |
|
56 | + [ 'category_slug' => 'slug', 'category_name' => 'name', 'category_id' ], 'left' |
|
57 | 57 | ) |
58 | - ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', ['admin_user_id'], 'left') |
|
59 | - ->where(['articles.article_id' => $id]); |
|
58 | + ->join('admin_users', 'admin_users.admin_user_uuid = articles.admin_user_uuid', [ 'admin_user_id' ], 'left') |
|
59 | + ->where([ 'articles.article_id' => $id ]); |
|
60 | 60 | |
61 | 61 | return $this->selectWith($select)->current(); |
62 | 62 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | public function getLatest($limit = 50) |
65 | 65 | { |
66 | 66 | $select = $this->getSql()->select() |
67 | - ->join('articles', 'article_videos.article_uuid = articles.article_uuid', ['article_id', 'slug', 'published_at']) |
|
68 | - ->where(['articles.status' => 1]) |
|
69 | - ->order(['published_at' => 'desc']) |
|
67 | + ->join('articles', 'article_videos.article_uuid = articles.article_uuid', [ 'article_id', 'slug', 'published_at' ]) |
|
68 | + ->where([ 'articles.status' => 1 ]) |
|
69 | + ->order([ 'published_at' => 'desc' ]) |
|
70 | 70 | ->limit($limit); |
71 | 71 | |
72 | 72 | return $this->selectWith($select); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $select = $this->getSql()->select() |
78 | 78 | ->join('articles', 'article_videos.article_uuid = articles.article_uuid') |
79 | - ->where(['articles.slug' => $slug]); |
|
79 | + ->where([ 'articles.slug' => $slug ]); |
|
80 | 80 | |
81 | 81 | return $this->selectWith($select)->current(); |
82 | 82 | } |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | public function index() : HtmlResponse |
69 | 69 | { |
70 | 70 | $params = $this->request->getQueryParams(); |
71 | - $page = isset($params['page']) ? $params['page'] : 1; |
|
72 | - $limit = isset($params['limit']) ? $params['limit'] : 15; |
|
71 | + $page = isset($params[ 'page' ]) ? $params[ 'page' ] : 1; |
|
72 | + $limit = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15; |
|
73 | 73 | $posts = $this->postService->fetchAllArticles($page, $limit); |
74 | 74 | |
75 | - return new HtmlResponse($this->template->render('article::post/index', ['list' => $posts, 'layout' => 'layout/admin'])); |
|
75 | + return new HtmlResponse($this->template->render('article::post/index', [ 'list' => $posts, 'layout' => 'layout/admin' ])); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return \Psr\Http\Message\ResponseInterface |
82 | 82 | */ |
83 | - public function edit($errors = []) : \Psr\Http\Message\ResponseInterface |
|
83 | + public function edit($errors = [ ]) : \Psr\Http\Message\ResponseInterface |
|
84 | 84 | { |
85 | 85 | $id = $this->request->getAttribute('id'); |
86 | 86 | $post = $this->postService->fetchSingleArticle($id); |
87 | 87 | $categories = $this->categoryService->getAll(); |
88 | 88 | |
89 | - if($this->request->getParsedBody()) { |
|
90 | - $post = (object)($this->request->getParsedBody() + (array)$post); |
|
89 | + if ($this->request->getParsedBody()) { |
|
90 | + $post = (object) ($this->request->getParsedBody() + (array) $post); |
|
91 | 91 | $post->article_id = $id; |
92 | 92 | } |
93 | 93 | |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function save() : \Psr\Http\Message\ResponseInterface |
114 | 114 | { |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | $id = $this->request->getAttribute('id'); |
117 | 117 | $user = $this->session->getStorage()->user; |
118 | 118 | $data = $this->request->getParsedBody(); |
119 | 119 | $data += (new Request())->getFiles()->toArray(); |
120 | 120 | |
121 | - if($id) { |
|
121 | + if ($id) { |
|
122 | 122 | $this->postService->updateArticle($data, $id); |
123 | 123 | } |
124 | - else{ |
|
124 | + else { |
|
125 | 125 | $this->postService->createArticle($user, $data); |
126 | 126 | } |
127 | 127 | } |
128 | - catch(FilterException $fe){ |
|
128 | + catch (FilterException $fe) { |
|
129 | 129 | return $this->edit($fe->getArrayMessages()); |
130 | 130 | } |
131 | - catch(\Exception $e){ |
|
131 | + catch (\Exception $e) { |
|
132 | 132 | throw $e; |
133 | 133 | } |
134 | 134 | |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function delete() : \Psr\Http\Message\ResponseInterface |
145 | 145 | { |
146 | - try{ |
|
146 | + try { |
|
147 | 147 | $this->postService->deleteArticle($this->request->getAttribute('id')); |
148 | 148 | } |
149 | - catch(\Exception $e){ |
|
149 | + catch (\Exception $e) { |
|
150 | 150 | throw $e; |
151 | 151 | } |
152 | 152 | |
153 | 153 | return $this->response->withStatus(302)->withHeader( |
154 | - 'Location', $this->router->generateUri('admin.posts', ['action' => 'index']) |
|
154 | + 'Location', $this->router->generateUri('admin.posts', [ 'action' => 'index' ]) |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | } |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getCategoryIds($articleId) |
33 | 33 | { |
34 | - $categories = []; |
|
35 | - foreach($this->articleMapper->getCategories($articleId) as $category) { |
|
36 | - $categories[] = $category->category_id; |
|
34 | + $categories = [ ]; |
|
35 | + foreach ($this->articleMapper->getCategories($articleId) as $category) { |
|
36 | + $categories[ ] = $category->category_id; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $categories; |
@@ -41,6 +41,6 @@ discard block |
||
41 | 41 | |
42 | 42 | public function delete($articleId) |
43 | 43 | { |
44 | - $this->articleMapper->delete(['article_uuid' => $articleId]); |
|
44 | + $this->articleMapper->delete([ 'article_uuid' => $articleId ]); |
|
45 | 45 | } |
46 | 46 | } |
@@ -12,17 +12,17 @@ discard block |
||
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 | [ |
20 | 20 | 'name' => 'slug', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'published_at', |
33 | 33 | 'required' => true, |
34 | - 'filters' => [['name' => 'StringTrim']], |
|
35 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]] |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
35 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ] |
|
36 | 36 | ] |
37 | 37 | ); |
38 | 38 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | [ |
55 | 55 | 'name' => 'status', |
56 | 56 | 'required' => false, |
57 | - 'filters' => [['name' => 'Boolean']], |
|
57 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
58 | 58 | ] |
59 | 59 | ); |
60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | [ |
63 | 63 | 'name' => 'is_wysiwyg_editor', |
64 | 64 | 'required' => false, |
65 | - 'filters' => [['name' => 'Boolean']], |
|
65 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
66 | 66 | ] |
67 | 67 | ); |
68 | 68 |
@@ -12,17 +12,17 @@ discard block |
||
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 | [ |
20 | 20 | 'name' => 'title', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim']], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'body', |
33 | 33 | 'required' => true, |
34 | - 'filters' => [['name' => 'StringTrim']], |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
35 | 35 | 'validators' => [ |
36 | - ['name' => 'NotEmpty'], |
|
37 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1500]], |
|
36 | + [ 'name' => 'NotEmpty' ], |
|
37 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1500 ] ], |
|
38 | 38 | ], |
39 | 39 | ] |
40 | 40 | ); |
@@ -12,17 +12,17 @@ discard block |
||
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 | [ |
20 | 20 | 'name' => 'title', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim']], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'sub_title', |
33 | 33 | 'required' => false, |
34 | - 'filters' => [['name' => 'StringTrim']], |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
35 | 35 | 'validators' => [ |
36 | - ['name' => 'NotEmpty'], |
|
37 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 500]], |
|
36 | + [ 'name' => 'NotEmpty' ], |
|
37 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 500 ] ], |
|
38 | 38 | ], |
39 | 39 | ] |
40 | 40 | ); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | [ |
44 | 44 | 'name' => 'body', |
45 | 45 | 'required' => true, |
46 | - 'filters' => [['name' => 'StringTrim']], |
|
46 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
47 | 47 | 'validators' => [ |
48 | - ['name' => 'NotEmpty'], |
|
49 | - ['name' => 'StringLength', 'options' => ['min' => 2]], |
|
48 | + [ 'name' => 'NotEmpty' ], |
|
49 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ], |
|
50 | 50 | ], |
51 | 51 | ] |
52 | 52 | ); |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | [ |
56 | 56 | 'name' => 'lead', |
57 | 57 | 'required' => true, |
58 | - 'filters' => [['name' => 'StringTrim']], |
|
58 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
59 | 59 | 'validators' => [ |
60 | - ['name' => 'NotEmpty'], |
|
61 | - ['name' => 'StringLength', 'options' => ['min' => 2]], |
|
60 | + [ 'name' => 'NotEmpty' ], |
|
61 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ], |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | [ |
68 | 68 | 'name' => 'video_url', |
69 | 69 | 'required' => true, |
70 | - 'filters' => [['name' => 'StringTrim']], |
|
70 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
71 | 71 | 'validators' => [ |
72 | - ['name' => 'NotEmpty'], |
|
73 | - ['name' => 'StringLength'], |
|
72 | + [ 'name' => 'NotEmpty' ], |
|
73 | + [ 'name' => 'StringLength' ], |
|
74 | 74 | ], |
75 | 75 | ] |
76 | 76 | ); |
@@ -12,17 +12,17 @@ discard block |
||
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 | [ |
20 | 20 | 'name' => 'title', |
21 | 21 | 'required' => true, |
22 | - 'filters' => [['name' => 'StringTrim']], |
|
22 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
23 | 23 | 'validators' => [ |
24 | - ['name' => 'NotEmpty'], |
|
25 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
24 | + [ 'name' => 'NotEmpty' ], |
|
25 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
26 | 26 | ], |
27 | 27 | ] |
28 | 28 | ); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | [ |
32 | 32 | 'name' => 'sub_title', |
33 | 33 | 'required' => false, |
34 | - 'filters' => [['name' => 'StringTrim']] |
|
34 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
35 | 35 | ] |
36 | 36 | ); |
37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | [ |
40 | 40 | 'name' => 'place_name', |
41 | 41 | 'required' => true, |
42 | - 'filters' => [['name' => 'StringTrim']] |
|
42 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
43 | 43 | ] |
44 | 44 | ); |
45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | [ |
48 | 48 | 'name' => 'event_url', |
49 | 49 | 'required' => false, |
50 | - 'filters' => [['name' => 'StringTrim']] |
|
50 | + 'filters' => [ [ 'name' => 'StringTrim' ] ] |
|
51 | 51 | ] |
52 | 52 | ); |
53 | 53 | |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | [ |
56 | 56 | 'name' => 'body', |
57 | 57 | 'required' => true, |
58 | - 'filters' => [['name' => 'StringTrim']], |
|
58 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
59 | 59 | 'validators' => [ |
60 | - ['name' => 'NotEmpty'], |
|
61 | - ['name' => 'StringLength', 'options' => ['min' => 2]], |
|
60 | + [ 'name' => 'NotEmpty' ], |
|
61 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2 ] ], |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | [ |
68 | 68 | 'name' => 'start_at', |
69 | 69 | 'required' => true, |
70 | - 'filters' => [['name' => 'StringTrim']], |
|
71 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]] |
|
70 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
71 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ] |
|
72 | 72 | ] |
73 | 73 | ); |
74 | 74 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | [ |
77 | 77 | 'name' => 'end_at', |
78 | 78 | 'required' => true, |
79 | - 'filters' => [['name' => 'StringTrim']], |
|
80 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]] |
|
79 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
80 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ] |
|
81 | 81 | ] |
82 | 82 | ); |
83 | 83 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | [ |
86 | 86 | 'name' => 'longitude', |
87 | 87 | 'required' => true, |
88 | - 'filters' => [['name' => 'StringTrim']], |
|
89 | - 'validators' => [['name' => 'NotEmpty']], |
|
88 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
89 | + 'validators' => [ [ 'name' => 'NotEmpty' ] ], |
|
90 | 90 | ] |
91 | 91 | ); |
92 | 92 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | [ |
95 | 95 | 'name' => 'latitude', |
96 | 96 | 'required' => true, |
97 | - 'filters' => [['name' => 'StringTrim']], |
|
98 | - 'validators' => [['name' => 'NotEmpty']], |
|
97 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
98 | + 'validators' => [ [ 'name' => 'NotEmpty' ] ], |
|
99 | 99 | ] |
100 | 100 | ); |
101 | 101 |