feat: add PHPCSFixer

This commit is contained in:
Phan An 2020-09-06 23:20:42 +02:00
parent 715c18ef14
commit 4b799e85a7
95 changed files with 700 additions and 418 deletions

2
.gitignore vendored
View file

@ -82,3 +82,5 @@ cypress/videos
coverage.xml
.phpunit.result.cache
log.json
.php_cs.cache

21
.php_cs.dist Normal file
View file

@ -0,0 +1,21 @@
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('storage')
->exclude('bootstrap/cache')
->in(__DIR__)
;
return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
'phpdoc_summary' => false,
])
->setFinder($finder)
;

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Deployment configuration
@ -12,7 +11,6 @@ return [
|
*/
'deployment' => [
'type' => 'git',
'repository' => '',
@ -20,6 +18,5 @@ return [
'branch' => 'gh-pages',
'message' => 'Site updated: '.strftime('%YYYY-%MM-%DD %HH:%mm:%ss'),
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Deployment configuration
@ -12,7 +11,6 @@ return [
|
*/
'deployment' => [
'type' => 'git',
'repository' => '',
@ -20,6 +18,5 @@ return [
'branch' => 'gh-pages',
'message' => 'Site updated: '.strftime('%YYYY-%MM-%DD %HH:%mm:%ss'),
],
];

View file

@ -13,7 +13,7 @@ class Application extends IlluminateApplication
/**
* Current Koel version. Must start with a v, and is synced with git tags/releases.
*
* @link https://github.com/phanan/koel/releases
* @see https://github.com/phanan/koel/releases
*/
public const KOEL_VERSION = 'v4.4.0';
@ -57,7 +57,7 @@ class Application extends IlluminateApplication
* If this installation of Koel has a CDN_URL configured, use it as the base.
* Otherwise, just use a full URL to the asset.
*
* @param string $name The additional resource name/path.
* @param string $name the additional resource name/path
*/
public function staticUrl(?string $name = null): string
{

View file

@ -87,7 +87,7 @@ class SyncCommand extends Command
* - "CLOSE_WRITE,CLOSE /var/www/media/new.mp3"
* - "MOVED_TO /var/www/media/new_dir"
*
* @link http://man7.org/linux/man-pages/man1/inotifywait.1.html
* @see http://man7.org/linux/man-pages/man1/inotifywait.1.html
*
* @throws Exception
*/
@ -104,15 +104,15 @@ class SyncCommand extends Command
$name = basename($path);
if ($result === FileSynchronizer::SYNC_RESULT_UNMODIFIED) {
$this->ignored++;
++$this->ignored;
} elseif ($result === FileSynchronizer::SYNC_RESULT_BAD_FILE) {
if ($this->option('verbose')) {
$this->error(PHP_EOL."'$name' is not a valid media file: ".$reason);
}
$this->invalid++;
++$this->invalid;
} else {
$this->synced++;
++$this->synced;
}
}

View file

@ -3,7 +3,7 @@
namespace App\Console\Commands\Traits;
/**
* @method void error($message, $verbosity = null)
* @method void error($message, $verbosity = null)
* @method mixed secret($message, $fallback = true)
*/
trait AskForPassword

View file

@ -22,11 +22,11 @@ class SmartPlaylistRuleParameterFactory
Rule::OPERATOR_BEGINS_WITH => [$model, 'LIKE', "{$value[0]}%"],
Rule::OPERATOR_ENDS_WITH => [$model, 'LIKE', "%{$value[0]}"],
Rule::OPERATOR_IS => [$model, '=', $value[0]],
Rule::OPERATOR_IS_NOT => [$model, '<>', $value[0]],
Rule::OPERATOR_IS_NOT => [$model, '<>', $value[0]],
Rule::OPERATOR_CONTAINS => [$model, 'LIKE', "%{$value[0]}%"],
Rule::OPERATOR_NOT_CONTAIN => [$model, 'NOT LIKE', "%{$value[0]}%"],
Rule::OPERATOR_IS_LESS_THAN => [$model, '<', $value[0]],
Rule::OPERATOR_IS_GREATER_THAN => [$model, '>', $value[0]],
Rule::OPERATOR_IS_GREATER_THAN => [$model, '>', $value[0]],
Rule::OPERATOR_IS_BETWEEN => [$model, $value],
Rule::OPERATOR_NOT_IN_LAST => static function () use ($model, $value): array {
return [$model, '<', (new Carbon())->subDay($value[0])];

View file

@ -2,26 +2,30 @@
namespace App\Helpers;
function album_cover_path(string $fileName): string {
return public_path(config('koel.album_cover_dir') . $fileName);
function album_cover_path(string $fileName): string
{
return public_path(config('koel.album_cover_dir').$fileName);
}
function album_cover_url(string $fileName): string {
return app()->staticUrl(config('koel.album_cover_dir') . $fileName);
function album_cover_url(string $fileName): string
{
return app()->staticUrl(config('koel.album_cover_dir').$fileName);
}
/**
* @see album_cover_url()
*/
function album_thumbnail_url(string $fileName): string {
function album_thumbnail_url(string $fileName): string
{
return album_cover_url($fileName);
}
function artist_image_path(string $fileName): string {
return public_path(config('koel.artist_image_dir') . $fileName);
function artist_image_path(string $fileName): string
{
return public_path(config('koel.artist_image_dir').$fileName);
}
function artist_image_url(string $fileName): string {
return app()->staticUrl(config('koel.artist_image_dir') . $fileName);
function artist_image_url(string $fileName): string
{
return app()->staticUrl(config('koel.artist_image_dir').$fileName);
}

View file

@ -25,7 +25,6 @@ class AlbumThumbnailController extends Controller
* Returns the full URL to the thumbnail or NULL if the album has no cover.
*
* @response ["thumbnailUrl", "https://localhost/public/img/covers/a146d01afb742b01f28ab8b556f9a75d_thumbnail.jpg"]
* @return JsonResponse
*/
public function get(Album $album): JsonResponse
{

View file

@ -28,8 +28,7 @@ class AuthController extends Controller
HashManager $hash,
TokenManager $tokenManager,
?Authenticatable $currentUser
)
{
) {
$this->userRepository = $userRepository;
$this->hash = $hash;
$this->currentUser = $currentUser;
@ -68,7 +67,7 @@ class AuthController extends Controller
}
return response()->json([
'token' => $this->tokenManager->createToken($user)->plainTextToken
'token' => $this->tokenManager->createToken($user)->plainTextToken,
]);
}

View file

@ -81,7 +81,7 @@ class DataController extends Controller
'useLastfm' => $this->lastfmService->used(),
'useYouTube' => $this->youTubeService->enabled(),
'useiTunes' => $this->iTunesService->used(),
'allowDownload' => config('koel.download.allow'),
'allowDownload' => config('koel.download.allow'),
'supportsTranscoding' => config('koel.streaming.ffmpeg_path')
&& is_executable(config('koel.streaming.ffmpeg_path')),
'cdnUrl' => app()->staticUrl(),

View file

@ -88,8 +88,6 @@ class LastfmController extends Controller
* @bodyParam key string required The Last.fm [session key](https://www.last.fm/api/show/auth.getSession).
* @response []
*
* @param LastfmSetSessionKeyRequest $request
*
* @return JsonResponse
*/
public function setSessionKey(LastfmSetSessionKeyRequest $request)

View file

@ -30,8 +30,7 @@ class PlaylistController extends Controller
PlaylistRepository $playlistRepository,
SmartPlaylistService $smartPlaylistService,
Authenticatable $currentUser
)
{
) {
$this->playlistRepository = $playlistRepository;
$this->smartPlaylistService = $smartPlaylistService;
$this->currentUser = $currentUser;

View file

@ -25,7 +25,7 @@ class ScrobbleController extends Controller
*
* Create a [Last.fm scrobble entry](https://www.last.fm/api/scrobbling) for a song.
*
* @param string $timestamp The UNIX timestamp when the song started playing.
* @param string $timestamp the UNIX timestamp when the song started playing
*
* @return JsonResponse
*/

View file

@ -45,11 +45,11 @@ class SongController extends Controller
*
* @queryParam jwt-token required The JWT token.
*
* @link https://github.com/phanan/koel/wiki#streaming-music
* @see https://github.com/phanan/koel/wiki#streaming-music
*
* @param null|bool $transcode Whether to force transcoding the song.
* @param bool|null $transcode Whether to force transcoding the song.
* If this is omitted, by default Koel will transcode FLAC.
* @param null|int $bitRate The target bit rate to transcode, defaults to OUTPUT_BIT_RATE.
* @param int|null $bitRate The target bit rate to transcode, defaults to OUTPUT_BIT_RATE.
* Only taken into account if $transcode is truthy.
*
* @return RedirectResponse|Redirector

View file

@ -13,7 +13,6 @@ use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
class Kernel extends HttpKernel
{

View file

@ -12,6 +12,5 @@ class EncryptCookies extends BaseEncrypter
* @var array
*/
protected $except = [
//
];
}

View file

@ -12,6 +12,5 @@ class VerifyCsrfToken extends BaseVerifier
* @var array
*/
protected $except = [
//
];
}

View file

@ -14,7 +14,7 @@ abstract class AbstractMediaImageUpdateRequest extends Request
public function rules(): array
{
return [
$this->getImageFieldName() => ['string', 'required', new ImageData()]
$this->getImageFieldName() => ['string', 'required', new ImageData()],
];
}

View file

@ -2,7 +2,7 @@
namespace App\Http\Requests\API;
/** @property-read string $cover */
/** @property string $cover */
class AlbumCoverUpdateRequest extends AbstractMediaImageUpdateRequest
{
protected function getImageFieldName(): string

View file

@ -2,7 +2,7 @@
namespace App\Http\Requests\API;
/** @property-read string $image */
/** @property string $image */
class ArtistImageUpdateRequest extends AbstractMediaImageUpdateRequest
{
protected function getImageFieldName(): string

View file

@ -3,7 +3,7 @@
namespace App\Http\Requests\API;
/**
* @property string $token Lastfm's access token
* @property string $token Lastfm's access token
* @property string $api_token Koel's current user's token
*/
class LastfmCallbackRequest extends Request

View file

@ -5,9 +5,9 @@ namespace App\Http\Requests\API\ObjectStorage\S3;
use App\Http\Requests\API\ObjectStorage\S3\Request as BaseRequest;
/**
* @property string $bucket
* @property string $bucket
* @property string[] $tags
* @property string $key
* @property string $key
*/
class PutSongRequest extends BaseRequest
{

View file

@ -4,7 +4,7 @@ namespace App\Http\Requests\API;
/**
* @property string[] $songs
* @property mixed[] $data
* @property mixed[] $data
*/
class SongUpdateRequest extends Request
{

View file

@ -5,7 +5,7 @@ namespace App\Http\Requests\API;
use App\Http\Requests\AbstractRequest;
use Illuminate\Http\UploadedFile;
/** @property-read UploadedFile $file */
/** @property UploadedFile $file */
class UploadRequest extends AbstractRequest
{
public function authorize(): bool
@ -19,7 +19,7 @@ class UploadRequest extends AbstractRequest
'file' => [
'required',
'file',
'mimetypes:audio/mpeg,audio/ogg,audio/x-flac,audio/x-aac'
'mimetypes:audio/mpeg,audio/ogg,audio/x-flac,audio/x-aac',
],
];
}

View file

@ -3,10 +3,10 @@
namespace App\Http\Requests\API;
/**
* @property-read string $password
* @property-read string $name
* @property-read string $email
* @property-read bool $is_admin
* @property string $password
* @property string $name
* @property string $email
* @property bool $is_admin
*/
class UserStoreRequest extends Request
{
@ -21,7 +21,7 @@ class UserStoreRequest extends Request
'name' => 'required',
'email' => 'required|email|unique:users',
'password' => 'required',
'is_admin' => 'required'
'is_admin' => 'required',
];
}
}

View file

@ -5,10 +5,10 @@ namespace App\Http\Requests\API;
use App\Models\User;
/**
* @property-read string $password
* @property-read string $name
* @property-read string $email
* @property-read bool $is_admin
* @property string $password
* @property string $name
* @property string $email
* @property bool $is_admin
*/
class UserUpdateRequest extends Request
{
@ -24,7 +24,7 @@ class UserUpdateRequest extends Request
return [
'name' => 'required',
'email' => 'required|email|unique:users,email,' . $user->id,
'email' => 'required|email|unique:users,email,'.$user->id,
];
}
}

View file

@ -6,14 +6,17 @@ use App\Models\Interaction;
use App\Models\User;
use App\Services\LastfmService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class LoveTrackOnLastfmJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private $user;
private $interaction;

View file

@ -7,14 +7,17 @@ use App\Models\Song;
use App\Models\User;
use App\Services\LastfmService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ScrobbleJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private $user;
private $song;

View file

@ -7,14 +7,17 @@ use App\Models\Song;
use App\Models\User;
use App\Services\LastfmService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class UpdateLastfmNowPlayingJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
private $user;
private $song;

View file

@ -6,8 +6,6 @@ class InotifyWatchRecord extends WatchRecord implements WatchRecordInterface
{
/**
* {@inheritdoc}
*
* @param string $input
*/
public function __construct(string $input)
{

View file

@ -2,30 +2,29 @@
namespace App\Models;
use function App\Helpers\album_cover_path;
use function App\Helpers\album_cover_url;
use App\Traits\SupportsDeleteWhereIDsNotIn;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use function App\Helpers\album_cover_path;
use function App\Helpers\album_cover_url;
/**
* @property string $cover The album cover's file name
* @property string|null $cover_path The absolute path to the cover file
* @property bool $has_cover If the album has a non-default cover image
* @property string $cover The album cover's file name
* @property string|null $cover_path The absolute path to the cover file
* @property bool $has_cover If the album has a non-default cover image
* @property int $id
* @property string $name Name of the album
* @property bool $is_compilation If the album is a compilation from multiple artists
* @property Artist $artist The album's artist
* @property string $name Name of the album
* @property bool $is_compilation If the album is a compilation from multiple artists
* @property Artist $artist The album's artist
* @property int $artist_id
* @property Collection $songs
* @property bool $is_unknown If the album is the Unknown Album
* @property string|null $thumbnail_name The file name of the album's thumbnail
* @property string|null $thumbnail_path The full path to the thumbnail. Notice that this doesn't guarantee the thumbnail exists.
* @property string|null $thumbnail The public URL to the album's thumbnail
*
* @property bool $is_unknown If the album is the Unknown Album
* @property string|null $thumbnail_name The file name of the album's thumbnail
* @property string|null $thumbnail_path The full path to the thumbnail. Notice that this doesn't guarantee the thumbnail exists.
* @property string|null $thumbnail The public URL to the album's thumbnail
*
* @method static self firstOrCreate(array $where, array $params = [])
* @method static self|null find(int $id)

View file

@ -3,14 +3,14 @@
namespace App\Models;
use App\Facades\Util;
use function App\Helpers\artist_image_path;
use function App\Helpers\artist_image_url;
use App\Traits\SupportsDeleteWhereIDsNotIn;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use function App\Helpers\artist_image_path;
use function App\Helpers\artist_image_url;
/**
* @property int $id

View file

@ -7,11 +7,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property bool $liked
* @property int $play_count
* @property Song $song
* @property User $user
* @property int $id
* @property bool $liked
* @property int $play_count
* @property Song $song
* @property User $user
* @property int $id
*
* @method self firstOrCreate(array $where, array $params = [])
*/

View file

@ -16,6 +16,7 @@ use Illuminate\Support\Collection;
* @property bool $is_smart
* @property string $name
* @property user $user
*
* @method static \Illuminate\Database\Eloquent\Collection orderBy(string $field, string $order = 'asc')
*/
class Playlist extends Model

View file

@ -89,13 +89,7 @@ class Rule
private function validateOperator(string $operator): void
{
if (!in_array($operator, self::VALID_OPERATORS, true)) {
throw new InvalidArgumentException(
sprintf(
'%s is not a valid value for operators. Valid values are: %s',
$operator,
implode(', ', self::VALID_OPERATORS)
)
);
throw new InvalidArgumentException(sprintf('%s is not a valid value for operators. Valid values are: %s', $operator, implode(', ', self::VALID_OPERATORS)));
}
}
}

View file

@ -22,8 +22,6 @@ class Setting extends Model
/**
* Get a setting value.
*
* @param string $key
*
* @return mixed|string
*/
public static function get(string $key)
@ -38,8 +36,8 @@ class Setting extends Model
/**
* Set a setting (no pun) value.
*
* @param string|array $key The key of the setting, or an associative array of settings,
* in which case $value will be discarded.
* @param string|array $key the key of the setting, or an associative array of settings,
* in which case $value will be discarded
* @param mixed $value
*/
public static function set($key, $value = null): void

View file

@ -13,19 +13,19 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Collection;
/**
* @property string $path
* @property string $title
* @property Album $album
* @property Artist $artist
* @property string $path
* @property string $title
* @property Album $album
* @property Artist $artist
* @property string[] $s3_params
* @property float $length
* @property string $lyrics
* @property int $track
* @property int $disc
* @property int $album_id
* @property string $id
* @property int $artist_id
* @property int $mtime
* @property float $length
* @property string $lyrics
* @property int $track
* @property int $disc
* @property int $album_id
* @property string $id
* @property int $artist_id
* @property int $mtime
*
* @method static self updateOrCreate(array $where, array $params)
* @method static Builder select(string $string)
@ -93,13 +93,13 @@ class Song extends Model
* Update song info.
*
* @param string[] $ids
* @param string[] $data The data array, with these supported fields:
* @param string[] $data the data array, with these supported fields:
* - title
* - artistName
* - albumName
* - lyrics
* All of these are optional, in which case the info will not be changed
* (except for lyrics, which will be emptied).
* (except for lyrics, which will be emptied)
*/
public static function updateInfo(array $ids, array $data): Collection
{

View file

@ -92,7 +92,7 @@ class SongZipArchive
$name = basename($path);
if (array_key_exists($name, $this->fileNames)) {
$this->fileNames[$name]++;
++$this->fileNames[$name];
$parts = explode('.', $name);
$ext = $parts[count($parts) - 1];
$parts[count($parts) - 1] = $this->fileNames[$name].".$ext";

View file

@ -26,7 +26,5 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->registerPolicies();
//
}
}

View file

@ -35,7 +35,6 @@ class RouteServiceProvider extends ServiceProvider
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**

View file

@ -81,7 +81,7 @@ abstract class AbstractApiClient
*
* @throws InvalidArgumentException
*
* @return mixed|null|SimpleXMLElement
* @return mixed|SimpleXMLElement|null
*/
public function __call(string $method, array $args)
{
@ -99,7 +99,7 @@ abstract class AbstractApiClient
/**
* Turn a URI segment into a full API URL.
*
* @param bool $appendKey Whether to automatically append the API key into the URL.
* @param bool $appendKey whether to automatically append the API key into the URL
*/
public function buildUrl(string $uri, bool $appendKey = true): string
{

View file

@ -314,7 +314,7 @@ class FileSynchronizer
'comments.track_number',
];
for ($i = 0; $i < count($trackIndices) && $track === 0; $i++) {
for ($i = 0; $i < count($trackIndices) && $track === 0; ++$i) {
$track = (int) array_get($info, $trackIndices[$i], [0])[0];
}

View file

@ -30,7 +30,7 @@ class InteractionService
$interaction->liked = false;
}
$interaction->play_count++;
++$interaction->play_count;
$interaction->save();
});
}
@ -38,7 +38,7 @@ class InteractionService
/**
* Like or unlike a song on behalf of a user.
*
* @return Interaction The affected Interaction object.
* @return Interaction the affected Interaction object
*/
public function toggleLike(string $songId, User $user): Interaction
{
@ -58,7 +58,7 @@ class InteractionService
*
* @param string[] $songIds
*
* @return Interaction[] The array of Interaction objects.
* @return Interaction[] the array of Interaction objects
*/
public function batchLike(array $songIds, User $user): array
{

View file

@ -145,7 +145,7 @@ class LastfmService extends AbstractApiClient implements ApiConsumerInterface
*
* @param string $token The token after successfully connecting to Last.fm
*
* @link http://www.last.fm/api/webauth#4
* @see http://www.last.fm/api/webauth#4
*/
public function getSessionKey(string $token): ?string
{
@ -240,9 +240,9 @@ class LastfmService extends AbstractApiClient implements ApiConsumerInterface
* - The API key (api_key)
* - The API signature (api_sig).
*
* @link http://www.last.fm/api/webauth#5
* @see http://www.last.fm/api/webauth#5
*
* @param array $params The array of parameters.
* @param array $params the array of parameters
* @param bool $toString Whether to turn the array into a query string
*
* @return array|string

View file

@ -19,7 +19,7 @@ class MediaInformationService
/**
* Get extra information about an album from Last.fm.
*
* @return array|null The album info in an array format, or null on failure.
* @return array|null the album info in an array format, or null on failure
*/
public function getAlbumInformation(Album $album): ?array
{
@ -43,7 +43,7 @@ class MediaInformationService
/**
* Get extra information about an artist from Last.fm.
*
* @return array|null The artist info in an array format, or null on failure.
* @return array|null the artist info in an array format, or null on failure
*/
public function getArtistInformation(Artist $artist): ?array
{

View file

@ -2,12 +2,12 @@
namespace App\Services;
use function App\Helpers\album_cover_path;
use function App\Helpers\artist_image_path;
use App\Models\Album;
use App\Models\Artist;
use Exception;
use Psr\Log\LoggerInterface;
use function App\Helpers\album_cover_path;
use function App\Helpers\artist_image_path;
class MediaMetadataService
{
@ -40,8 +40,7 @@ class MediaMetadataService
string $extension,
string $destination = '',
bool $cleanUp = true
): void
{
): void {
try {
$extension = trim(strtolower($extension), '. ');
$destination = $destination ?: $this->generateAlbumCoverPath($extension);

View file

@ -85,7 +85,7 @@ class MediaSyncService
* Only taken into account for existing records.
* New records will have all tags synced in regardless.
* @param bool $force Whether to force syncing even unchanged files
* @param SyncCommand $syncCommand The SyncMedia command object, to log to console if executed by artisan.
* @param SyncCommand $syncCommand the SyncMedia command object, to log to console if executed by artisan
*
* @throws Exception
*/

View file

@ -28,7 +28,7 @@ class UploadService
$targetFileName = $this->getTargetFileName($file);
$file->move($this->getUploadDirectory(), $targetFileName);
$targetPathName = $this->getUploadDirectory() . $targetFileName;
$targetPathName = $this->getUploadDirectory().$targetFileName;
$this->fileSynchronizer->setFile($targetPathName);
$result = $this->fileSynchronizer->sync(MediaSyncService::APPLICABLE_TAGS);
@ -54,7 +54,7 @@ class UploadService
throw new MediaPathNotSetException();
}
$uploadDirectory = $mediaPath . DIRECTORY_SEPARATOR . self::UPLOAD_DIRECTORY . DIRECTORY_SEPARATOR;
$uploadDirectory = $mediaPath.DIRECTORY_SEPARATOR.self::UPLOAD_DIRECTORY.DIRECTORY_SEPARATOR;
}
return $uploadDirectory;
@ -68,11 +68,11 @@ class UploadService
// If there's no existing file with the same name in the upload directory, use the original name.
// Otherwise, prefix the original name with a hash.
// The whole point is to keep a readable file name when we can.
if (!file_exists($this->getUploadDirectory() . $file->getClientOriginalName())) {
if (!file_exists($this->getUploadDirectory().$file->getClientOriginalName())) {
return $file->getClientOriginalName();
}
return $this->getUniqueHash() . '_' . $file->getClientOriginalName();
return $this->getUniqueHash().'_'.$file->getClientOriginalName();
}
private function getUniqueHash(): string

View file

@ -20,8 +20,8 @@ trait SupportsDeleteWhereIDsNotIn
/**
* Deletes all records whose IDs are not in an array.
*
* @param string[]|int[] $ids The array of IDs.
* @param string $key Name of the primary key.
* @param string[]|int[] $ids the array of IDs
* @param string $key name of the primary key
*
* @throws Exception
*/

View file

@ -37,7 +37,8 @@
"laravel/browser-kit-testing": "^6.0",
"mikey179/vfsstream": "^1.6",
"php-mock/php-mock-mockery": "^1.3",
"mpociot/laravel-apidoc-generator": "^4.1"
"mpociot/laravel-apidoc-generator": "^4.1",
"friendsofphp/php-cs-fixer": "^2.16"
},
"suggest": {
"ext-zip": "Allow downloading multiple songs as Zip archives"
@ -84,7 +85,8 @@
"test": "phpunit --colors=always --order-by=defects",
"coverage": "phpunit --colors=always --coverage-clover=coverage.xml",
"analyze": "phpstan analyse app --level=5",
"gen-api-docs": "@php artisan apidoc:generate"
"gen-api-docs": "@php artisan apidoc:generate",
"cs:fix": "php-cs-fixer fix --config .php_cs.dist --allow-risky=yes"
},
"config": {
"preferred-install": "dist",

354
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7adfb74c8048cbbdd4859557d8b8dacb",
"content-hash": "ed3b206b517c10e1b64a5beea11556d6",
"packages": [
{
"name": "aws/aws-sdk-php",
@ -5736,6 +5736,76 @@
"description": "implementation of xdg base directory specification for php",
"time": "2019-12-04T15:06:13+00:00"
},
{
"name": "doctrine/annotations",
"version": "1.10.4",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "bfe91e31984e2ba76df1c1339681770401ec262f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/bfe91e31984e2ba76df1c1339681770401ec262f",
"reference": "bfe91e31984e2ba76df1c1339681770401ec262f",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"ext-tokenizer": "*",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/cache": "1.*",
"phpstan/phpstan": "^0.12.20",
"phpunit/phpunit": "^7.5 || ^9.1.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
],
"time": "2020-08-10T19:35:50+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.3.1",
@ -6028,6 +6098,103 @@
],
"time": "2020-06-14T09:00:00+00:00"
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v2.16.4",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "1023c3458137ab052f6ff1e09621a721bfdeca13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/1023c3458137ab052f6ff1e09621a721bfdeca13",
"reference": "1023c3458137ab052f6ff1e09621a721bfdeca13",
"shasum": ""
},
"require": {
"composer/semver": "^1.4",
"composer/xdebug-handler": "^1.2",
"doctrine/annotations": "^1.2",
"ext-json": "*",
"ext-tokenizer": "*",
"php": "^5.6 || ^7.0",
"php-cs-fixer/diff": "^1.3",
"symfony/console": "^3.4.17 || ^4.1.6 || ^5.0",
"symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0",
"symfony/filesystem": "^3.0 || ^4.0 || ^5.0",
"symfony/finder": "^3.0 || ^4.0 || ^5.0",
"symfony/options-resolver": "^3.0 || ^4.0 || ^5.0",
"symfony/polyfill-php70": "^1.0",
"symfony/polyfill-php72": "^1.4",
"symfony/process": "^3.0 || ^4.0 || ^5.0",
"symfony/stopwatch": "^3.0 || ^4.0 || ^5.0"
},
"require-dev": {
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0",
"justinrainbow/json-schema": "^5.0",
"keradus/cli-executor": "^1.2",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.1",
"php-cs-fixer/accessible-object": "^1.0",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1",
"phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1",
"phpunitgoodpractices/traits": "^1.8",
"symfony/phpunit-bridge": "^5.1",
"symfony/yaml": "^3.0 || ^4.0 || ^5.0"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
"ext-mbstring": "For handling non-UTF8 characters.",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.",
"symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible."
},
"bin": [
"php-cs-fixer"
],
"type": "application",
"autoload": {
"psr-4": {
"PhpCsFixer\\": "src/"
},
"classmap": [
"tests/Test/AbstractFixerTestCase.php",
"tests/Test/AbstractIntegrationCaseFactory.php",
"tests/Test/AbstractIntegrationTestCase.php",
"tests/Test/Assert/AssertTokensTrait.php",
"tests/Test/IntegrationCase.php",
"tests/Test/IntegrationCaseFactory.php",
"tests/Test/IntegrationCaseFactoryInterface.php",
"tests/Test/InternalIntegrationCaseFactory.php",
"tests/Test/IsIdenticalConstraint.php",
"tests/TestCase.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
}
],
"description": "A tool to automatically fix PHP code style",
"funding": [
{
"url": "https://github.com/keradus",
"type": "github"
}
],
"time": "2020-06-27T23:57:46+00:00"
},
{
"name": "fzaninotto/faker",
"version": "v1.9.1",
@ -6975,6 +7142,57 @@
"description": "Library for handling version information and constraints",
"time": "2018-07-08T19:19:57+00:00"
},
{
"name": "php-cs-fixer/diff",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/diff.git",
"reference": "78bb099e9c16361126c86ce82ec4405ebab8e756"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756",
"reference": "78bb099e9c16361126c86ce82ec4405ebab8e756",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.23 || ^6.4.3",
"symfony/process": "^3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "SpacePossum"
}
],
"description": "sebastian/diff v2 backport support for PHP5.6",
"homepage": "https://github.com/PHP-CS-Fixer",
"keywords": [
"diff"
],
"time": "2018-02-15T16:58:55+00:00"
},
{
"name": "php-di/invoker",
"version": "2.1.0",
@ -8675,6 +8893,140 @@
],
"time": "2020-08-21T17:19:47+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "9ff59517938f88d90b6e65311fef08faa640f681"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/9ff59517938f88d90b6e65311fef08faa640f681",
"reference": "9ff59517938f88d90b6e65311fef08faa640f681",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-php80": "^1.15"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony OptionsResolver Component",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-12T12:58:00+00:00"
},
{
"name": "symfony/stopwatch",
"version": "v5.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "0f7c58cf81dbb5dd67d423a89d577524a2ec0323"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/0f7c58cf81dbb5dd67d423a89d577524a2ec0323",
"reference": "0f7c58cf81dbb5dd67d423a89d577524a2ec0323",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/service-contracts": "^1.0|^2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Stopwatch\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-05-20T17:43:50+00:00"
},
{
"name": "symfony/var-exporter",
"version": "v5.1.5",

View file

@ -37,7 +37,6 @@ return [
* A route must fulfill ALL conditions to pass.
*/
'match' => [
/*
* Match only routes whose domains match this pattern (use * as a wildcard to match any characters).
*/

View file

@ -98,7 +98,6 @@ return [
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
@ -157,7 +156,6 @@ return [
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
@ -197,7 +195,5 @@ return [
'Download' => App\Facades\Download::class,
'AWS' => Aws\Laravel\AwsFacade::class,
'iTunes' => App\Facades\iTunes::class,
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
@ -94,5 +93,4 @@ return [
'expire' => 60,
],
],
];

View file

@ -3,7 +3,6 @@
use Aws\Laravel\AwsServiceProvider;
return [
/*
|--------------------------------------------------------------------------
| AWS SDK Configuration
@ -17,7 +16,7 @@ return [
|
*/
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
],

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
@ -27,7 +26,6 @@ return [
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
@ -46,7 +44,5 @@ return [
'log' => [
'driver' => 'log',
],
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
@ -27,7 +26,6 @@ return [
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
@ -38,17 +36,17 @@ return [
'database' => [
'driver' => 'database',
'table' => 'cache',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'driver' => 'memcached',
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
@ -60,7 +58,6 @@ return [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
@ -75,5 +72,4 @@ return [
*/
'prefix' => 'laravel',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Additional Compiled Classes
@ -14,7 +13,6 @@ return [
*/
'files' => [
//
],
/*
@ -29,7 +27,5 @@ return [
*/
'providers' => [
//
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
@ -32,61 +31,59 @@ return [
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
'prefix' => '',
],
'sqlite-e2e' => [
'driver' => 'sqlite',
'driver' => 'sqlite',
'database' => env('DB_DATABASE', __DIR__.'/../database/e2e.sqlite'),
'prefix' => '',
'prefix' => '',
],
'sqlite-persistent' => [
'driver' => 'sqlite',
'driver' => 'sqlite',
'database' => env('DB_DATABASE', __DIR__.'/../database/koel.sqlite'),
'prefix' => '',
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'prefix' => '',
'strict' => false,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 5432),
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 5432),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 1433),
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 1433),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'charset' => 'utf8',
'prefix' => '',
],
],
/*
@ -114,7 +111,6 @@ return [
*/
'redis' => [
'client' => 'predis',
'options' => [
@ -131,7 +127,5 @@ return [
],
],
],
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|----------------------------------------------------------------------
| Auto backup mode
@ -23,5 +22,4 @@ return [
*/
'backupPath' => base_path('storage/dotenv-editor/backups/'),
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
@ -42,15 +41,14 @@ return [
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'root' => storage_path('app'),
],
'ftp' => [
'driver' => 'ftp',
'host' => 'ftp.example.com',
'driver' => 'ftp',
'host' => 'ftp.example.com',
'username' => 'your-username',
'password' => 'your-password',
@ -71,15 +69,13 @@ return [
],
'rackspace' => [
'driver' => 'rackspace',
'username' => 'your-username',
'key' => 'your-key',
'driver' => 'rackspace',
'username' => 'your-username',
'key' => 'your-key',
'container' => 'your-container',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD',
'url_type' => 'publicURL',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD',
'url_type' => 'publicURL',
],
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Filename & Format
@ -11,8 +10,8 @@ return [
|
*/
'filename' => '_ide_helper',
'format' => 'php',
'filename' => '_ide_helper',
'format' => 'php',
/*
|--------------------------------------------------------------------------
@ -60,13 +59,13 @@ return [
'magic' => [
'Log' => [
'debug' => 'Monolog\Logger::addDebug',
'info' => 'Monolog\Logger::addInfo',
'notice' => 'Monolog\Logger::addNotice',
'warning' => 'Monolog\Logger::addWarning',
'error' => 'Monolog\Logger::addError',
'critical' => 'Monolog\Logger::addCritical',
'alert' => 'Monolog\Logger::addAlert',
'debug' => 'Monolog\Logger::addDebug',
'info' => 'Monolog\Logger::addInfo',
'notice' => 'Monolog\Logger::addNotice',
'warning' => 'Monolog\Logger::addWarning',
'error' => 'Monolog\Logger::addError',
'critical' => 'Monolog\Logger::addCritical',
'alert' => 'Monolog\Logger::addAlert',
'emergency' => 'Monolog\Logger::addEmergency',
],
],
@ -82,7 +81,6 @@ return [
*/
'interfaces' => [
],
/*
@ -112,7 +110,5 @@ return [
|
*/
'custom_db_types' => [
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
@ -16,5 +15,4 @@ return [
*/
'driver' => extension_loaded('imagick') ? 'imagick' : 'gd',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Admin Credentials
@ -139,5 +138,4 @@ return [
'sponsor_open_collective_url' => 'https://opencollective.com/koel',
'demo' => env('KOEL_DEMO', false),
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
@ -30,41 +29,39 @@ return [
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'table' => 'jobs',
'queue' => 'default',
'expire' => 60,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
'host' => 'localhost',
'queue' => 'default',
'ttr' => 60,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('SQS_PUBLIC_KEY'),
'key' => env('SQS_PUBLIC_KEY'),
'secret' => env('SQS_SECRET_KEY'),
'prefix' => env('SQS_QUEUE_PREFIX'),
'queue' => env('SQL_QUEUE_NAME'),
'queue' => env('SQL_QUEUE_NAME'),
'region' => env('SQS_QUEUE_REGION'),
],
'redis' => [
'driver' => 'redis',
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'expire' => 60,
'queue' => 'default',
'expire' => 60,
],
],
/*
@ -80,7 +77,6 @@ return [
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
'table' => 'failed_jobs',
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
@ -41,5 +40,4 @@ return [
'middleware' => [
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
@ -24,15 +23,14 @@ return [
],
'ses' => [
'key' => env('SES_KEY'),
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'stripe' => [
'model' => App\Models\User::class,
'key' => env('STRIPE_KEY'),
'model' => App\Models\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
@ -149,5 +148,4 @@ return [
*/
'secure' => false,
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
@ -29,5 +28,4 @@ return [
*/
'compiled' => realpath(storage_path('framework/views')),
];

View file

@ -11,7 +11,7 @@ use Faker\Generator as Faker;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Support\Facades\Hash;
/** @var Factory $factory */
/* @var Factory $factory */
$factory->define(User::class, function ($faker) {
return [
'name' => $faker->name,

View file

@ -2,7 +2,6 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateAlbumsTable extends Migration

View file

@ -30,6 +30,5 @@ class FixArtistAutoindexValue extends Migration
*/
public function down()
{
//
}
}

View file

@ -27,6 +27,5 @@ class CopyArtistToContributingArtist extends Migration
*/
public function down()
{
//
}
}

View file

@ -25,6 +25,5 @@ class DropIsComplicationFromAlbums extends Migration
*/
public function down()
{
//
}
}

View file

@ -8,8 +8,6 @@ class AddRulesIntoPlaylists extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
@ -20,8 +18,6 @@ class AddRulesIntoPlaylists extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
{

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
@ -15,5 +14,4 @@ return [
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
@ -14,6 +13,5 @@ return [
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
'next' => 'Next &raquo;',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reminder Language Lines
@ -18,5 +17,4 @@ return [
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
@ -13,72 +12,72 @@ return [
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'between' => [
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'filled' => 'The :attribute field is required.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'filled' => 'The :attribute field is required.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'min' => [
'mimes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'url' => 'The :attribute format is invalid.',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'url' => 'The :attribute format is invalid.',
'path' => [
'valid' => 'The :attribute is not a valid or readable path.',
'path' => [
'valid' => 'The :attribute is not a valid or readable path.',
],
/*
@ -93,7 +92,6 @@ return [
*/
'custom' => [
],
/*
@ -108,5 +106,4 @@ return [
*/
'attributes' => [],
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
@ -15,5 +14,4 @@ return [
'failed' => 'Estas credenciales no coinciden con nuestros registros.',
'throttle' => 'Demasiados intentos de inicio de sesión. Por favor intente de nuevo en :seconds segundos.',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
@ -14,6 +13,5 @@ return [
*/
'previous' => '&laquo; Anterior',
'next' => 'Siguiente &raquo;',
'next' => 'Siguiente &raquo;',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reminder Language Lines
@ -18,5 +17,4 @@ return [
'sent' => '¡Hemos enviado por correo electrónico el enlace para reestablecer contraseña!',
'token' => 'Este token de reestablecimiento de contraseña no es válido.',
'user' => 'No podemos encontrar un usuario con ese correo electrónico.',
];

View file

@ -1,7 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
@ -13,72 +12,72 @@ return [
|
*/
'accepted' => 'El :attribute debe ser aceptado.',
'active_url' => 'El :attribute no es una URL válida.',
'after' => 'El :attribute debe ser una fecha posterior a :date.',
'alpha' => 'El :attribute solo puede contener letras.',
'alpha_dash' => 'El :attribute solo puede contener letras, números y guiones.',
'alpha_num' => 'El :attribute solo puede contener letras y números.',
'array' => 'El :attribute debe ser un arreglo.',
'before' => 'El :attribute debe ser una fecha anterior a :date.',
'between' => [
'accepted' => 'El :attribute debe ser aceptado.',
'active_url' => 'El :attribute no es una URL válida.',
'after' => 'El :attribute debe ser una fecha posterior a :date.',
'alpha' => 'El :attribute solo puede contener letras.',
'alpha_dash' => 'El :attribute solo puede contener letras, números y guiones.',
'alpha_num' => 'El :attribute solo puede contener letras y números.',
'array' => 'El :attribute debe ser un arreglo.',
'before' => 'El :attribute debe ser una fecha anterior a :date.',
'between' => [
'numeric' => 'El :attribute debe estar entre :min y :max.',
'file' => 'El :attribute debe estar entre :min y :max kilobytes.',
'string' => 'El :attribute must be between :min y :max caracteres.',
'array' => 'El :attribute debe tener entre :min y :max elementos.',
'file' => 'El :attribute debe estar entre :min y :max kilobytes.',
'string' => 'El :attribute must be between :min y :max caracteres.',
'array' => 'El :attribute debe tener entre :min y :max elementos.',
],
'boolean' => 'El campo :attribute debe ser verdadero o falso.',
'confirmed' => 'El :attribute confirmación no coincide.',
'date' => 'El :attribute no es una fecha válida.',
'date_format' => 'El :attribute no coincide con el formato :format.',
'different' => 'El :attribute y :other deben ser diferentes.',
'digits' => 'El :attribute debe ser de :digits dígitos.',
'digits_between' => 'El :attribute debe estar entre :min y :max dígitos.',
'email' => 'El :attribute debe ser un correo electrónico válido.',
'exists' => 'El :attribute seleccionado no es válido.',
'filled' => 'El campo :attribute es requerido.',
'image' => 'El :attribute debe ser una imagen.',
'in' => 'El :attribute seleccionado no es válido.',
'integer' => 'El :attribute debe ser un entero.',
'ip' => 'El :attribute debe ser una dirección IP válida.',
'json' => 'El :attribute debe ser una cadena JSON válida.',
'max' => [
'boolean' => 'El campo :attribute debe ser verdadero o falso.',
'confirmed' => 'El :attribute confirmación no coincide.',
'date' => 'El :attribute no es una fecha válida.',
'date_format' => 'El :attribute no coincide con el formato :format.',
'different' => 'El :attribute y :other deben ser diferentes.',
'digits' => 'El :attribute debe ser de :digits dígitos.',
'digits_between' => 'El :attribute debe estar entre :min y :max dígitos.',
'email' => 'El :attribute debe ser un correo electrónico válido.',
'exists' => 'El :attribute seleccionado no es válido.',
'filled' => 'El campo :attribute es requerido.',
'image' => 'El :attribute debe ser una imagen.',
'in' => 'El :attribute seleccionado no es válido.',
'integer' => 'El :attribute debe ser un entero.',
'ip' => 'El :attribute debe ser una dirección IP válida.',
'json' => 'El :attribute debe ser una cadena JSON válida.',
'max' => [
'numeric' => 'El :attribute no puede ser mayor que :max.',
'file' => 'El :attribute no puede ser mayor que :max kilobytes.',
'string' => 'El :attribute no puede ser mayor que :max caracteres.',
'array' => 'El :attribute no puede tener mas de :max elementos.',
'file' => 'El :attribute no puede ser mayor que :max kilobytes.',
'string' => 'El :attribute no puede ser mayor que :max caracteres.',
'array' => 'El :attribute no puede tener mas de :max elementos.',
],
'mimes' => 'El :attribute debe ser un archivo de tipo: :values.',
'min' => [
'mimes' => 'El :attribute debe ser un archivo de tipo: :values.',
'min' => [
'numeric' => 'El :attribute debe ser al menos de :min.',
'file' => 'El :attribute debe ser al menos de :min kilobytes.',
'string' => 'El :attribute debe ser al menos de :min caracteres.',
'array' => 'El :attribute debe tener al menos :min elementos.',
'file' => 'El :attribute debe ser al menos de :min kilobytes.',
'string' => 'El :attribute debe ser al menos de :min caracteres.',
'array' => 'El :attribute debe tener al menos :min elementos.',
],
'not_in' => 'El :attribute seleccionado no es válido.',
'numeric' => 'El :attribute debe ser numérico.',
'regex' => 'El formato de :attribute no es válido.',
'required' => 'El campo :attribute es requerido.',
'required_if' => 'El campo :attribute es requerido cuando :other es :value.',
'required_unless' => 'El campo :attribute es requerido a menos que :other exista en :values.',
'required_with' => 'El campo :attribute es requerido cuando :values está presente.',
'required_with_all' => 'El campo :attribute es requerido cuando :values está presente.',
'required_without' => 'El campo :attribute es requerido cuando :values no está presente.',
'not_in' => 'El :attribute seleccionado no es válido.',
'numeric' => 'El :attribute debe ser numérico.',
'regex' => 'El formato de :attribute no es válido.',
'required' => 'El campo :attribute es requerido.',
'required_if' => 'El campo :attribute es requerido cuando :other es :value.',
'required_unless' => 'El campo :attribute es requerido a menos que :other exista en :values.',
'required_with' => 'El campo :attribute es requerido cuando :values está presente.',
'required_with_all' => 'El campo :attribute es requerido cuando :values está presente.',
'required_without' => 'El campo :attribute es requerido cuando :values no está presente.',
'required_without_all' => 'El campo :attribute es requerido cuando ninguno de :values están presentes.',
'same' => 'El :attribute y :other deben coincidir.',
'size' => [
'same' => 'El :attribute y :other deben coincidir.',
'size' => [
'numeric' => 'El :attribute debe ser de :size.',
'file' => 'El :attribute debe ser de :size kilobytes.',
'string' => 'El :attribute debe ser de :size caracteres.',
'array' => 'El :attribute debe contener :size elementos.',
'file' => 'El :attribute debe ser de :size kilobytes.',
'string' => 'El :attribute debe ser de :size caracteres.',
'array' => 'El :attribute debe contener :size elementos.',
],
'string' => 'El :attribute debe ser una cadena.',
'timezone' => 'El :attribute debe ser una zona válida.',
'unique' => 'El :attribute ya ha sido tomado.',
'url' => 'El formato de :attribute no es válido.',
'string' => 'El :attribute debe ser una cadena.',
'timezone' => 'El :attribute debe ser una zona válida.',
'unique' => 'El :attribute ya ha sido tomado.',
'url' => 'El formato de :attribute no es válido.',
'path' => [
'valid' => 'El :attribute no es una ruta válida o legible.',
'path' => [
'valid' => 'El :attribute no es una ruta válida o legible.',
],
/*
@ -93,7 +92,6 @@ return [
*/
'custom' => [
],
/*
@ -108,5 +106,4 @@ return [
*/
'attributes' => [],
];

View file

@ -29,11 +29,11 @@ class ArtistImageTest extends TestCase
->shouldReceive('writeArtistImage')
->once()
->with(Mockery::on(static function (Artist $artist): bool {
return $artist->id === 9999;
return $artist->id === 9999;
}), 'Foo', 'jpeg');
$this->putAsUser('api/artist/9999/image', [
'image' => 'data:image/jpeg;base64,Rm9v'
'image' => 'data:image/jpeg;base64,Rm9v',
], factory(User::class)->states('admin')->create())
->assertStatus(200);
}
@ -47,7 +47,7 @@ class ArtistImageTest extends TestCase
->never();
$this->putAsUser('api/artist/9999/image', [
'image' => 'data:image/jpeg;base64,Rm9v'
'image' => 'data:image/jpeg;base64,Rm9v',
], factory(User::class)->create())
->assertStatus(403);
}

View file

@ -11,7 +11,6 @@ use App\Repositories\InteractionRepository;
use App\Services\DownloadService;
use Exception;
use Illuminate\Support\Collection;
use Illuminate\Testing\TestResponse;
use Mockery;
use Mockery\MockInterface;

View file

@ -205,7 +205,7 @@ class SongTest extends TestCase
/** @var Album $compilationAlbum */
$compilationAlbum = Album::where([
'artist_id' => Artist::VARIOUS_ID,
'name' => 'Two by Two'
'name' => 'Two by Two',
])->first();
self::assertNotNull($compilationAlbum);
@ -235,7 +235,7 @@ class SongTest extends TestCase
$compilationAlbum = Album::where([
'artist_id' => Artist::VARIOUS_ID,
'name' => 'One by One'
'name' => 'One by One',
])->first();
self::assertNotNull($compilationAlbum);

View file

@ -23,7 +23,7 @@ class UserTest extends TestCase
'name' => 'Foo',
'email' => 'bar@baz.com',
'password' => 'qux',
'is_admin' => false
'is_admin' => false,
])->assertStatus(403);
}
@ -39,7 +39,7 @@ class UserTest extends TestCase
'name' => 'Foo',
'email' => 'bar@baz.com',
'password' => 'qux',
'is_admin' => true
'is_admin' => true,
], factory(User::class)->states('admin')->create());
self::assertDatabaseHas('users', [

View file

@ -8,7 +8,6 @@ use App\Listeners\UpdateLastfmNowPlaying;
use App\Models\Song;
use App\Models\User;
use App\Services\LastfmService;
use Exception;
use Illuminate\Support\Facades\Queue;
use Mockery;
use Mockery\MockInterface;

View file

@ -2,11 +2,11 @@
namespace Tests\Integration\Services;
use function App\Helpers\album_cover_path;
use function App\Helpers\album_cover_url;
use App\Models\Album;
use App\Services\MediaMetadataService;
use Tests\TestCase;
use function App\Helpers\album_cover_path;
use function App\Helpers\album_cover_url;
class MediaMetadataServiceTest extends TestCase
{
@ -18,7 +18,7 @@ class MediaMetadataServiceTest extends TestCase
public function testGetAlbumThumbnailUrl(): void
{
copy(__DIR__ . '/../../blobs/cover.png', album_cover_path('album-cover-for-thumbnail-test.jpg'));
copy(__DIR__.'/../../blobs/cover.png', album_cover_path('album-cover-for-thumbnail-test.jpg'));
$album = factory(Album::class)->create(['cover' => 'album-cover-for-thumbnail-test.jpg']);

View file

@ -114,7 +114,7 @@ class SmartPlaylistServiceTest extends TestCase
self::assertSame($sql, $query->toSql());
$queryBinding = $query->getBindings();
for ($i = 0, $count = count($queryBinding); $i < $count; $i++) {
for ($i = 0, $count = count($queryBinding); $i < $count; ++$i) {
self::assertSame(
$bindings[$i],
is_object($queryBinding[$i]) ? (string) $queryBinding[$i] : $queryBinding[$i]

View file

@ -9,7 +9,7 @@ use Illuminate\Foundation\Application;
trait CreatesApplication
{
protected $mediaPath = __DIR__ . '/../songs';
protected $mediaPath = __DIR__.'/../songs';
/** @var Kernel */
private $artisan;
@ -24,7 +24,7 @@ trait CreatesApplication
public function createApplication()
{
/** @var Application $app */
$app = require __DIR__ . '/../../bootstrap/app.php';
$app = require __DIR__.'/../../bootstrap/app.php';
$this->artisan = $app->make(Artisan::class);
$this->artisan->bootstrap();

View file

@ -11,7 +11,7 @@ use Tests\TestCase;
class UpdateLastfmNowPlayingJobTest extends TestCase
{
/** @var UpdateLastfmNowPlayingJob */
/** @var UpdateLastfmNowPlayingJob */
private $job;
/** @var User */

View file

@ -2,6 +2,8 @@
namespace Tests\Unit\Services;
use function App\Helpers\album_cover_url;
use function App\Helpers\artist_image_url;
use App\Models\Album;
use App\Models\Artist;
use App\Services\ImageWriter;
@ -10,8 +12,6 @@ use Illuminate\Log\Logger;
use Mockery;
use Mockery\MockInterface;
use Tests\TestCase;
use function App\Helpers\album_cover_url;
use function App\Helpers\artist_image_url;
class MediaMetadataServiceTest extends TestCase
{