Passed
Branch master (3058e5)
by refat
06:27 queued 01:27
created
Core/System/Http/UploadeFile.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -6,122 +6,122 @@
 block discarded – undo
6 6
 
7 7
 class UploadeFile
8 8
 {
9
-  private $app;
9
+	private $app;
10 10
 
11
-  private $file = [];
11
+	private $file = [];
12 12
 
13
-  private $fileName;
13
+	private $fileName;
14 14
 
15
-  private $nameOnly;
15
+	private $nameOnly;
16 16
 
17
-  private $extension;
17
+	private $extension;
18 18
 
19
-  private $minetype;
19
+	private $minetype;
20 20
 
21
-  private $tempFile;
21
+	private $tempFile;
22 22
 
23
-  private $size;
23
+	private $size;
24 24
 
25
-  private $error;
25
+	private $error;
26 26
 
27
-  private const AllOW_EXTENSION = ['png', 'jpg', 'jpeg', 'gif', 'webp'];
27
+	private const AllOW_EXTENSION = ['png', 'jpg', 'jpeg', 'gif', 'webp'];
28 28
 
29
-  public function __construct(Application $app, $input)
30
-  {
31
-    $this->app = $app;
29
+	public function __construct(Application $app, $input)
30
+	{
31
+		$this->app = $app;
32 32
 
33
-    $this->getFileInfo($input);
34
-  }
33
+		$this->getFileInfo($input);
34
+	}
35 35
 
36
-  private function getFileInfo($input)
37
-  {
38
-    if (empty($_FILES[$input])) {
39
-      return;
40
-    }
36
+	private function getFileInfo($input)
37
+	{
38
+		if (empty($_FILES[$input])) {
39
+			return;
40
+		}
41 41
 
42
-    $file = $_FILES[$input];
42
+		$file = $_FILES[$input];
43 43
 
44
-    $this->error = $file['error'];
44
+		$this->error = $file['error'];
45 45
 
46
-    if ($this->error != UPLOAD_ERR_OK) {
47
-      return;
48
-    }
46
+		if ($this->error != UPLOAD_ERR_OK) {
47
+			return;
48
+		}
49 49
 
50
-    $this->file = $file;
50
+		$this->file = $file;
51 51
 
52
-    $this->fileName = $this->file['name'];
52
+		$this->fileName = $this->file['name'];
53 53
 
54
-    $this->minetype = $this->file['type'];
54
+		$this->minetype = $this->file['type'];
55 55
 
56
-    $this->size = $this->file['size'];
56
+		$this->size = $this->file['size'];
57 57
 
58
-    $this->tempFile = $this->file['tmp_name'];
58
+		$this->tempFile = $this->file['tmp_name'];
59 59
 
60
-    $fileInfo = pathinfo($this->fileName);
60
+		$fileInfo = pathinfo($this->fileName);
61 61
 
62
-    $this->nameOnly = $fileInfo['filename'];
62
+		$this->nameOnly = $fileInfo['filename'];
63 63
 
64
-    $this->extension = $fileInfo['extension'];
65
-  }
64
+		$this->extension = $fileInfo['extension'];
65
+	}
66 66
 
67
-  public function exists()
68
-  {
69
-    return !empty($this->file);
70
-  }
67
+	public function exists()
68
+	{
69
+		return !empty($this->file);
70
+	}
71 71
 
72
-  public function getFileName()
73
-  {
74
-    return $this->fileName;
75
-  }
72
+	public function getFileName()
73
+	{
74
+		return $this->fileName;
75
+	}
76 76
 
77
-  public function getNameOnly()
78
-  {
79
-    return $this->nameOnly;
80
-  }
77
+	public function getNameOnly()
78
+	{
79
+		return $this->nameOnly;
80
+	}
81 81
 
82
-  public function getExtension()
83
-  {
84
-    return $this->extension;
85
-  }
82
+	public function getExtension()
83
+	{
84
+		return $this->extension;
85
+	}
86 86
 
87
-  public function getMinetype()
88
-  {
89
-    return $this->minetype;
90
-  }
87
+	public function getMinetype()
88
+	{
89
+		return $this->minetype;
90
+	}
91 91
 
92
-  public function getSize()
93
-  {
94
-    return $this->size;
95
-  }
92
+	public function getSize()
93
+	{
94
+		return $this->size;
95
+	}
96 96
 
97
-  public function getTempFile()
98
-  {
99
-    return $this->tempFile;
100
-  }
97
+	public function getTempFile()
98
+	{
99
+		return $this->tempFile;
100
+	}
101 101
 
102
-  public function isImage()
103
-  {
104
-    return strpos($this->minetype, 'image/') === 0 && in_array($this->extension, self::AllOW_EXTENSION);
105
-  }
102
+	public function isImage()
103
+	{
104
+		return strpos($this->minetype, 'image/') === 0 && in_array($this->extension, self::AllOW_EXTENSION);
105
+	}
106 106
 
107
-  public function moveTo($target, $newName = null)
108
-  {
109
-    $newName = $newName ?: sha1(rand()) . sha1(rand());
107
+	public function moveTo($target, $newName = null)
108
+	{
109
+		$newName = $newName ?: sha1(rand()) . sha1(rand());
110 110
 
111
-    $newName .= '.' . $this->extension;
111
+		$newName .= '.' . $this->extension;
112 112
 
113
-    if (!is_dir($target)) {
113
+		if (!is_dir($target)) {
114 114
 
115
-      mkdir($target, 0777, true);
116
-    }
115
+			mkdir($target, 0777, true);
116
+		}
117 117
 
118
-    $filePath = $target . $newName;
118
+		$filePath = $target . $newName;
119 119
 
120
-    $filePath  = rtrim($filePath, '/');
121
-    $filePath  = ltrim($filePath, '/');
120
+		$filePath  = rtrim($filePath, '/');
121
+		$filePath  = ltrim($filePath, '/');
122 122
 
123
-    $uploade = move_uploaded_file($this->tempFile, $filePath);
123
+		$uploade = move_uploaded_file($this->tempFile, $filePath);
124 124
 
125
-    return $uploade;
126
-  }
125
+		return $uploade;
126
+	}
127 127
 }
128 128
\ No newline at end of file
Please login to merge, or discard this patch.