Completed
Push — master ( 39dfcd...b9f790 )
by Aleksandar
27:20
created
admin_assets/vendors/jQuery-Smart-Wizard/more_examples/services/service.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?
2
-  $action = $_REQUEST["action"];
3
-  switch($action){
2
+  $action = $_REQUEST[ "action" ];
3
+  switch ($action) {
4 4
       case "1":
5 5
           getContent();
6 6
         break;                     
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
         break;
9 9
   }
10 10
 
11
- function getContent(){
11
+ function getContent() {
12 12
    //sleep(1); 
13
-   $step_number = $_REQUEST["step_number"]; 
14
-   $html = '<h2 class="StepTitle">Step '.$step_number.' Content</h2>';
15
-   if($step_number == 1){
16
-      $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
13
+   $step_number = $_REQUEST[ "step_number" ]; 
14
+   $html = '<h2 class="StepTitle">Step ' . $step_number . ' Content</h2>';
15
+   if ($step_number == 1) {
16
+      $html .= '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
17 17
             sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
18 18
             quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
19 19
             Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
20 20
             Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
21 21
             </p>';
22
-   }elseif($step_number == 2){
23
-      $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
22
+   }elseif ($step_number == 2) {
23
+      $html .= '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
24 24
             sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
25 25
             quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
26 26
             Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
             Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
33 33
             Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
34 34
             </p>';
35
-   }elseif($step_number == 3){
36
-      $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
35
+   }elseif ($step_number == 3) {
36
+      $html .= '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
37 37
             sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
38 38
             quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
39 39
             Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
             Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
52 52
             Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
53 53
             </p>';
54
-   }else{
55
-      $html .='<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
54
+   } else {
55
+      $html .= '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
56 56
             sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
57 57
             quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
58 58
             Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
Please login to merge, or discard this patch.
config/container.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 use Zend\ServiceManager\Config;
4 4
 use Zend\ServiceManager\ServiceManager;
5 5
 
6
-$config    = require __DIR__ . '/config.php';                                   // Load configuration
7
-$container = new ServiceManager();                                              // Build container
8
-(new Config($config['dependencies']))->configureServiceManager($container);
9
-$container->setService('config', $config);                        // Inject config
6
+$config    = require __DIR__ . '/config.php'; // Load configuration
7
+$container = new ServiceManager(); // Build container
8
+(new Config($config[ 'dependencies' ]))->configureServiceManager($container);
9
+$container->setService('config', $config); // Inject config
10 10
 
11 11
 return $container;
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
config/autoload/templates.global.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
             'error/404'      => 'templates/error/404.phtml',
10 10
         ],
11 11
         'paths'  => [
12
-            'layout' => ['templates/layout'],
13
-            'error'  => ['templates/error'],
12
+            'layout' => [ 'templates/layout' ],
13
+            'error'  => [ 'templates/error' ],
14 14
         ],
15 15
     ],
16 16
 ];
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
public/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-if(php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
4
+if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH))) {
5 5
     return false;
6 6
 }
7 7
 
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 require 'vendor/autoload.php';
10 10
 
11 11
 // Self-called anonymous function that creates its own scope and keep the global namespace clean.
12
-(function () {
12
+(function() {
13 13
     /** @var \Interop\Container\ContainerInterface $container */
14 14
     $container = require 'config/container.php';
15 15
 
Please login to merge, or discard this patch.
src/Core/ConfigProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             'middleware_pipeline' => [
51 51
                 // execute this middlweare on every /admin[*] path
52 52
                 'permission' => [
53
-                    'middleware' => [Middleware\AdminAuth::class],
53
+                    'middleware' => [ Middleware\AdminAuth::class ],
54 54
                     'priority'   => 100,
55 55
                     'path'       => '/admin'
56 56
                 ],
Please login to merge, or discard this patch.
src/Admin/src/Controller/UserController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $user   = $this->session->getStorage()->user;
64 64
         $params = $this->request->getQueryParams();
65
-        $page   = isset($params['page']) ? $params['page'] : 1;
66
-        $limit  = isset($params['limit']) ? $params['limit'] : 15;
65
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : 1;
66
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : 15;
67 67
 
68 68
         $adminUsers = $this->adminUserService->getPagination($page, $limit, $user->admin_user_id);
69 69
 
70
-        return new HtmlResponse($this->template->render('admin::user/index', ['list' => $adminUsers, 'layout' => 'layout/admin']));
70
+        return new HtmlResponse($this->template->render('admin::user/index', [ 'list' => $adminUsers, 'layout' => 'layout/admin' ]));
71 71
     }
72 72
 
73 73
     /**
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return \Psr\Http\Message\ResponseInterface
77 77
      */
78
-    public function edit($errors = []): \Psr\Http\Message\ResponseInterface
78
+    public function edit($errors = [ ]): \Psr\Http\Message\ResponseInterface
79 79
     {
80 80
         $id   = $this->request->getAttribute('id');
81 81
         $user = $this->adminUserService->getUser($id);
82 82
 
83
-        if($this->request->getParsedBody()){
84
-            $user                = (object)($this->request->getParsedBody() + (array)$user);
83
+        if ($this->request->getParsedBody()) {
84
+            $user                = (object) ($this->request->getParsedBody() + (array) $user);
85 85
             $user->admin_user_id = $id;
86 86
         }
87 87
 
@@ -94,36 +94,36 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function save()
96 96
     {
97
-        try{
97
+        try {
98 98
             $userId = $this->request->getAttribute('id');
99 99
             $data   = $this->request->getParsedBody();
100 100
 
101
-            if($userId){
101
+            if ($userId) {
102 102
                 $this->adminUserService->updateUser($data, $userId);
103 103
             }
104
-            else{
104
+            else {
105 105
                 $this->adminUserService->registerNewUser($data);
106 106
             }
107 107
 
108 108
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
109 109
         }
110
-        catch(FilterException $fe){
110
+        catch (FilterException $fe) {
111 111
             return $this->edit($fe->getArrayMessages());
112 112
         }
113
-        catch(\Exception $e){
113
+        catch (\Exception $e) {
114 114
             throw $e;
115 115
         }
116 116
     }
117 117
 
118 118
     public function delete()
119 119
     {
120
-        try{
120
+        try {
121 121
             $userId = $this->request->getAttribute('id');
122 122
             $this->adminUserService->delete($userId);
123 123
 
124 124
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
125 125
         }
126
-        catch(\Exception $e){
126
+        catch (\Exception $e) {
127 127
             return $this->response->withStatus(302)->withHeader('Location', $this->router->generateUri('admin.users'));
128 128
         }
129 129
     }
Please login to merge, or discard this patch.
src/Admin/src/Action/IndexAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
      */
40 40
     public function __invoke(Request $request, Response $response, callable $next = null)
41 41
     {
42
-        return new HtmlResponse($this->template->render('admin::index', ['layout' => 'layout/admin']));
42
+        return new HtmlResponse($this->template->render('admin::index', [ 'layout' => 'layout/admin' ]));
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
src/Admin/src/Controller/AuthController.php 1 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.
src/Core/Service/AdminUserService.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function loginUser($email, $password)
59 59
     {
60
-        if(!$email || !$password){
60
+        if (!$email || !$password) {
61 61
             throw new \Exception('Both email and password are required.', 400);
62 62
         }
63 63
 
64 64
         $user = $this->adminUsersMapper->getByEmail($email);
65 65
 
66
-        if(!$user){
66
+        if (!$user) {
67 67
             throw new \Exception('User does not exist.');
68 68
         }
69 69
 
70
-        if(!$this->crypt->verify($password, $user->password)){
70
+        if (!$this->crypt->verify($password, $user->password)) {
71 71
             throw new \Exception('Password does not match.');
72 72
         }
73 73
 
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $filter = $this->adminUserFilter->getInputFilter()->setData($data);
115 115
 
116
-        if(!$filter->isValid()){
116
+        if (!$filter->isValid()) {
117 117
             throw new FilterException($filter->getMessages());
118 118
         }
119 119
 
120 120
         $data = $filter->getValues();
121
-        unset($data['confirm_password']);
122
-        $data['password']        = $this->crypt->create($data['password']);
123
-        $data['admin_user_id']   = Uuid::uuid1()->toString();
124
-        $data['admin_user_uuid'] = (new MysqlUuid($data['admin_user_id']))->toFormat(new Binary);
121
+        unset($data[ 'confirm_password' ]);
122
+        $data[ 'password' ]        = $this->crypt->create($data[ 'password' ]);
123
+        $data[ 'admin_user_id' ]   = Uuid::uuid1()->toString();
124
+        $data[ 'admin_user_uuid' ] = (new MysqlUuid($data[ 'admin_user_id' ]))->toFormat(new Binary);
125 125
 
126 126
         return $this->adminUsersMapper->insert($data);
127 127
     }
@@ -135,28 +135,28 @@  discard block
 block discarded – undo
135 135
         $filter = $this->adminUserFilter->getInputFilter()->setData($data);
136 136
 
137 137
         // we dont want to force user to enter the password again
138
-        if($data['password'] == ''){
138
+        if ($data[ 'password' ] == '') {
139 139
             $filter->remove('password');
140 140
             $filter->remove('confirm_password');
141 141
         }
142 142
 
143 143
         // if we want to keep same email
144
-        if($user->email == $data['email']){
144
+        if ($user->email == $data[ 'email' ]) {
145 145
             $filter->remove('email');
146 146
         }
147 147
 
148
-        if(!$filter->isValid()){
148
+        if (!$filter->isValid()) {
149 149
             throw new FilterException($filter->getMessages());
150 150
         }
151 151
 
152 152
         $data = $filter->getValues();
153 153
 
154
-        if(isset($data['password'])){
155
-            unset($data['confirm_password']);
156
-            $data['password'] = $this->crypt->create($data['password']);
154
+        if (isset($data[ 'password' ])) {
155
+            unset($data[ 'confirm_password' ]);
156
+            $data[ 'password' ] = $this->crypt->create($data[ 'password' ]);
157 157
         }
158 158
 
159
-        return $this->adminUsersMapper->update($data, ['admin_user_id' => $userId]);
159
+        return $this->adminUsersMapper->update($data, [ 'admin_user_id' => $userId ]);
160 160
     }
161 161
 
162 162
     /**
@@ -167,6 +167,6 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function delete($userId)
169 169
     {
170
-        return (bool)$this->adminUsersMapper->delete(['admin_user_id' => $userId]);
170
+        return (bool) $this->adminUsersMapper->delete([ 'admin_user_id' => $userId ]);
171 171
     }
172 172
 }
Please login to merge, or discard this patch.