Completed
Pull Request — master (#3)
by
unknown
20:32
created
Interfaces/Mediable.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Rafidion Michael
5
- * Date: 02/12/2014
6
- * Time: 01:56
7
- */
3
+     * Created by PhpStorm.
4
+     * User: Rafidion Michael
5
+     * Date: 02/12/2014
6
+     * Time: 01:56
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\Interfaces;
10 10
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 namespace Mykees\MediaBundle\Interfaces;
10 10
 
11 11
 
12
-Interface Mediable{
12
+Interface Mediable {
13 13
 
14 14
     public function getId();
15 15
 }
Please login to merge, or discard this patch.
EventListener/UploadSubscriber.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Rafidion Michael
5
- * Date: 30/11/2014
6
- * Time: 18:22
7
- */
3
+     * Created by PhpStorm.
4
+     * User: Rafidion Michael
5
+     * Date: 30/11/2014
6
+     * Time: 18:22
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\EventListener;
10 10
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function uploadProcess(UploadEvent $event)
40 40
     {
41
-        $file  = $event->getFile()->all();
41
+        $file = $event->getFile()->all();
42 42
         $fileUploaded = $file['file'];
43
-        $model   = $event->getMediableModel();
43
+        $model = $event->getMediableModel();
44 44
         $model_id = $event->getMediableId();
45 45
         $resize_option = $event->getContainer()->getParameter('mykees.media.resize');
46 46
         $extension = pathinfo($fileUploaded->getClientOriginalName(), PATHINFO_EXTENSION);
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
                 }
86 86
 
87 87
                 return true;
88
-            } else {
88
+            }else {
89 89
                 return new Response();
90 90
             }
91
-        } else {
91
+        }else {
92 92
             return new Response();
93 93
         }
94 94
     }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     private function isValidExtension($extension, $event)
103 103
     {
104 104
         $extensions = $event->getContainer()->getParameter('mykees.media.extension');
105
-        $valid_extensions = !empty($extensions) ? $extensions : ['jpg','jpeg','JPG','JPEG'];
105
+        $valid_extensions = !empty($extensions) ? $extensions : ['jpg', 'jpeg', 'JPG', 'JPEG'];
106 106
 
107 107
         return in_array($extension, $valid_extensions);
108 108
     }
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
             $count++;
143 143
 
144 144
             return $this->mediaExist($filename, $webroot, $count);
145
-        } else {
146
-            $filename =  $file;
145
+        }else {
146
+            $filename = $file;
147 147
 
148 148
             return $filename;
149 149
         }
Please login to merge, or discard this patch.
EventListener/MediasListener.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
     {
32 32
         $model = $args->getEntity();
33 33
 
34
-        if($model instanceof Mediable)
34
+        if ($model instanceof Mediable)
35 35
         {
36
-            $manager = new MediaManager($this->managerRegistry,$this->rootDir,$this->resize_parameters);
36
+            $manager = new MediaManager($this->managerRegistry, $this->rootDir, $this->resize_parameters);
37 37
             $manager->removeAllMediasForModel($model);
38 38
         }
39 39
     }
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Rafidion Michael
5
- * Date: 12/12/2014
6
- * Time: 12:21
7
- */
3
+     * Created by PhpStorm.
4
+     * User: Rafidion Michael
5
+     * Date: 12/12/2014
6
+     * Time: 12:21
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\EventListener;
10 10
 
Please login to merge, or discard this patch.
Traits/MediableTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
 
15 15
     protected $medias;
16 16
 
17
-    public function getMediableModel(){
17
+    public function getMediableModel() {
18 18
         return Reflection::getClassShortName($this);
19 19
     }
20 20
 
21
-    public function getMediableId(){
21
+    public function getMediableId() {
22 22
         return $this->getId();
23 23
     }
24 24
 
25
-    public function getMedias(){
26
-        $this->medias = $this->medias ? : new ArrayCollection();
25
+    public function getMedias() {
26
+        $this->medias = $this->medias ?: new ArrayCollection();
27 27
         return $this->medias;
28 28
     }
29 29
 }
Please login to merge, or discard this patch.
Util/Reflection.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: tetsu0o
5
- * Date: 28/12/14
6
- * Time: 12:45
7
- */
3
+     * Created by PhpStorm.
4
+     * User: tetsu0o
5
+     * Date: 28/12/14
6
+     * Time: 12:45
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\Util;
10 10
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,25 +19,25 @@
 block discarded – undo
19 19
     }
20 20
 
21 21
 
22
-    public static function getClassShortName ( $model ) {
23
-        $reflection = new \ReflectionClass( $model );
22
+    public static function getClassShortName($model) {
23
+        $reflection = new \ReflectionClass($model);
24 24
         return $reflection->getShortName();
25 25
     }
26 26
 
27 27
 
28
-    public static function getBundlePath ( $model  ){
29
-        $explode = explode('\\', self::getClassName($model ));
28
+    public static function getBundlePath($model) {
29
+        $explode = explode('\\', self::getClassName($model));
30 30
         return $explode[0].'\\'.$explode[1].'\\'.$explode[2].'\\'.$explode[3];
31 31
     }
32 32
 
33 33
 
34
-    public static function getBundleRepository ( $model  ){
35
-        $explode = explode('\\', self::getClassName($model ));
34
+    public static function getBundleRepository($model) {
35
+        $explode = explode('\\', self::getClassName($model));
36 36
         return $explode[0].$explode[1].':'.$explode[3];
37 37
     }
38 38
 
39
-    public static function getShortBundleRepository ( $model  ){
40
-        $explode = explode('\\', self::getClassName($model ));
39
+    public static function getShortBundleRepository($model) {
40
+        $explode = explode('\\', self::getClassName($model));
41 41
         return $explode[0].$explode[1];
42 42
     }
43 43
 
Please login to merge, or discard this patch.
Manager/AbstractManager.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,35 +16,35 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function getModelInfos(array $datas)
18 18
     {
19
-        $ids= [];
19
+        $ids = [];
20 20
         $models = [];
21 21
         $model_exist = false;
22 22
 
23
-        foreach( $datas as $k=>$data )
23
+        foreach ($datas as $k=>$data)
24 24
         {
25
-            if($data instanceof Mediable)
25
+            if ($data instanceof Mediable)
26 26
             {
27
-                array_push($ids,$data->getMediableId());
28
-                if( $model_exist != $data->getMediableModel() )
27
+                array_push($ids, $data->getMediableId());
28
+                if ($model_exist != $data->getMediableModel())
29 29
                 {
30
-                    array_push($models,$data->getMediableModel());
30
+                    array_push($models, $data->getMediableModel());
31 31
                     $model_exist = $data->getMediableModel();
32 32
                 }
33 33
             }
34 34
         }
35 35
 
36
-        return [ 'ids'=>$ids, 'models'=>$models ];
36
+        return ['ids'=>$ids, 'models'=>$models];
37 37
     }
38 38
 
39 39
     public function refreshMediasArray(array $medias, array $models)
40 40
     {
41 41
         $this->clean($models);
42
-        foreach($models as $model)
42
+        foreach ($models as $model)
43 43
         {
44
-            foreach($medias as $media){
45
-                if($model instanceof Mediable)
44
+            foreach ($medias as $media) {
45
+                if ($model instanceof Mediable)
46 46
                 {
47
-                    if($model->getId() == $media->getMediableId() && $model->getMediableModel() == $media->getMediableModel())
47
+                    if ($model->getId() == $media->getMediableId() && $model->getMediableModel() == $media->getMediableModel())
48 48
                     {
49 49
                         $model->getMedias()->add($media);
50 50
                     }
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function addMedias(array $medias, Mediable $model)
62 62
     {
63
-        foreach($medias as $media){
64
-            if(!empty($media) && Reflection::getClassShortName($media) == 'Media'){
65
-                $this->addMedia($media,$model);
63
+        foreach ($medias as $media) {
64
+            if (!empty($media) && Reflection::getClassShortName($media) == 'Media') {
65
+                $this->addMedia($media, $model);
66 66
             }
67 67
         }
68 68
     }
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
     public function refreshMedias(array $medias, Mediable $model)
71 71
     {
72 72
         $model->getMedias()->clear();
73
-        $this->addMedias($medias,$model);
73
+        $this->addMedias($medias, $model);
74 74
     }
75 75
 
76 76
     public function clean(array $models)
77 77
     {
78
-        foreach($models as $model)
78
+        foreach ($models as $model)
79 79
         {
80 80
             $model->getMedias()->clear();
81 81
         }
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: tetsu0o
5
- * Date: 28/12/14
6
- * Time: 15:02
7
- */
3
+     * Created by PhpStorm.
4
+     * User: tetsu0o
5
+     * Date: 28/12/14
6
+     * Time: 15:02
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\Manager;
10 10
 
Please login to merge, or discard this patch.
Controller/WidgetAjaxController.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Mykees\MediaBundle\Entity\Media;
5 5
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
-use Symfony\Component\HttpFoundation\Request;
7 6
 use Symfony\Component\HttpFoundation\Response;
8 7
 
9 8
 class WidgetAjaxController extends Controller
Please login to merge, or discard this patch.
DataFixtures/ORM/LoadMedias.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Rafidion Michael
5
- * Date: 28/11/2014
6
- * Time: 17:38
7
- */
3
+     * Created by PhpStorm.
4
+     * User: Rafidion Michael
5
+     * Date: 28/11/2014
6
+     * Time: 17:38
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\DataFixtures\ORM;
10 10
 
Please login to merge, or discard this patch.
Event/MediaUploadEvents.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Created by PhpStorm.
4
- * User: Rafidion Michael
5
- * Date: 30/11/2014
6
- * Time: 18:21
7
- */
3
+     * Created by PhpStorm.
4
+     * User: Rafidion Michael
5
+     * Date: 30/11/2014
6
+     * Time: 18:21
7
+     */
8 8
 
9 9
 namespace Mykees\MediaBundle\Event;
10 10
 
Please login to merge, or discard this patch.