(Update) Code Style 🚀

- php-cs-fixer
This commit is contained in:
HDVinnie
2019-09-17 18:48:44 -04:00
parent a6f21aa40e
commit f19899caab
42 changed files with 100 additions and 99 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ class UserFilled100Requests extends Achievement
public $description = 'DAMN BRO! You have already filled 100 requests!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 100;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserFilled25Requests extends Achievement
public $description = 'Congrats! You have already filled 25 requests!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 25;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserFilled50Requests extends Achievement
public $description = 'Wow! You have already filled 50 requests!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 50;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserFilled75Requests extends Achievement
public $description = 'Woot! You have already filled 75 requests!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 75;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade100Comments extends Achievement
public $description = 'Wow! You have already made 100 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 100;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade100Posts extends Achievement
public $description = 'Wow! You have already made 100 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 100;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade100Uploads extends Achievement
public $description = 'You have made 100 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 100;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade200Comments extends Achievement
public $description = 'Wow! You have already made 200 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 200;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade200Posts extends Achievement
public $description = 'Wow! You have already made 200 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 200;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade200Uploads extends Achievement
public $description = 'You have made 200 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 200;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade25Posts extends Achievement
public $description = 'Wow! You have already made 25 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 25;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade25Uploads extends Achievement
public $description = 'You have made 25 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 25;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade300Comments extends Achievement
public $description = 'Wow! You have already made 300 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 300;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade300Posts extends Achievement
public $description = 'Wow! You have already made 300 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 300;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade300Uploads extends Achievement
public $description = 'You have made 300 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 300;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade400Comments extends Achievement
public $description = 'Wow! You have already made 400 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 400;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade400Posts extends Achievement
public $description = 'Wow! You have already made 400 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 400;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade400Uploads extends Achievement
public $description = 'You have made 400 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 400;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade500Comments extends Achievement
public $description = 'Wow! You have already made 500 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 500;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade500Posts extends Achievement
public $description = 'Wow! You have already made 500 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 500;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade500Uploads extends Achievement
public $description = 'You have made 500 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 500;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade50Comments extends Achievement
public $description = 'Wow! You have already made 50 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 50;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade50Posts extends Achievement
public $description = 'Wow! You have already made 50 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 50;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade50Uploads extends Achievement
public $description = 'You have made 50 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 50;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade600Comments extends Achievement
public $description = 'Wow! You have already made 600 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 600;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade600Posts extends Achievement
public $description = 'Wow! You have already made 600 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 600;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade600Uploads extends Achievement
public $description = 'You have made 600 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 600;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade700Comments extends Achievement
public $description = 'Wow! You have already made 700 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 700;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade700Posts extends Achievement
public $description = 'Wow! You have already made 700 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 700;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade700Uploads extends Achievement
public $description = 'You have made 700 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 700;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade800Comments extends Achievement
public $description = 'Wow! You have already made 800 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 800;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade800Posts extends Achievement
public $description = 'Wow! You have already made 800 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 800;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade800Uploads extends Achievement
public $description = 'You have made 800 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 800;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade900Comments extends Achievement
public $description = 'DAMN BRO! You have made 900 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 900;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade900Posts extends Achievement
public $description = 'Wow! You have already made 900 posts!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 900;
}
+2 -2
View File
@@ -28,7 +28,7 @@ class UserMade900Uploads extends Achievement
public $description = 'DAMN BRO, you have made 900 torrent uploads!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 900;
}
+4 -4
View File
@@ -28,20 +28,20 @@ class UserMadeTenComments extends Achievement
public $description = 'Wow! You have already made 10 comments!';
/*
* The amount of "points" this user need to obtain in order to complete this achievement
*/
* The amount of "points" this user need to obtain in order to complete this achievement
*/
public $points = 10;
/*
* Triggers whenever an Achiever makes progress on this achievement
*/
*/
public function whenProgress($progress)
{
}
/*
* Triggers whenever an Achiever unlocks this achievement
*/
*/
public function whenUnlocked($progress)
{
}
@@ -17,7 +17,6 @@ use App\Models\Peer;
use App\Models\User;
use App\Models\Group;
use App\Models\Report;
use App\Models\Seedbox;
use App\Models\Torrent;
use App\Models\Application;
use Illuminate\Http\Request;
+22 -18
View File
@@ -36,11 +36,11 @@ class Http2ServerPush
*
* @return mixed
*/
public function handle(Request $request, Closure $next, $limit = null, $sizeLimit = null, $excludeKeywords=null)
public function handle(Request $request, Closure $next, $limit = null, $sizeLimit = null, $excludeKeywords = null)
{
$response = $next($request);
if ($response->isRedirection() || !$response instanceof Response || $request->isJson()) {
if ($response->isRedirection() || ! $response instanceof Response || $request->isJson()) {
return $response;
}
@@ -49,10 +49,12 @@ class Http2ServerPush
return $response;
}
public function getConfig($key, $default=false) {
if(!function_exists('config')) { // for tests..
public function getConfig($key, $default = false)
{
if (! function_exists('config')) { // for tests..
return $default;
}
return config('http2serverpush.'.$key, $default);
}
@@ -61,7 +63,7 @@ class Http2ServerPush
*
* @return $this
*/
protected function generateAndAttachLinkHeaders(Response $response, $limit = null, $sizeLimit = null, $excludeKeywords=null)
protected function generateAndAttachLinkHeaders(Response $response, $limit = null, $sizeLimit = null, $excludeKeywords = null)
{
$excludeKeywords ?? $this->getConfig('exclude_keywords', []);
$headers = $this->fetchLinkableNodes($response)
@@ -70,26 +72,29 @@ class Http2ServerPush
return $this->buildLinkHeaderString($url);
})
->unique()
->filter(function($value, $key) use ($excludeKeywords){
if(!$value) return false;
->filter(function ($value, $key) use ($excludeKeywords) {
if (! $value) {
return false;
}
$exclude_keywords = collect($excludeKeywords)->map(function ($keyword) {
return preg_quote($keyword);
});
if($exclude_keywords->count() <= 0) {
if ($exclude_keywords->count() <= 0) {
return true;
}
return !preg_match('%('.$exclude_keywords->implode('|').')%i', $value);
return ! preg_match('%('.$exclude_keywords->implode('|').')%i', $value);
})
->take($limit);
$sizeLimit = $sizeLimit ?? max(1, intval($this->getConfig('size_limit', 32*1024)));
$sizeLimit = $sizeLimit ?? max(1, intval($this->getConfig('size_limit', 32 * 1024)));
$headersText = trim($headers->implode(','));
while(strlen($headersText) > $sizeLimit) {
while (strlen($headersText) > $sizeLimit) {
$headers->pop();
$headersText = trim($headers->implode(','));
}
if (!empty($headersText)) {
if (! empty($headersText)) {
$this->addLinkHeader($response, $headersText);
}
@@ -144,17 +149,16 @@ class Http2ServerPush
return Str::contains(strtoupper($url), $extension);
});
if(!preg_match('%^https?://%i', $url)) {
if (! preg_match('%^https?://%i', $url)) {
$basePath = $this->getConfig('base_path', '/');
$url = $basePath . ltrim($url, $basePath);
$url = $basePath.ltrim($url, $basePath);
}
return is_null($type) ? null : "<{$url}>; rel=preload; as={$type}";
}
/**
* Add Link Header
* Add Link Header.
*
* @param \Illuminate\Http\Response $response
*
@@ -163,9 +167,9 @@ class Http2ServerPush
private function addLinkHeader(Response $response, $link)
{
if ($response->headers->get('Link')) {
$link = $response->headers->get('Link') . ',' . $link;
$link = $response->headers->get('Link').','.$link;
}
$response->header('Link', $link);
}
}
}
+2 -2
View File
@@ -22,5 +22,5 @@
return [
'size_limit' => '6000', // in bytes
'base_path' => '/',
'exclude_keywords' => []
];
'exclude_keywords' => [],
];
-1
View File
@@ -2,7 +2,6 @@
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
-1
View File
@@ -2,7 +2,6 @@
namespace Tests\Unit;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase