Completed
Push — master ( 9476f2...383e34 )
by Aleksandar
05:13
created
data/phinx/migrations/20161229132350_events.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,25 +10,25 @@  discard block
 block discarded – undo
10 10
 {
11 11
     public function up()
12 12
     {
13
-        $this->table('article_events', ['id' => false])
14
-            ->addColumn('article_uuid', 'binary', ['limit' => 16])
13
+        $this->table('article_events', [ 'id' => false ])
14
+            ->addColumn('article_uuid', 'binary', [ 'limit' => 16 ])
15 15
             ->addColumn('title', 'text')
16
-            ->addColumn('sub_title', 'text', ['null' => true])
16
+            ->addColumn('sub_title', 'text', [ 'null' => true ])
17 17
             ->addColumn('place_name', 'text')
18 18
             ->addColumn('body', 'text')
19 19
             ->addColumn('longitude', 'text')
20 20
             ->addColumn('latitude', 'text')
21
-            ->addColumn('featured_img', 'text', ['null' => true])
22
-            ->addColumn('main_img', 'text', ['null' => true])
21
+            ->addColumn('featured_img', 'text', [ 'null' => true ])
22
+            ->addColumn('main_img', 'text', [ 'null' => true ])
23 23
             ->addColumn('start_at', 'datetime')
24 24
             ->addColumn('end_at', 'datetime')
25
-            ->addForeignKey('article_uuid', 'articles', 'article_uuid', ['delete' => 'NO_ACTION', 'update' => 'NO_ACTION'])
25
+            ->addForeignKey('article_uuid', 'articles', 'article_uuid', [ 'delete' => 'NO_ACTION', 'update' => 'NO_ACTION' ])
26 26
             ->create();
27 27
 
28
-        $ids  = [];
28
+        $ids  = [ ];
29 29
         $rows = $this->fetchAll('select admin_user_uuid from admin_users;');
30
-        foreach($rows as $r){
31
-            $ids[] = $r['admin_user_uuid'];
30
+        foreach ($rows as $r) {
31
+            $ids[ ] = $r[ 'admin_user_uuid' ];
32 32
         }
33 33
 
34 34
         $faker  = Faker\Factory::create();
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
         $count  = rand(25, 300);
37 37
 
38 38
         // Download N images and set it randomly to the events
39
-        for($i = 0; $i < 5; $i++){
39
+        for ($i = 0; $i < 5; $i++) {
40 40
             $image       = $faker->image();
41 41
             $destination = $upload->getPath(basename($image));
42 42
             rename($image, $destination);
43
-            $mainImg[] = substr($destination, strlen('/var/www/unfinished/public'));
43
+            $mainImg[ ] = substr($destination, strlen('/var/www/unfinished/public'));
44 44
 
45 45
             $image       = $faker->image();
46 46
             $destination = $upload->getPath(basename($image));
47 47
             rename($image, $destination);
48
-            $featuredImg[] = substr($destination, strlen('/var/www/unfinished/public'));
48
+            $featuredImg[ ] = substr($destination, strlen('/var/www/unfinished/public'));
49 49
         }
50 50
 
51
-        for($i = 0; $i < $count; $i++){
51
+        for ($i = 0; $i < $count; $i++) {
52 52
             $start     = rand(1, 20);
53 53
             $id        = $faker->uuid;
54 54
             $mysqluuid = (new Uuid($id))->toFormat(new Binary());
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 'article_id'      => $id,
60 60
                 'slug'            => strtolower(trim(preg_replace('~[^\pL\d]+~u', '-', $title), '-')),
61 61
                 'status'          => 1,
62
-                'admin_user_uuid' => $ids[array_rand($ids)],
62
+                'admin_user_uuid' => $ids[ array_rand($ids) ],
63 63
                 'type'            => ArticleType::EVENT
64 64
             ];
65 65
 
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
                 'longitude'    => $faker->longitude,
71 71
                 'latitude'     => $faker->latitude,
72 72
                 'place_name'   => $faker->sentence(1),
73
-                'main_img'     => $mainImg[array_rand($mainImg)],
74
-                'featured_img' => $featuredImg[array_rand($featuredImg)],
73
+                'main_img'     => $mainImg[ array_rand($mainImg) ],
74
+                'featured_img' => $featuredImg[ array_rand($featuredImg) ],
75 75
                 'start_at'     => date("Y-m-d H:i:s", strtotime("+$start  day +$start hours")),
76 76
                 'end_at'       => date("Y-m-d H:i:s", strtotime("+$start  day +" . ($start + rand(1, 5)) . " hours"))
77 77
             ];
Please login to merge, or discard this patch.
src/Core/Filter/EventFilter.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,67 +12,67 @@
 block discarded – undo
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'       => 'title',
20 20
                 'required'   => true,
21
-                'filters'    => [['name' => 'StringTrim']],
21
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
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'     => 'sub_title',
30 30
                 'required' => false,
31
-                'filters'  => [['name' => 'StringTrim']]
31
+                'filters'  => [ [ 'name' => 'StringTrim' ] ]
32 32
             ]);
33 33
 
34 34
             $inputFilter->add([
35 35
                 'name'     => 'place_name',
36 36
                 'required' => true,
37
-                'filters'  => [['name' => 'StringTrim']]
37
+                'filters'  => [ [ 'name' => 'StringTrim' ] ]
38 38
             ]);
39 39
 
40 40
             $inputFilter->add([
41 41
                 'name'       => 'body',
42 42
                 'required'   => true,
43
-                'filters'    => [['name' => 'StringTrim']],
43
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
44 44
                 'validators' => [
45
-                    ['name' => 'NotEmpty'],
46
-                    ['name' => 'StringLength', 'options' => ['min' => 2, 'max' => 1500]],
45
+                    [ 'name' => 'NotEmpty' ],
46
+                    [ 'name' => 'StringLength', 'options' => [ 'min' => 2, 'max' => 1500 ] ],
47 47
                 ],
48 48
             ]);
49 49
 
50 50
             $inputFilter->add([
51 51
                 'name'       => 'start_at',
52 52
                 'required'   => true,
53
-                'filters'    => [['name' => 'StringTrim']],
54
-                'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]]
53
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
54
+                'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ]
55 55
             ]);
56 56
 
57 57
             $inputFilter->add([
58 58
                 'name'       => 'end_at',
59 59
                 'required'   => true,
60
-                'filters'    => [['name' => 'StringTrim']],
61
-                'validators' => [['name' => 'NotEmpty'], ['name' => 'Date', 'options' => ['format' => 'Y-m-d H:i:s']]]
60
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
61
+                'validators' => [ [ 'name' => 'NotEmpty' ], [ 'name' => 'Date', 'options' => [ 'format' => 'Y-m-d H:i:s' ] ] ]
62 62
             ]);
63 63
 
64 64
             $inputFilter->add([
65 65
                 'name'       => 'longitude',
66 66
                 'required'   => true,
67
-                'filters'    => [['name' => 'StringTrim']],
68
-                'validators' => [['name' => 'NotEmpty']],
67
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
68
+                'validators' => [ [ 'name' => 'NotEmpty' ] ],
69 69
             ]);
70 70
 
71 71
             $inputFilter->add([
72 72
                 'name'       => 'latitude',
73 73
                 'required'   => true,
74
-                'filters'    => [['name' => 'StringTrim']],
75
-                'validators' => [['name' => 'NotEmpty']],
74
+                'filters'    => [ [ 'name' => 'StringTrim' ] ],
75
+                'validators' => [ [ 'name' => 'NotEmpty' ] ],
76 76
             ]);
77 77
 
78 78
             $this->inputFilter = $inputFilter;
Please login to merge, or discard this patch.
src/Core/Mapper/ArticleEventsMapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@
 block discarded – undo
35 35
     public function getPaginationSelect()
36 36
     {
37 37
         return $this->getSql()->select()
38
-            ->columns(['title', 'body', 'longitude', 'latitude'])
38
+            ->columns([ 'title', 'body', 'longitude', 'latitude' ])
39 39
             ->join('articles', 'article_events.article_uuid = articles.article_uuid')
40
-            ->where(['articles.type' => ArticleType::EVENT])
41
-            ->order(['created_at' => 'desc']);
40
+            ->where([ 'articles.type' => ArticleType::EVENT ])
41
+            ->order([ 'created_at' => 'desc' ]);
42 42
     }
43 43
 
44 44
     public function get($id)
45 45
     {
46 46
         $select = $this->getSql()->select()
47 47
             ->join('articles', 'article_events.article_uuid = articles.article_uuid')
48
-            ->where(['articles.article_id' => $id]);
48
+            ->where([ 'articles.article_id' => $id ]);
49 49
 
50 50
         return $this->selectWith($select)->current();
51 51
     }
Please login to merge, or discard this patch.