Passed
Push — master ( 2f8f71...bc7b5c )
by Georgi
02:52
created
src/FileStorageCore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	
46 46
 	public static function boot()
47 47
 	{
48
-		Route::group(['namespace' => 'Epesi\FileStorage'], function(){
48
+		Route::group(['namespace' => 'Epesi\FileStorage'], function() {
49 49
 			Route::get('file', 'FileStorageController@get')->middleware('web', FileStorageAccess::class);
50 50
 		});
51 51
 		
Please login to merge, or discard this patch.
src/Database/Models/FileContent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
     	
101 101
     	$path = self::getStoragePath($hash);
102 102
     	
103
-    	if (! self::storage()->exists($path)) {
103
+    	if (!self::storage()->exists($path)) {
104 104
     		self::storage()->put($path, $content);
105 105
     	}
106 106
     	
Please login to merge, or discard this patch.
src/Database/Models/File.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     	try {
106 106
     		$file = is_numeric($idOrMeta) ? self::get($idOrMeta) : $idOrMeta;
107 107
     		
108
-    		if (! file_exists($file->content->path)) {
108
+    		if (!file_exists($file->content->path)) {
109 109
     			throw new FileNotFound('Exception - file not found: ' . $file->content->path);
110 110
     		}
111 111
     	} catch (\Exception $exception) {
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
     	$ids = [];
132 132
     	foreach ((array) $files as $filePath) {
133
-    		if (! is_numeric($filePath)) {
133
+    		if (!is_numeric($filePath)) {
134 134
     			$ids[] = self::put($filePath);
135 135
     			
136 136
     			continue;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
     public static function put($fileOrPath, $content = null) 
164 164
     {
165 165
     	$file = $fileOrPath;
166
-    	if (! $content && is_string($fileOrPath)) {
166
+    	if (!$content && is_string($fileOrPath)) {
167 167
     		$content = file_get_contents($fileOrPath);
168 168
     		
169 169
     		$file = [
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     
197 197
     public function getThumbnailAttribute()
198 198
     {
199
-    	if (! $this->thumbnailPossible()) return false;
199
+    	if (!$this->thumbnailPossible()) return false;
200 200
     	
201 201
     	$image = new \Imagick($this->content->path . '[0]');
202 202
     	
Please login to merge, or discard this patch.
src/Database/Migrations/2019_11_16_091615_create_filestorage_tables.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     {
16 16
     	$this->down();
17 17
     	
18
-        Schema::create('filestorage_contents', function (Blueprint $table) {
18
+        Schema::create('filestorage_contents', function(Blueprint $table) {
19 19
             $table->bigIncrements('id');
20 20
             $table->string('hash', 128);
21 21
             $table->integer('size');
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
             $table->softDeletes();
25 25
         });
26 26
         
27
-        Schema::create('filestorage_files', function (Blueprint $table) {
27
+        Schema::create('filestorage_files', function(Blueprint $table) {
28 28
             $table->bigIncrements('id');
29 29
             $table->string('name', 256);
30 30
             $table->string('link', 128)->nullable();
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             $table->foreign('created_by')->references('id')->on('users');
40 40
         });
41 41
         
42
-        Schema::create('filestorage_remote_access', function (Blueprint $table) {
42
+        Schema::create('filestorage_remote_access', function(Blueprint $table) {
43 43
             $table->bigIncrements('id');
44 44
             $table->unsignedBigInteger('file_id');            
45 45
             $table->string('token', 128);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $table->foreign('created_by')->references('id')->on('users');
52 52
         });
53 53
         
54
-        Schema::create('filestorage_access_log', function (Blueprint $table) {
54
+        Schema::create('filestorage_access_log', function(Blueprint $table) {
55 55
             $table->bigIncrements('id');
56 56
             $table->unsignedBigInteger('file_id');            
57 57
             $table->timestamp('accessed_at');
Please login to merge, or discard this patch.
src/Integration/Joints/FileStorageAccessJoint.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
 	 */
50 50
 	final public static function getActionUrls($file, $accessParams = [])
51 51
 	{
52
-		$id = is_numeric($file)? $file: $file->id;
52
+		$id = is_numeric($file) ? $file : $file->id;
53 53
 		
54 54
 		$urls = [];
55 55
 		foreach (static::$allowedActions as $action) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	final protected function hasUserAccess()
68 68
 	{
69
-		return $this->forUsersOnly? (bool) Auth::id(): true;
69
+		return $this->forUsersOnly ? (bool) Auth::id() : true;
70 70
 	}
71 71
 	
72 72
 	/**
Please login to merge, or discard this patch.
src/Seeds/FileModal.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	
34 34
 	protected function setPeriodSelection()
35 35
 	{
36
-		if (! $this->periodSelection) {
36
+		if (!$this->periodSelection) {
37 37
 			$this->periodSelection = [];
38 38
 			foreach ([1, 2, 3, 4] as $count) {
39 39
 				$this->periodSelection[$count . ' weeks'] = trans_choice('{1} :count week |[2,*] :count weeks', $count);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		}
42 42
 
43 43
 		foreach ($this->periodSelection as $key => $period) {
44
-			$default = $key == $this->defaultPeriod? ' (' . __('Default') . ')': '';
44
+			$default = $key == $this->defaultPeriod ? ' (' . __('Default') . ')' : '';
45 45
 			
46 46
 			$this->periodSelection[$key] = $period . $default;
47 47
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	{
52 52
 		$this->canvas = $canvas;
53 53
 		
54
-		if (! $this->file()) {
54
+		if (!$this->file()) {
55 55
 			$canvas->set(__('Wrong parameters for file'));
56 56
 			return;
57 57
 		}
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	
72 72
 	protected function file()
73 73
 	{
74
-		return $this->file?: ($this->file = File::get($this->canvas->stickyGET('id')));
74
+		return $this->file ?: ($this->file = File::get($this->canvas->stickyGET('id')));
75 75
 	}
76 76
 	
77 77
 	protected function addFileDetails($container = null)
78 78
 	{
79
-		$container = $container?: $this->canvas;
79
+		$container = $container ?: $this->canvas;
80 80
 		
81 81
 		$container->add(['Lister', 'template'=> new \atk4\ui\Template('
82 82
 						<div class="item" style="margin: 0 15px 15px 0">
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 	
92 92
 	protected function addFileRemoteLinks($container = null) {
93
-		$container = $container?: $this->canvas;
93
+		$container = $container ?: $this->canvas;
94 94
 		
95 95
 		foreach ($this->file()->links()->where('created_by', Auth::id())->get() as $link) {
96 96
 			$container->add(['View', __('Remote access link expiring :expiry', ['expiry' => $link->expires_at])]);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		$container->js(true, new jsExpression('new ClipboardJS(".copy-button")'));
107 107
 		
108 108
 		$container->on('click', '.delete-link', $container->add(['jsCallback', 'postTrigger' => 'link'])->set(function($j, $linkId) {
109
-			if (! $link = FileRemoteAccess::find($linkId)) return;
109
+			if (!$link = FileRemoteAccess::find($linkId)) return;
110 110
 			
111 111
 			$link->delete();
112 112
 			
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$dropdown->setSource($this->periodSelection);
135 135
 		
136 136
 		$dropdown->onChange(function($value) {
137
-			$period = array_search($value, $this->periodSelection)?: $this->defaultPeriod;
137
+			$period = array_search($value, $this->periodSelection) ?: $this->defaultPeriod;
138 138
 			
139 139
 			FileRemoteAccess::grant($this->file(), $period);
140 140
 			
Please login to merge, or discard this patch.
src/Database/Models/FileRemoteAccess.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@
 block discarded – undo
19 19
     public static function grant($file, $expires = self::DEFAULT_PERIOD)
20 20
     {
21 21
 		return self::create([
22
-				'file_id' => is_numeric($file)? $file: $file->id,
22
+				'file_id' => is_numeric($file) ? $file : $file->id,
23 23
 				'token' => md5(uniqid(rand(), true)),
24
-				'created_by' => Auth::id()?: 0,
24
+				'created_by' => Auth::id() ?: 0,
25 25
 				'expires_at' => date('Y-m-d H:i:s', strtotime($expires)),
26 26
 		]);
27 27
     }
Please login to merge, or discard this patch.
src/FileStorageList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 		$grid->setModel($this->getModel());
34 34
 		
35 35
 		$grid->addDecorator('name', ['Multiformat', function($row, $column) {
36
-			return [['Template', '<a href="#" class="file-modal" data-id="' . $row['id'] . '">' . $row[$column]  . '</a>']];
36
+			return [['Template', '<a href="#" class="file-modal" data-id="' . $row['id'] . '">' . $row[$column] . '</a>']];
37 37
 		}]);
38 38
 		
39 39
 		$modal = $this->add(new FileModal());
Please login to merge, or discard this patch.