@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Web\Action; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Web\Action; |
| 6 | 6 | |
@@ -12,36 +12,36 @@ |
||
| 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' => 'slug', |
| 20 | 20 | 'required' => true, |
| 21 | - 'filters' => [['name' => 'StringTrim', 'options' => ['charlist' => '/']]], |
|
| 21 | + 'filters' => [ [ 'name' => 'StringTrim', 'options' => [ 'charlist' => '/' ] ] ], |
|
| 22 | 22 | 'validators' => [ |
| 23 | - ['name' => 'NotEmpty'], |
|
| 24 | - ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 100]], |
|
| 23 | + [ 'name' => 'NotEmpty' ], |
|
| 24 | + [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 100 ] ], |
|
| 25 | 25 | ], |
| 26 | 26 | ]); |
| 27 | 27 | |
| 28 | 28 | $inputFilter->add([ |
| 29 | 29 | 'name' => 'published_at', |
| 30 | 30 | 'required' => true, |
| 31 | - 'filters' => [['name' => 'StringTrim']], |
|
| 32 | - 'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]] |
|
| 31 | + 'filters' => [ [ 'name' => 'StringTrim' ] ], |
|
| 32 | + 'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ] |
|
| 33 | 33 | ]); |
| 34 | 34 | |
| 35 | 35 | $inputFilter->add([ |
| 36 | 36 | 'name' => 'status', |
| 37 | 37 | 'required' => false, |
| 38 | - 'filters' => [['name' => 'Boolean']], |
|
| 38 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
| 39 | 39 | ]); |
| 40 | 40 | |
| 41 | 41 | $inputFilter->add([ |
| 42 | 42 | 'name' => 'is_wysiwyg_editor', |
| 43 | 43 | 'required' => false, |
| 44 | - 'filters' => [['name' => 'Boolean']], |
|
| 44 | + 'filters' => [ [ 'name' => 'Boolean' ] ], |
|
| 45 | 45 | ]); |
| 46 | 46 | |
| 47 | 47 | $this->inputFilter = $inputFilter; |
@@ -6,19 +6,19 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function up() |
| 8 | 8 | { |
| 9 | - $this->table('articles', ['id' => false, 'primary_key' => 'article_uuid']) |
|
| 10 | - ->addColumn('article_uuid', 'binary', ['limit' => 16]) |
|
| 9 | + $this->table('articles', [ 'id' => false, 'primary_key' => 'article_uuid' ]) |
|
| 10 | + ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ]) |
|
| 11 | 11 | ->addColumn('article_id', 'text') |
| 12 | - ->addColumn('slug', 'text', ['null' => true]) |
|
| 13 | - ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP']) |
|
| 14 | - ->addColumn('published_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP']) |
|
| 12 | + ->addColumn('slug', 'text', [ 'null' => true ]) |
|
| 13 | + ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ]) |
|
| 14 | + ->addColumn('published_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ]) |
|
| 15 | 15 | ->addColumn('type', 'integer')// see Core\Entity\ArticleType |
| 16 | 16 | ->addColumn('status', 'integer')// active, not active, ... |
| 17 | - ->addColumn('admin_user_uuid', 'binary', ['limit' => 16]) |
|
| 18 | - ->addColumn('is_wysiwyg_editor', 'boolean', ['default' => false]) |
|
| 19 | - ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) |
|
| 20 | - ->addIndex('type', ['name' => 'type_INDEX']) |
|
| 21 | - ->addIndex('published_at', ['name' => 'published_at_INDEX']) |
|
| 17 | + ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ]) |
|
| 18 | + ->addColumn('is_wysiwyg_editor', 'boolean', [ 'default' => false ]) |
|
| 19 | + ->addForeignKey('admin_user_uuid', 'admin_users', 'admin_user_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ]) |
|
| 20 | + ->addIndex('type', [ 'name' => 'type_INDEX' ]) |
|
| 21 | + ->addIndex('published_at', [ 'name' => 'published_at_INDEX' ]) |
|
| 22 | 22 | ->create(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | 'article/pagination' => 'templates/partial/pagination.phtml', |
| 14 | 14 | ], |
| 15 | 15 | 'paths' => [ |
| 16 | - 'templates' => ['templates'], |
|
| 17 | - 'web' => ['templates/web'], |
|
| 16 | + 'templates' => [ 'templates' ], |
|
| 17 | + 'web' => [ 'templates/web' ], |
|
| 18 | 18 | ], |
| 19 | 19 | ], |
| 20 | 20 | |
@@ -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 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function __invoke(Request $request, Response $response, callable $next = null): HtmlResponse |
| 47 | 47 | { |
| 48 | 48 | // Set custom html from view file |
| 49 | - return new HtmlResponse($this->template->render('web::home', ['layout' => 'layout/web'])); |
|
| 49 | + return new HtmlResponse($this->template->render('web::home', [ 'layout' => 'layout/web' ])); |
|
| 50 | 50 | |
| 51 | 51 | //$article = $this->postService->getHomepage(); |
| 52 | 52 | // |
@@ -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, 3); |
| 59 | 59 | |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $urlSlug1 = $request->getAttribute('segment_1'); |
| 49 | 49 | $urlSlug2 = $request->getAttribute('segment_2'); |
| 50 | 50 | |
| 51 | - if($urlSlug2) { |
|
| 51 | + if ($urlSlug2) { |
|
| 52 | 52 | $categorySlug = $urlSlug1; |
| 53 | 53 | $postSlug = $urlSlug2; |
| 54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | list($previousPost, $nextPost) = $this->postService->fetchNearestArticle($post->published_at); |
| 63 | 63 | |
| 64 | - if(!$post) { |
|
| 64 | + if (!$post) { |
|
| 65 | 65 | $response = $response->withStatus(404); |
| 66 | 66 | |
| 67 | 67 | return $next($request, $response, new \Exception("Post by URL does not exist!", 404)); |
@@ -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,13 +51,13 @@ 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->allWeb(); |
| 57 | 57 | $category = $this->categoryService->getCategoryBySlug($urlSlug); |
| 58 | 58 | |
| 59 | - if(!$category) { |
|
| 60 | - $category = (object)[ |
|
| 59 | + if (!$category) { |
|
| 60 | + $category = (object) [ |
|
| 61 | 61 | 'name' => 'SveeEeEEeeEe', |
| 62 | 62 | 'slug' => 'all' |
| 63 | 63 | ]; |