Completed
Branch s3_upload (b576da)
by satoru
04:12
created
src/Validation/ContentsFileValidation.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     
14 14
     
15 15
     public static function uploadMaxSizeCheck ($value,$context){
16
-       return $value['error'] != UPLOAD_ERR_INI_SIZE;
16
+        return $value['error'] != UPLOAD_ERR_INI_SIZE;
17 17
     }
18 18
     
19 19
     /**
Please login to merge, or discard this patch.
src/Controller/Traits/NormalContentsFileControllerTrait.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -76,6 +76,7 @@
 block discarded – undo
76 76
      * normalResizeSet
77 77
      * 通常のリサイズ処理
78 78
      * @author hagiwara
79
+     * @param string $filepath
79 80
      */
80 81
     private function normalResizeSet($filepath, $resize)
81 82
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
         $file = $filepath;
62 62
 
63 63
         header('Content-Length: ' . filesize($file));
64
-        if(!empty($fileExt)) {
64
+        if (!empty($fileExt)) {
65 65
             $fileContentType = $this->getFileType($fileExt);
66 66
             header('Content-Type: ' . $fileContentType);
67 67
         } else {
Please login to merge, or discard this patch.
src/Controller/Traits/S3ContentsFileControllerTrait.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -73,6 +73,7 @@
 block discarded – undo
73 73
      * s3ResizeSet
74 74
      * S3のリサイズ処理
75 75
      * @author hagiwara
76
+     * @param string $filepath
76 77
      */
77 78
     private function s3ResizeSet($filepath, $resize)
78 79
     {
Please login to merge, or discard this patch.
src/Model/Behavior/ContentsFileBehavior.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -321,6 +321,8 @@
 block discarded – undo
321 321
      * mkdir
322 322
      * ディレクトリの作成(パーミッションの設定のため
323 323
      * @author hagiwara
324
+     * @param integer $permission
325
+     * @param boolean $recursive
324 326
      */
325 327
     private function mkdir($path, $permission, $recursive)
326 328
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -283,8 +283,9 @@
 block discarded – undo
283 283
                     break;
284 284
                 }
285 285
             }
286
-            if (!isset($tp) || $tp !== null)
287
-                break;
286
+            if (!isset($tp) || $tp !== null) {
287
+                            break;
288
+            }
288 289
         }
289 290
         // 透過GIF
290 291
         if (isset($tp) && is_array($tp)) {
Please login to merge, or discard this patch.
src/Model/Behavior/Traits/NormalContentsFileBehaviorTrait.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -85,6 +85,9 @@
 block discarded – undo
85 85
         return true;
86 86
     }
87 87
 
88
+    /**
89
+     * @param string $newFilepath
90
+     */
88 91
     private function normalImageResize($newFilepath, $resizeSettings)
89 92
     {
90 93
         return $this->imageResize($newFilepath, $resizeSettings);
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -4,10 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Cake\Core\Configure;
6 6
 use Cake\Filesystem\Folder;
7
-use Cake\I18n\Time;
8 7
 use Cake\Network\Exception\InternalErrorException;
9
-use Cake\ORM\TableRegistry;
10
-use Cake\Utility\Security;
11 8
 
12 9
 /**
13 10
  * NormalContentsFileBehaviorTrait
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         $newFilepath = $newFiledir . $fileInfo['field_name'];
42 42
         if (
43 43
             !$this->mkdir($newFiledir, 0777, true) ||
44
-            !rename(Configure::read('ContentsFile.Setting.Normal.tmpDir') . $fileInfo['tmp_file_name'] , $newFilepath)
44
+            !rename(Configure::read('ContentsFile.Setting.Normal.tmpDir') . $fileInfo['tmp_file_name'], $newFilepath)
45 45
         ) {
46 46
             return false;
47 47
         }
Please login to merge, or discard this patch.
src/Model/Behavior/Traits/S3ContentsFileBehaviorTrait.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -94,6 +94,7 @@
 block discarded – undo
94 94
      * s3ImageResize
95 95
      * 画像のリサイズ処理(S3用)
96 96
      * @author hagiwara
97
+     * @param string $filepath
97 98
      */
98 99
     public function s3ImageResize($filepath, $resize)
99 100
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Cake\Filesystem\Folder;
8 8
 use Cake\I18n\Time;
9 9
 use Cake\Network\Exception\InternalErrorException;
10
-use Cake\ORM\TableRegistry;
11 10
 use Cake\Utility\Security;
12 11
 
13 12
 /**
Please login to merge, or discard this patch.
src/Model/Entity/ContentsFileTrait.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -159,6 +159,7 @@
 block discarded – undo
159 159
      * tmpディレクトリへのアップロード
160 160
      *
161 161
      * @author hagiwara
162
+     * @param string $tmpFileName
162 163
      */
163 164
     private function tmpUpload($tmpName, $fieldSetting, $tmpFileName)
164 165
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $default = [];
25 25
         //設定値はまとめる
26 26
         $settings = $this->contentsFileConfig;
27
-        $this->contentsFileSettings = array_merge($default,$settings);
27
+        $this->contentsFileSettings = array_merge($default, $settings);
28 28
     }
29 29
 
30 30
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             !empty($this->id) &&
56 56
             //設定値に設定されているとき
57 57
             preg_match('/^contents_file_(.*)$/', $property, $match) &&
58
-            array_key_exists($match[1] , $this->contentsFileSettings['fields'])
58
+            array_key_exists($match[1], $this->contentsFileSettings['fields'])
59 59
         ) {
60 60
             //何もセットされていないとき
61 61
             if (empty($this->_properties[$property])) {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                 if (!empty($fileInfo['tmp_name'])) {
119 119
                     $tmpFileName = Security::hash(rand() . Time::now()->i18nFormat('YYYY/MM/dd HH:ii:ss') . $fileInfo['name']);
120 120
 
121
-                    if ($this->getExt($fileInfo['name']) !== null ) {
121
+                    if ($this->getExt($fileInfo['name']) !== null) {
122 122
                         $tmpFileName .= '.' . $this->getExt($fileInfo['name']);
123 123
                     }
124 124
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function getExt($file)
148 148
     {
149
-        $fileExplode = explode('.',$file);
149
+        $fileExplode = explode('.', $file);
150 150
         //この場合拡張子なし
151 151
         if (count($fileExplode) == 1) {
152 152
             return null;
Please login to merge, or discard this patch.
src/Controller/ContentsFileController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,9 +90,9 @@
 block discarded – undo
90 90
 
91 91
         if (($pos = strrpos($filename, ".")) !== false) {
92 92
             // 拡張子がある場合
93
-            $ext = strtolower(substr($filename, $pos+1));
93
+            $ext = strtolower(substr($filename, $pos + 1));
94 94
             if (strlen($ext)) {
95
-                return $aContentTypes[$ext]?$aContentTypes[$ext]:$sContentType;
95
+                return $aContentTypes[$ext] ? $aContentTypes[$ext] : $sContentType;
96 96
             }
97 97
         }
98 98
         return $sContentType;
Please login to merge, or discard this patch.
src/View/Helper/ContentsFileHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 $fileInfo['resize'] = $options['resize'];
50 50
                 unset($options['resize']);
51 51
             }
52
-            return $this->Html->image($this->urlArray($fileInfo) ,$options);
52
+            return $this->Html->image($this->urlArray($fileInfo), $options);
53 53
         }
54 54
         return '';
55 55
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         if (!isset($fileInfo['resize'])) {
64 64
             $fileInfo['resize'] = false;
65 65
         }
66
-        return $this->Url->build($this->urlArray($fileInfo),$full);
66
+        return $this->Url->build($this->urlArray($fileInfo), $full);
67 67
     }
68 68
 
69 69
     /**
Please login to merge, or discard this patch.