Completed
Push — master ( 7bf704...47ae20 )
by Aleksandar
39:25 queued 17:51
created
src/Admin/src/Controller/AuthController.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     /**
99 99
      * Clears user session.
100 100
      *
101
-     * @return static
101
+     * @return \Psr\Http\Message\ResponseInterface
102 102
      */
103 103
     public function logout(): \Psr\Http\Message\ResponseInterface
104 104
     {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Admin\Controller;
5 5
 
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function login($error = false): \Psr\Http\Message\ResponseInterface
62 62
     {
63
-        if($this->session->getStorage()->user) {
63
+        if ($this->session->getStorage()->user) {
64 64
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
65 65
         }
66 66
 
67
-        return new HtmlResponse($this->template->render('admin::login', ['layout' => false, 'error' => $error]));
67
+        return new HtmlResponse($this->template->render('admin::login', [ 'layout' => false, 'error' => $error ]));
68 68
     }
69 69
 
70 70
     /**
@@ -74,20 +74,20 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function loginHandle(): \Psr\Http\Message\ResponseInterface
76 76
     {
77
-        if($this->session->getStorage()->user) {
77
+        if ($this->session->getStorage()->user) {
78 78
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
79 79
         }
80 80
 
81 81
         $data     = $this->request->getParsedBody();
82
-        $email    = isset($data['email']) ? $data['email'] : null;
83
-        $password = isset($data['password']) ? $data['password'] : null;
82
+        $email    = isset($data[ 'email' ]) ? $data[ 'email' ] : null;
83
+        $password = isset($data[ 'password' ]) ? $data[ 'password' ] : null;
84 84
 
85 85
         try {
86 86
             $this->session->getStorage()->user = $this->adminUserService->loginUser($email, $password);
87 87
 
88 88
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
89 89
         }
90
-        catch(\Exception $e) {
90
+        catch (\Exception $e) {
91 91
             return $this->login($e->getMessage());
92 92
 
93 93
             //@todo set $e->getMessage() to flash messanger and print messages in next page
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,8 +86,7 @@
 block discarded – undo
86 86
             $this->session->getStorage()->user = $this->adminUserService->loginUser($email, $password);
87 87
 
88 88
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin'));
89
-        }
90
-        catch(\Exception $e) {
89
+        } catch(\Exception $e) {
91 90
             return $this->login($e->getMessage());
92 91
 
93 92
             //@todo set $e->getMessage() to flash messanger and print messages in next page
Please login to merge, or discard this patch.
src/Menu/src/ConfigProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
                     'partial/menu-level' => __DIR__ . '/../templates/partial/menu-level.phtml',
13 13
                 ],
14 14
                 'paths' => [
15
-                    'menu' => [__DIR__ . '/../templates/menu'],
15
+                    'menu' => [ __DIR__ . '/../templates/menu' ],
16 16
                 ],
17 17
             ],
18 18
 
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
                     'name'            => 'admin.menu',
34 34
                     'path'            => '/admin/menu',
35 35
                     'middleware'      => Controller\IndexController::class,
36
-                    'allowed_methods' => ['GET'],
36
+                    'allowed_methods' => [ 'GET' ],
37 37
                 ],
38 38
                 [
39 39
                     'name'            => 'admin.menu.action',
40 40
                     'path'            => '/admin/menu/:action/:id',
41 41
                     'middleware'      => Controller\IndexController::class,
42
-                    'allowed_methods' => ['GET', 'POST'],
42
+                    'allowed_methods' => [ 'GET', 'POST' ],
43 43
                 ],
44 44
             ],
45 45
 
Please login to merge, or discard this patch.
src/Core/Filter/AbstractFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     public function getMessages(array $msgs)
20 20
     {
21 21
         $allMsgs = '';
22
-        array_walk_recursive($msgs, function ($value) use (&$allMsgs){
22
+        array_walk_recursive($msgs, function($value) use (&$allMsgs){
23 23
             $allMsgs .= "- " . $value . "<br/>";
24 24
         });
25 25
 
Please login to merge, or discard this patch.
src/Category/src/ConfigProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
         return [
10 10
             'templates' => [
11 11
                 'paths' => [
12
-                    'category' => [__DIR__ . '/../templates/category'],
12
+                    'category' => [ __DIR__ . '/../templates/category' ],
13 13
                 ],
14 14
             ],
15 15
 
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
                     'name'            => 'admin.categories',
31 31
                     'path'            => '/admin/categories',
32 32
                     'middleware'      => Controller\IndexController::class,
33
-                    'allowed_methods' => ['GET'],
33
+                    'allowed_methods' => [ 'GET' ],
34 34
                 ],
35 35
                 [
36 36
                     'name'            => 'admin.categories.action',
37 37
                     'path'            => '/admin/categories/:action/:id',
38 38
                     'middleware'      => Controller\IndexController::class,
39
-                    'allowed_methods' => ['GET', 'POST']
39
+                    'allowed_methods' => [ 'GET', 'POST' ]
40 40
                 ],
41 41
             ],
42 42
 
Please login to merge, or discard this patch.
src/Category/src/Controller/IndexController.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
     public function index() : \Psr\Http\Message\ResponseInterface
48 48
     {
49 49
         $params = $this->request->getQueryParams();
50
-        $page   = isset($params['page']) ? $params['page'] : 1;
51
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
50
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
51
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
52 52
 
53 53
         $categories = $this->categoryService->getPagination($page, $limit);
54 54
 
55
-        return new HtmlResponse($this->template->render('category::index/index', ['list' => $categories, 'layout' => 'layout/admin']));
55
+        return new HtmlResponse($this->template->render('category::index/index', [ 'list' => $categories, 'layout' => 'layout/admin' ]));
56 56
     }
57 57
 
58 58
     /**
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return \Psr\Http\Message\ResponseInterface
62 62
      */
63
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
63
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
64 64
     {
65 65
         $id       = $this->request->getAttribute('id');
66 66
         $category = $this->categoryService->getCategory($id);
67 67
 
68
-        if($this->request->getParsedBody()){
69
-            $category              = (object)($this->request->getParsedBody() + (array)$category);
68
+        if ($this->request->getParsedBody()) {
69
+            $category              = (object) ($this->request->getParsedBody() + (array) $category);
70 70
             $category->category_id = $id;
71 71
         }
72 72
 
@@ -79,36 +79,36 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function save()
81 81
     {
82
-        try{
82
+        try {
83 83
             $id   = $this->request->getAttribute('id');
84 84
             $data = $this->request->getParsedBody();
85 85
 
86
-            if($id){
86
+            if ($id) {
87 87
                 $this->categoryService->updateCategory($data, $id);
88 88
             }
89
-            else{
89
+            else {
90 90
                 $this->categoryService->createCategory($data);
91 91
             }
92 92
 
93 93
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
94 94
         }
95
-        catch(FilterException $fe){
95
+        catch (FilterException $fe) {
96 96
             return $this->edit($fe->getArrayMessages());
97 97
         }
98
-        catch(\Exception $e){
98
+        catch (\Exception $e) {
99 99
             throw $e;
100 100
         }
101 101
     }
102 102
 
103 103
     public function delete()
104 104
     {
105
-        try{
105
+        try {
106 106
             $id = $this->request->getAttribute('id');
107 107
             $this->categoryService->delete($id);
108 108
 
109 109
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
110 110
         }
111
-        catch(\Exception $e){
111
+        catch (\Exception $e) {
112 112
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
113 113
         }
114 114
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -85,17 +85,14 @@  discard block
 block discarded – undo
85 85
 
86 86
             if($id){
87 87
                 $this->categoryService->updateCategory($data, $id);
88
-            }
89
-            else{
88
+            } else{
90 89
                 $this->categoryService->createCategory($data);
91 90
             }
92 91
 
93 92
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
94
-        }
95
-        catch(FilterException $fe){
93
+        } catch(FilterException $fe){
96 94
             return $this->edit($fe->getArrayMessages());
97
-        }
98
-        catch(\Exception $e){
95
+        } catch(\Exception $e){
99 96
             throw $e;
100 97
         }
101 98
     }
@@ -107,8 +104,7 @@  discard block
 block discarded – undo
107 104
             $this->categoryService->delete($id);
108 105
 
109 106
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
110
-        }
111
-        catch(\Exception $e){
107
+        } catch(\Exception $e){
112 108
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.categories'));
113 109
         }
114 110
     }
Please login to merge, or discard this patch.
data/phinx/migrations/20170214131105_menu.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@
 block discarded – undo
7 7
 
8 8
     public function up()
9 9
     {
10
-        $this->table('menu', ['id' => false, 'primary_key' => 'menu_uuid'])
11
-            ->addColumn('menu_uuid', 'binary', ['limit' => 16])
10
+        $this->table('menu', [ 'id' => false, 'primary_key' => 'menu_uuid' ])
11
+            ->addColumn('menu_uuid', 'binary', [ 'limit' => 16 ])
12 12
             ->addColumn('menu_id', 'text')
13
-            ->addColumn('parent_id', 'text', ['null' => true])
13
+            ->addColumn('parent_id', 'text', [ 'null' => true ])
14 14
             ->addColumn('title', 'text')
15
-            ->addColumn('href', 'text', ['null' => true])
16
-            ->addColumn('is_active', 'boolean', ['default' => false])
17
-            ->addColumn('is_in_header', 'boolean', ['default' => true])
18
-            ->addColumn('is_in_footer', 'boolean', ['default' => true])
19
-            ->addColumn('is_in_side', 'boolean', ['default' => true])
20
-            ->addColumn('order_no', 'integer', ['default' => 0])
21
-            ->addColumn('created_at', 'datetime', ['null' => true])
15
+            ->addColumn('href', 'text', [ 'null' => true ])
16
+            ->addColumn('is_active', 'boolean', [ 'default' => false ])
17
+            ->addColumn('is_in_header', 'boolean', [ 'default' => true ])
18
+            ->addColumn('is_in_footer', 'boolean', [ 'default' => true ])
19
+            ->addColumn('is_in_side', 'boolean', [ 'default' => true ])
20
+            ->addColumn('order_no', 'integer', [ 'default' => 0 ])
21
+            ->addColumn('created_at', 'datetime', [ 'null' => true ])
22 22
             //->addForeignKey('parent_id', 'menu', 'id', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION']) # we can not add constraints
23
-            ->addColumn('article_uuid', 'binary', ['limit' => 16, 'null' => true])
24
-            ->addColumn('category_uuid', 'binary', ['limit' => 16, 'null' => true])
25
-            ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
26
-            ->addForeignKey('category_uuid', 'category', 'category_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
23
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16, 'null' => true ])
24
+            ->addColumn('category_uuid', 'binary', [ 'limit' => 16, 'null' => true ])
25
+            ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
26
+            ->addForeignKey('category_uuid', 'category', 'category_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
27 27
             ->create();
28 28
     }
29 29
 
Please login to merge, or discard this patch.
src/Menu/src/Controller/IndexController.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         ]));
38 38
     }
39 39
 
40
-    public function edit($errors = [])
40
+    public function edit($errors = [ ])
41 41
     {
42 42
         $id   = $this->request->getAttribute('id');
43 43
         $item = $this->menuService->get($id);
44 44
 
45
-        if($this->request->getParsedBody()){
46
-            $item          = (object)($this->request->getParsedBody() + (array)$item);
45
+        if ($this->request->getParsedBody()) {
46
+            $item          = (object) ($this->request->getParsedBody() + (array) $item);
47 47
             $item->menu_id = $id;
48 48
         }
49 49
 
@@ -58,36 +58,36 @@  discard block
 block discarded – undo
58 58
 
59 59
     public function save()
60 60
     {
61
-        try{
61
+        try {
62 62
             $id   = $this->request->getAttribute('id');
63 63
             $data = $this->request->getParsedBody();
64 64
 
65
-            if($id){
65
+            if ($id) {
66 66
                 $this->menuService->updateMenuItem($data, $id);
67 67
             }
68
-            else{
68
+            else {
69 69
                 $this->menuService->addMenuItem($data);
70 70
             }
71 71
 
72 72
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
73 73
         }
74
-        catch(FilterException $fe){
74
+        catch (FilterException $fe) {
75 75
             return $this->edit($fe->getArrayMessages());
76 76
         }
77
-        catch(\Exception $e){
77
+        catch (\Exception $e) {
78 78
             throw $e;
79 79
         }
80 80
     }
81 81
 
82 82
     public function delete()
83 83
     {
84
-        try{
84
+        try {
85 85
             $id = $this->request->getAttribute('id');
86 86
             $this->menuService->delete($id);
87 87
 
88 88
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
89 89
         }
90
-        catch(\Exception $e){
90
+        catch (\Exception $e) {
91 91
             throw $e;
92 92
         }
93 93
     }
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
     public function updateOrder()
96 96
     {
97 97
         $data      = $this->request->getParsedBody();
98
-        $menuOrder = isset($data['order']) ? json_decode($data['order']) : [];
98
+        $menuOrder = isset($data[ 'order' ]) ? json_decode($data[ 'order' ]) : [ ];
99 99
         $status    = $this->menuService->updateMenuOrder($menuOrder);
100 100
 
101
-        return new JsonResponse(['status' => $status]);
101
+        return new JsonResponse([ 'status' => $status ]);
102 102
     }
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,17 +64,14 @@  discard block
 block discarded – undo
64 64
 
65 65
             if($id){
66 66
                 $this->menuService->updateMenuItem($data, $id);
67
-            }
68
-            else{
67
+            } else{
69 68
                 $this->menuService->addMenuItem($data);
70 69
             }
71 70
 
72 71
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
73
-        }
74
-        catch(FilterException $fe){
72
+        } catch(FilterException $fe){
75 73
             return $this->edit($fe->getArrayMessages());
76
-        }
77
-        catch(\Exception $e){
74
+        } catch(\Exception $e){
78 75
             throw $e;
79 76
         }
80 77
     }
@@ -86,8 +83,7 @@  discard block
 block discarded – undo
86 83
             $this->menuService->delete($id);
87 84
 
88 85
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.menu'));
89
-        }
90
-        catch(\Exception $e){
86
+        } catch(\Exception $e){
91 87
             throw $e;
92 88
         }
93 89
     }
Please login to merge, or discard this patch.
src/Menu/src/Filter/MenuFilter.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,65 +20,65 @@
 block discarded – undo
20 20
 
21 21
     public function getInputFilter()
22 22
     {
23
-        if(!$this->inputFilter){
23
+        if (!$this->inputFilter) {
24 24
             $inputFilter = new InputFilter();
25 25
 
26 26
             $inputFilter->add([
27 27
                 'name'       => 'title',
28 28
                 'required'   => true,
29
-                'filters'    => [['name' => 'StripTags'], ['name' => 'StringTrim']],
29
+                'filters'    => [ [ 'name' => 'StripTags' ], [ 'name' => 'StringTrim' ] ],
30 30
                 'validators' => [
31
-                    ['name' => 'NotEmpty'],
32
-                    ['name' => 'StringLength', 'options' => ['max' => '255']],
31
+                    [ 'name' => 'NotEmpty' ],
32
+                    [ 'name' => 'StringLength', 'options' => [ 'max' => '255' ] ],
33 33
                 ],
34 34
             ]);
35 35
 
36 36
             $inputFilter->add([
37 37
                 'name'     => 'href',
38 38
                 'required' => false,
39
-                'filters'  => [['name' => 'StripTags'], ['name' => 'StringTrim']]
39
+                'filters'  => [ [ 'name' => 'StripTags' ], [ 'name' => 'StringTrim' ] ]
40 40
             ]);
41 41
 
42 42
             $inputFilter->add([
43 43
                 'name'       => 'article_id',
44 44
                 'required'   => false,
45
-                'filters'    => [['name' => 'Null']],
45
+                'filters'    => [ [ 'name' => 'Null' ] ],
46 46
                 'validators' => [
47
-                    ['name' => RecordExists::class, 'options' => ['table' => 'articles', 'field' => 'article_id', 'adapter' => $this->db]]
47
+                    [ 'name' => RecordExists::class, 'options' => [ 'table' => 'articles', 'field' => 'article_id', 'adapter' => $this->db ] ]
48 48
                 ]
49 49
             ]);
50 50
 
51 51
             $inputFilter->add([
52 52
                 'name'       => 'category_id',
53 53
                 'required'   => false,
54
-                'filters'    => [['name' => 'Null']],
54
+                'filters'    => [ [ 'name' => 'Null' ] ],
55 55
                 'validators' => [
56
-                    ['name' => RecordExists::class, 'options' => ['table' => 'category', 'field' => 'category_id', 'adapter' => $this->db]]
56
+                    [ 'name' => RecordExists::class, 'options' => [ 'table' => 'category', 'field' => 'category_id', 'adapter' => $this->db ] ]
57 57
                 ]
58 58
             ]);
59 59
 
60 60
             $inputFilter->add([
61 61
                 'name'     => 'is_active',
62 62
                 'required' => false,
63
-                'filters'  => [['name' => 'Boolean']]
63
+                'filters'  => [ [ 'name' => 'Boolean' ] ]
64 64
             ]);
65 65
 
66 66
             $inputFilter->add([
67 67
                 'name'     => 'is_in_header',
68 68
                 'required' => false,
69
-                'filters'  => [['name' => 'Boolean']]
69
+                'filters'  => [ [ 'name' => 'Boolean' ] ]
70 70
             ]);
71 71
 
72 72
             $inputFilter->add([
73 73
                 'name'     => 'is_in_footer',
74 74
                 'required' => false,
75
-                'filters'  => [['name' => 'Boolean']]
75
+                'filters'  => [ [ 'name' => 'Boolean' ] ]
76 76
             ]);
77 77
 
78 78
             $inputFilter->add([
79 79
                 'name'     => 'is_in_side',
80 80
                 'required' => false,
81
-                'filters'  => [['name' => 'Boolean']]
81
+                'filters'  => [ [ 'name' => 'Boolean' ] ]
82 82
             ]);
83 83
 
84 84
             $this->inputFilter = $inputFilter;
Please login to merge, or discard this patch.
src/Article/src/Service/ArticleServiceInterface.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
     /**
13 13
      * Fetches a list of ArticleEntity models.
14 14
      *
15
-     * @param array $params
16 15
      * @return ArrayObject
17 16
      */
18 17
     public function fetchAllArticles($page, $limit);
Please login to merge, or discard this patch.