mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-04 09:20:21 -05:00
refactor: use identical over equal with same type
This commit is contained in:
@@ -178,7 +178,7 @@ class CasinoBot
|
||||
$z = 3;
|
||||
}
|
||||
|
||||
if ($message == '') {
|
||||
if ($message === '') {
|
||||
$log = '';
|
||||
} else {
|
||||
$log = 'All '.$this->bot->name.' commands must be a private message or begin with /'.$this->bot->command.' or !'.$this->bot->command.'. Need help? Type /'.$this->bot->command.' help and you shall be helped.';
|
||||
|
||||
@@ -406,7 +406,7 @@ class NerdBot
|
||||
$z = 3;
|
||||
}
|
||||
|
||||
if ($message == '') {
|
||||
if ($message === '') {
|
||||
$log = '';
|
||||
} else {
|
||||
$log = 'All '.$this->bot->name.' commands must be a private message or begin with /'.$this->bot->command.' or !'.$this->bot->command.'. Need help? Type /'.$this->bot->command.' help and you shall be helped.';
|
||||
|
||||
@@ -160,7 +160,7 @@ class SystemBot
|
||||
$y = $x + 1;
|
||||
$z = $y + 1;
|
||||
|
||||
if ($message == '') {
|
||||
if ($message === '') {
|
||||
$log = '';
|
||||
} else {
|
||||
$log = 'All '.$this->bot->name.' commands must be a private message or begin with /'.$this->bot->command.' or !'.$this->bot->command.'. Need help? Type /'.$this->bot->command.' help and you shall be helped.';
|
||||
|
||||
@@ -20,7 +20,7 @@ class Bencode
|
||||
public static function parse_integer($s, &$pos)
|
||||
{
|
||||
$len = strlen($s);
|
||||
if ($len == 0 || $s[$pos] != 'i') {
|
||||
if ($len === 0 || $s[$pos] != 'i') {
|
||||
return;
|
||||
}
|
||||
$pos++;
|
||||
|
||||
@@ -47,7 +47,7 @@ class MediaInfo
|
||||
foreach ($sections as $key => $section) {
|
||||
$key_section = strtolower(explode(' ', $key)[0]);
|
||||
if (!empty($section)) {
|
||||
if ($key_section == 'general') {
|
||||
if ($key_section === 'general') {
|
||||
$output[$key_section] = $this->parseProperty($section, $key_section);
|
||||
} else {
|
||||
$output[$key_section][] = $this->parseProperty($section, $key_section);
|
||||
@@ -412,7 +412,7 @@ class MediaInfo
|
||||
$temp_text_output[] = $text_element[$property];
|
||||
}
|
||||
}
|
||||
if (isset($text_element['forced']) && strtolower($text_element['forced']) == 'yes') {
|
||||
if (isset($text_element['forced']) && strtolower($text_element['forced']) === 'yes') {
|
||||
$temp_text_output[] = 'Forced';
|
||||
}
|
||||
|
||||
|
||||
@@ -106,12 +106,12 @@ class StringHelper
|
||||
$minutes++;
|
||||
$seconds -= 60;
|
||||
}
|
||||
$years = ($years == 0) ? '' : $years.trans('common.abbrev-years');
|
||||
$months = ($months == 0) ? '' : $months.trans('common.abbrev-months');
|
||||
$weeks = ($weeks == 0) ? '' : $weeks.trans('common.abbrev-weeks');
|
||||
$days = ($days == 0) ? '' : $days.trans('common.abbrev-days');
|
||||
$hours = ($hours == 0) ? '' : $hours.trans('common.abbrev-hours');
|
||||
$minutes = ($minutes == 0) ? '' : $minutes.trans('common.abbrev-minutes');
|
||||
$years = ($years === 0) ? '' : $years.trans('common.abbrev-years');
|
||||
$months = ($months === 0) ? '' : $months.trans('common.abbrev-months');
|
||||
$weeks = ($weeks === 0) ? '' : $weeks.trans('common.abbrev-weeks');
|
||||
$days = ($days === 0) ? '' : $days.trans('common.abbrev-days');
|
||||
$hours = ($hours === 0) ? '' : $hours.trans('common.abbrev-hours');
|
||||
$minutes = ($minutes === 0) ? '' : $minutes.trans('common.abbrev-minutes');
|
||||
$seconds = ($seconds == 0) ? '' : $seconds.trans('common.abbrev-seconds');
|
||||
|
||||
return $years.$months.$weeks.$days.$hours.$minutes.$seconds;
|
||||
@@ -160,12 +160,12 @@ class StringHelper
|
||||
$minutes++;
|
||||
$seconds -= 60;
|
||||
}
|
||||
$years = ($years == 0) ? '' : $years.trans('common.abbrev-years');
|
||||
$months = ($months == 0) ? '' : $months.trans('common.abbrev-months');
|
||||
$weeks = ($weeks == 0) ? '' : $weeks.trans('common.abbrev-weeks');
|
||||
$days = ($days == 0) ? '' : $days.trans('common.abbrev-days');
|
||||
$hours = ($hours == 0) ? '' : $hours.trans('common.abbrev-hours');
|
||||
$minutes = ($minutes == 0) ? '' : $minutes.trans('common.abbrev-minutes');
|
||||
$years = ($years === 0) ? '' : $years.trans('common.abbrev-years');
|
||||
$months = ($months === 0) ? '' : $months.trans('common.abbrev-months');
|
||||
$weeks = ($weeks === 0) ? '' : $weeks.trans('common.abbrev-weeks');
|
||||
$days = ($days === 0) ? '' : $days.trans('common.abbrev-days');
|
||||
$hours = ($hours === 0) ? '' : $hours.trans('common.abbrev-hours');
|
||||
$minutes = ($minutes === 0) ? '' : $minutes.trans('common.abbrev-minutes');
|
||||
$seconds = ($seconds == 0) ? '' : $seconds.trans('common.abbrev-seconds');
|
||||
|
||||
return $years.$months.$weeks.$days.$hours.$minutes.$seconds;
|
||||
|
||||
@@ -117,7 +117,7 @@ class TorrentTools
|
||||
$dir = '';
|
||||
$count = is_countable($file['path']) ? count($file['path']) : 0;
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if (($i + 1) == $count) {
|
||||
if ($i + 1 === $count) {
|
||||
$fname = $dir.$file['path'][$i];
|
||||
$files[$k]['name'] = $fname;
|
||||
} else {
|
||||
|
||||
@@ -169,7 +169,7 @@ class ChatController extends Controller
|
||||
$target = null;
|
||||
$runbot = null;
|
||||
$trip = 'msg';
|
||||
if ($message && substr($message, 0, 1 + (strlen($trip))) == '/'.$trip) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($trip))) === '/'.$trip) {
|
||||
$which = 'skip';
|
||||
$command = @explode(' ', $message);
|
||||
if (array_key_exists(1, $command)) {
|
||||
@@ -184,7 +184,7 @@ class ChatController extends Controller
|
||||
}
|
||||
|
||||
$trip = 'gift';
|
||||
if ($message && substr($message, 0, 1 + (strlen($trip))) == '/'.$trip) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($trip))) === '/'.$trip) {
|
||||
$which = 'echo';
|
||||
$target = 'system';
|
||||
$message = '/bot gift'.substr($message, strlen($trip) + 1, strlen($message));
|
||||
@@ -194,21 +194,21 @@ class ChatController extends Controller
|
||||
}
|
||||
if ($which == null) {
|
||||
foreach ($bots as $bot) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) == '/'.$bot->command) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '/'.$bot->command) {
|
||||
$which = 'echo';
|
||||
} elseif ($message && substr($message, 0, 1 + (strlen($bot->command))) == '!'.$bot->command) {
|
||||
} elseif ($message && substr($message, 0, 1 + (strlen($bot->command))) === '!'.$bot->command) {
|
||||
$which = 'public';
|
||||
} elseif ($message && substr($message, 0, 1 + (strlen($bot->command))) == '@'.$bot->command) {
|
||||
} elseif ($message && substr($message, 0, 1 + (strlen($bot->command))) === '@'.$bot->command) {
|
||||
$message = substr($message, 1 + strlen($bot->command), strlen($message));
|
||||
$which = 'private';
|
||||
} elseif ($message && $receiver_id == 1 && $bot->id == $bot_id) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) == '/'.$bot->command) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '/'.$bot->command) {
|
||||
$message = substr($message, 1 + strlen($bot->command), strlen($message));
|
||||
}
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) == '!'.$bot->command) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '!'.$bot->command) {
|
||||
$message = substr($message, 1 + strlen($bot->command), strlen($message));
|
||||
}
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) == '@'.$bot->command) {
|
||||
if ($message && substr($message, 0, 1 + (strlen($bot->command))) === '@'.$bot->command) {
|
||||
$message = substr($message, 1 + strlen($bot->command), strlen($message));
|
||||
}
|
||||
$which = 'message';
|
||||
@@ -349,7 +349,7 @@ class ChatController extends Controller
|
||||
$message->delete();
|
||||
}
|
||||
|
||||
if ($save && $echo != false) {
|
||||
if ($save && $echo !== false) {
|
||||
return new ChatMessageResource($message);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@ class TorrentController extends BaseController
|
||||
{
|
||||
$user = $request->user();
|
||||
$requestFile = $request->file('torrent');
|
||||
if ($request->hasFile('torrent') == false) {
|
||||
if ($request->hasFile('torrent') === false) {
|
||||
return $this->sendError('Validation Error.', 'You Must Provide A Torrent File For Upload!');
|
||||
}
|
||||
|
||||
if ($requestFile->getError() != 0 && $requestFile->getClientOriginalExtension() != 'torrent') {
|
||||
if ($requestFile->getError() !== 0 && $requestFile->getClientOriginalExtension() !== 'torrent') {
|
||||
return $this->sendError('Validation Error.', 'You Must Provide A Valid Torrent File For Upload!');
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class LanguageController extends Controller
|
||||
$session = $request->session();
|
||||
if (config('language.url')) {
|
||||
$previous_url = substr(str_replace(env('APP_URL'), '', $session->previousUrl()), 7);
|
||||
if (strlen($previous_url) == 3) {
|
||||
if (strlen($previous_url) === 3) {
|
||||
$previous_url = substr($previous_url, 3);
|
||||
} else {
|
||||
$previous_url = substr($previous_url, strrpos($previous_url, '/') + 1);
|
||||
|
||||
@@ -77,7 +77,7 @@ class PlaylistController extends Controller
|
||||
$playlist->description = $request->input('description');
|
||||
$playlist->cover_image = null;
|
||||
|
||||
if ($request->hasFile('cover_image') && $request->file('cover_image')->getError() == 0) {
|
||||
if ($request->hasFile('cover_image') && $request->file('cover_image')->getError() === 0) {
|
||||
$image = $request->file('cover_image');
|
||||
$filename = 'playlist-cover_'.uniqid().'.'.$image->getClientOriginalExtension();
|
||||
$path = public_path('/files/img/'.$filename);
|
||||
@@ -190,7 +190,7 @@ class PlaylistController extends Controller
|
||||
$playlist->description = $request->input('description');
|
||||
$playlist->cover_image = null;
|
||||
|
||||
if ($request->hasFile('cover_image') && $request->file('cover_image')->getError() == 0) {
|
||||
if ($request->hasFile('cover_image') && $request->file('cover_image')->getError() === 0) {
|
||||
$image = $request->file('cover_image');
|
||||
$filename = 'playlist-cover_'.uniqid().'.'.$image->getClientOriginalExtension();
|
||||
$path = public_path('/files/img/'.$filename);
|
||||
|
||||
@@ -48,7 +48,7 @@ class BackupController extends Controller
|
||||
// make an array of backup files, with their filesize and creation date
|
||||
foreach ($files as $k => $f) {
|
||||
// only take the zip files into account
|
||||
if (substr($f, -4) == '.zip' && $disk->exists($f)) {
|
||||
if (substr($f, -4) === '.zip' && $disk->exists($f)) {
|
||||
$data['backups'][] = [
|
||||
'file_path' => $f,
|
||||
'file_name' => str_replace('backups/', '', $f),
|
||||
|
||||
@@ -132,7 +132,7 @@ class UserController extends Controller
|
||||
|
||||
// Hard coded until group change.
|
||||
|
||||
if ($target >= $sender || ($sender == 0 && ($sendto == 6 || $sendto == 4 || $sendto == 10)) || ($sender == 1 && ($sendto == 4 || $sendto == 10))) {
|
||||
if ($target >= $sender || ($sender == 0 && ($sendto === 6 || $sendto === 4 || $sendto === 10)) || ($sender == 1 && ($sendto === 4 || $sendto === 10))) {
|
||||
return redirect()->route('users.show', ['username' => $user->username])
|
||||
->withErrors('You Are Not Authorized To Perform This Action!');
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class SubscriptionController extends Controller
|
||||
*/
|
||||
public function subscribeTopic(Request $request, string $route, Topic $topic)
|
||||
{
|
||||
if ($route == 'subscriptions') {
|
||||
if ($route === 'subscriptions') {
|
||||
$logger = 'forum_subscriptions';
|
||||
$params = [];
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class SubscriptionController extends Controller
|
||||
*/
|
||||
public function unsubscribeTopic(Request $request, string $route, Topic $topic)
|
||||
{
|
||||
if ($route == 'subscriptions') {
|
||||
if ($route === 'subscriptions') {
|
||||
$logger = 'forum_subscriptions';
|
||||
$params = [];
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class SubscriptionController extends Controller
|
||||
*/
|
||||
public function subscribeForum(Request $request, string $route, Forum $forum)
|
||||
{
|
||||
if ($route == 'subscriptions') {
|
||||
if ($route === 'subscriptions') {
|
||||
$logger = 'forum_subscriptions';
|
||||
$params = [];
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class SubscriptionController extends Controller
|
||||
*/
|
||||
public function unsubscribeForum(Request $request, string $route, Forum $forum)
|
||||
{
|
||||
if ($route == 'subscriptions') {
|
||||
if ($route === 'subscriptions') {
|
||||
$logger = 'forum_subscriptions';
|
||||
$params = [];
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ class TorrentController extends Controller
|
||||
$attributes = [];
|
||||
$links = null;
|
||||
if ($collection == 1) {
|
||||
if ($logger == null) {
|
||||
if ($logger === null) {
|
||||
$logger = 'torrent.results_groupings';
|
||||
}
|
||||
|
||||
@@ -1245,7 +1245,7 @@ class TorrentController extends Controller
|
||||
|
||||
$client = new \App\Services\MovieScrapper(config('api-keys.tmdb'), config('api-keys.tvdb'), config('api-keys.omdb'));
|
||||
$requestFile = $request->file('torrent');
|
||||
if ($request->hasFile('torrent') == false) {
|
||||
if ($request->hasFile('torrent') === false) {
|
||||
return view('torrent.upload', [
|
||||
'categories' => Category::all()->sortBy('position'),
|
||||
'types' => Type::all()->sortBy('position'),
|
||||
@@ -1253,7 +1253,7 @@ class TorrentController extends Controller
|
||||
->withErrors('You Must Provide A Torrent File For Upload!');
|
||||
}
|
||||
|
||||
if ($requestFile->getError() != 0 && $requestFile->getClientOriginalExtension() != 'torrent') {
|
||||
if ($requestFile->getError() !== 0 && $requestFile->getClientOriginalExtension() !== 'torrent') {
|
||||
return view('torrent.upload', [
|
||||
'categories' => Category::all()->sortBy('position'),
|
||||
'types' => Type::all()->sortBy('position'),
|
||||
|
||||
@@ -176,13 +176,13 @@ class UserController extends Controller
|
||||
|
||||
// Avatar
|
||||
$max_upload = config('image.max_upload_size');
|
||||
if ($request->hasFile('image') && $request->file('image')->getError() == 0) {
|
||||
if ($request->hasFile('image') && $request->file('image')->getError() === 0) {
|
||||
$image = $request->file('image');
|
||||
if (in_array($image->getClientOriginalExtension(), ['jpg', 'JPG', 'jpeg', 'bmp', 'png', 'PNG', 'tiff', 'gif']) && preg_match('#image/*#', $image->getMimeType())) {
|
||||
if ($max_upload >= $image->getSize()) {
|
||||
$filename = $user->username.'.'.$image->getClientOriginalExtension();
|
||||
$path = public_path('/files/img/'.$filename);
|
||||
if ($image->getClientOriginalExtension() != 'gif') {
|
||||
if ($image->getClientOriginalExtension() !== 'gif') {
|
||||
Image::make($image->getRealPath())->fit(150, 150)->encode('png', 100)->save($path);
|
||||
} else {
|
||||
$v = validator($request->all(), [
|
||||
|
||||
@@ -28,7 +28,7 @@ class Language
|
||||
**/
|
||||
public static function flag($code = 'default')
|
||||
{
|
||||
if ($code == 'default') {
|
||||
if ($code === 'default') {
|
||||
$code = app()->getLocale();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class Language
|
||||
**/
|
||||
public static function country($locale = 'default')
|
||||
{
|
||||
if ($locale == 'default') {
|
||||
if ($locale === 'default') {
|
||||
$locale = app()->getLocale();
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ class Language
|
||||
**/
|
||||
public static function getCode($name = 'default')
|
||||
{
|
||||
if ($name == 'default') {
|
||||
if ($name === 'default') {
|
||||
$name = self::getName();
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ class Language
|
||||
**/
|
||||
public static function getLongCode($short = 'default')
|
||||
{
|
||||
if ($short == 'default') {
|
||||
if ($short === 'default') {
|
||||
$short = app()->getLocale();
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ class Language
|
||||
**/
|
||||
public static function getShortCode($long = 'default')
|
||||
{
|
||||
if ($long == 'default') {
|
||||
if ($long === 'default') {
|
||||
$long = app()->getLocale();
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ class Language
|
||||
**/
|
||||
public static function getName($code = 'default')
|
||||
{
|
||||
if ($code == 'default') {
|
||||
if ($code === 'default') {
|
||||
$code = app()->getLocale();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ class Poll extends Model
|
||||
*/
|
||||
public function setTitleAttribute($title)
|
||||
{
|
||||
if (substr($title, -1) != '?') {
|
||||
if (substr($title, -1) !== '?') {
|
||||
return $this->attributes['title'] = $title.'?';
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -739,7 +739,7 @@ class User extends Authenticatable
|
||||
public function acceptsNotification(self $sender, self $target, $group = 'follower', $type = false)
|
||||
{
|
||||
$target_group = 'json_'.$group.'_groups';
|
||||
if ($sender->id == $target->id) {
|
||||
if ($sender->id === $target->id) {
|
||||
return false;
|
||||
}
|
||||
if ($sender->group->is_modo || $sender->group->is_admin) {
|
||||
@@ -856,7 +856,7 @@ class User extends Authenticatable
|
||||
*/
|
||||
public function isSubscribed(string $type, $topic_id)
|
||||
{
|
||||
if ($type == 'topic') {
|
||||
if ($type === 'topic') {
|
||||
return (bool) $this->subscriptions()->where('topic_id', '=', $topic_id)->first(['id']);
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ class User extends Authenticatable
|
||||
*/
|
||||
public function getRatio()
|
||||
{
|
||||
if ($this->downloaded == 0) {
|
||||
if ($this->downloaded === 0) {
|
||||
return INF;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class TmdbClient extends Client implements MovieTvInterface
|
||||
{
|
||||
$this->validateKeys($keys);
|
||||
|
||||
if ($type == 'movie' && isset($keys['imdb'])) {
|
||||
if ($type === 'movie' && isset($keys['imdb'])) {
|
||||
$url = $this->apiUrl.'find/'.$keys['imdb'].'?api_key='.$this->apiKey.'&external_source=imdb_id&language='.config('app.locale');
|
||||
$results = $this->toArray($this->request($url));
|
||||
if (isset($results['movie_results'][0]['id'])) {
|
||||
@@ -57,7 +57,7 @@ class TmdbClient extends Client implements MovieTvInterface
|
||||
return new Movie();
|
||||
}
|
||||
|
||||
if ($type == 'tv') {
|
||||
if ($type === 'tv') {
|
||||
$url = null;
|
||||
if (isset($keys['imdb'])) {
|
||||
$url = $this->apiUrl.'find/'.$keys['imdb'].'?api_key='.$this->apiKey.'&external_source=imdb_id';
|
||||
@@ -91,7 +91,7 @@ class TmdbClient extends Client implements MovieTvInterface
|
||||
$url = $this->apiUrl.$type.'/'.$id.'?append_to_response=recommendations,alternative_titles,credits,videos,images,keywords,external_ids&api_key='.$this->apiKey.'&language='.config('app.locale');
|
||||
$movie = $this->toArray($this->request($url));
|
||||
|
||||
if ($type == 'tv') {
|
||||
if ($type === 'tv') {
|
||||
return $this->formatTv($movie);
|
||||
}
|
||||
|
||||
@@ -288,11 +288,11 @@ class TmdbClient extends Client implements MovieTvInterface
|
||||
{
|
||||
$akas = [];
|
||||
|
||||
if (!empty($movie['original_title']) && strtolower($movie['original_title']) != strtolower($movie['title'])) {
|
||||
if (!empty($movie['original_title']) && strtolower($movie['original_title']) !== strtolower($movie['title'])) {
|
||||
$akas[] = $movie['original_title'];
|
||||
}
|
||||
|
||||
if (!empty($movie['original_name']) && strtolower($movie['original_name']) != strtolower($movie['name'])) {
|
||||
if (!empty($movie['original_name']) && strtolower($movie['original_name']) !== strtolower($movie['name'])) {
|
||||
$akas[] = $movie['original_name'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user