Completed
Pull Request — master (#38)
by Aleksandar
04:34
created
src/Core/Service/AdminUserService.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 namespace Core\Service;
5 5
 
6 6
 use Core\Mapper\AdminUsersMapper;
7
-use Zend\Db\TableGateway\TableGateway;
8
-use Zend\Db\Sql\Predicate\Expression;
9 7
 use Zend\Paginator\Adapter\DbSelect;
10 8
 use Zend\Paginator\Paginator;
11 9
 use Zend\Crypt\Password\Bcrypt;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@
 block discarded – undo
51 51
     {
52 52
         $user = $this->adminUsersMapper->getByEmail($email);
53 53
 
54
-        if(!$user){
54
+        if (!$user) {
55 55
             throw new \Exception('User does not exist.');
56 56
         }
57 57
 
58
-        if(!$this->crypt->verify($password, $user->password)){
58
+        if (!$this->crypt->verify($password, $user->password)) {
59 59
             throw new \Exception('Password does not match.');
60 60
         }
61 61
 
Please login to merge, or discard this patch.
src/Admin/Controller/UserController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
     public function index() : \Psr\Http\Message\ResponseInterface
44 44
     {
45 45
         $params = $this->request->getQueryParams();
46
-        $page   = isset($params['page']) ? $params['page'] : self::DEFAUTL_PAGE;
47
-        $limit  = isset($params['limit']) ? $params['limit'] : self::DEFAUTL_LIMIT;
46
+        $page   = isset($params[ 'page' ]) ? $params[ 'page' ] : self::DEFAUTL_PAGE;
47
+        $limit  = isset($params[ 'limit' ]) ? $params[ 'limit' ] : self::DEFAUTL_LIMIT;
48 48
 
49 49
         //$filter = [
50 50
         //    'country'    => isset($params['country']) ? $params['country'] : '',
@@ -54,6 +54,6 @@  discard block
 block discarded – undo
54 54
 
55 55
         $adminUsers = $this->adminUserService->getPagination($page, $limit);
56 56
 
57
-        return new HtmlResponse($this->template->render('admin::user/index', ['list' => $adminUsers]));
57
+        return new HtmlResponse($this->template->render('admin::user/index', [ 'list' => $adminUsers ]));
58 58
     }
59 59
 }
Please login to merge, or discard this patch.
data/phinx/migrations/20160908142829_admin_users.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public function up()
8 8
     {
9
-        $this->table('admin_users', ['id' => false, 'primary_key' => 'admin_user_uuid'])
10
-            ->addColumn('admin_user_uuid', 'binary', ['limit' => 16])
9
+        $this->table('admin_users', [ 'id' => false, 'primary_key' => 'admin_user_uuid' ])
10
+            ->addColumn('admin_user_uuid', 'binary', [ 'limit' => 16 ])
11 11
             ->addColumn('first_name', 'text')
12 12
             ->addColumn('last_name', 'text')
13
-            ->addColumn('email', 'string', ['limit' => 128])
14
-            ->addColumn('password', 'char', ['limit' => 60])
15
-            ->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
16
-            ->addColumn('last_login', 'datetime', ['null' => true])
17
-            ->addIndex(['email'], ['name' => 'email_INDEX'])
13
+            ->addColumn('email', 'string', [ 'limit' => 128 ])
14
+            ->addColumn('password', 'char', [ 'limit' => 60 ])
15
+            ->addColumn('created_at', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP' ])
16
+            ->addColumn('last_login', 'datetime', [ 'null' => true ])
17
+            ->addIndex([ 'email' ], [ 'name' => 'email_INDEX' ])
18 18
             ->create();
19 19
 
20 20
         // Insert default user with password testtest
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
         $faker = Faker\Factory::create();
23 23
         $count = rand(100, 150);
24 24
 
25
-        for($i = 0; $i < $count; $i++){
25
+        for ($i = 0; $i < $count; $i++) {
26 26
             $data = [
27 27
                 'admin_user_uuid' => $faker->uuid,
28 28
                 'email'           => $faker->email,
29 29
                 'first_name'      => $faker->firstName,
30 30
                 'last_name'       => $faker->lastName,
31
-                'password'        => '$2y$10$jhGH8RXl269ho1CrLaDiregVuW84HegLHmBFUCKTgDQTH2XgPZyBK',//password = testtest
31
+                'password'        => '$2y$10$jhGH8RXl269ho1CrLaDiregVuW84HegLHmBFUCKTgDQTH2XgPZyBK', //password = testtest
32 32
                 'last_login'      => rand(0, 10) === 7 ? null : $faker->dateTimeBetween('-10 days', 'now')->format('Y-m-d H:i:s'),
33 33
                 'created_at'      => $faker->dateTimeBetween('-20 days', '-10 days')->format('Y-m-d H:i:s'),
34 34
             ];
Please login to merge, or discard this patch.