Skip to content

Commit

Permalink
Fix StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienheyd committed Dec 12, 2021
1 parent 183acd6 commit 5f8ce67
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 87 deletions.
2 changes: 1 addition & 1 deletion src/Commands/Clearthumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function handle()
$this->info('thumbs directory deleted');

Collection::make($storage->allDirectories())->filter(function ($item) {
if (!preg_match('`^thumbs`', $item)) {
if (! preg_match('`^thumbs`', $item)) {
$path = new Path('/'.$item);
$path->clearCache();
}
Expand Down
39 changes: 15 additions & 24 deletions src/Controllers/MediaManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public function __construct()
/**
* Delete file(s) or a folder.
*
* @param Request $request
*
* @param Request $request
* @return JsonResponse|ResponseFactory
*/
public function delete(Request $request)
Expand Down Expand Up @@ -63,8 +62,7 @@ public function delete(Request $request)
/**
* Display the media manager.
*
* @param Request $request
*
* @param Request $request
* @return View
*/
public function index(Request $request)
Expand All @@ -91,8 +89,7 @@ public function index(Request $request)
/**
* Display files and directories list.
*
* @param Request $request
*
* @param Request $request
* @return Factory|View
*/
public function list(Request $request)
Expand All @@ -108,7 +105,7 @@ public function list(Request $request)

$content = new Path($path);

if (!$content->exists()) {
if (! $content->exists()) {
return view('boilerplate-media-manager::error', ['query' => session()->get('queryString')]);
}

Expand All @@ -130,8 +127,7 @@ public function list(Request $request)
/**
* Display the media manager for MCE.
*
* @param Request $request
*
* @param Request $request
* @return View
*/
public function mce(Request $request)
Expand All @@ -158,8 +154,7 @@ public function mce(Request $request)
/**
* Add a new folder.
*
* @param Request $request
*
* @param Request $request
* @return JsonResponse|ResponseFactory
*/
public function newFolder(Request $request)
Expand All @@ -173,8 +168,7 @@ public function newFolder(Request $request)
/**
* Paste file(s) into the given path.
*
* @param Request $request
*
* @param Request $request
* @return JsonResponse|ResponseFactory
*/
public function paste(Request $request)
Expand Down Expand Up @@ -208,13 +202,12 @@ public function paste(Request $request)
/**
* Delete a file or a folder.
*
* @param Request $request
*
* @param Request $request
* @return JsonResponse
*/
public function rename(Request $request)
{
if (!$request->isXmlHttpRequest()) {
if (! $request->isXmlHttpRequest()) {
abort(403);
}

Expand Down Expand Up @@ -242,11 +235,10 @@ public function rename(Request $request)
/**
* Upload file(s) to server.
*
* @param Request $request
* @param Request $request
* @return JsonResponse|ResponseFactory
*
* @throws Exception
*
* @return JsonResponse|ResponseFactory
*/
public function upload(Request $request)
{
Expand All @@ -272,7 +264,7 @@ public function upload(Request $request)
try {
$file = $request->file('file');

if (!$file instanceof UploadedFile) {
if (! $file instanceof UploadedFile) {
throw new UnexpectedValueException('File is not instance of UploadedFile');
}

Expand All @@ -296,11 +288,10 @@ public function upload(Request $request)
/**
* Upload file to server from TinyMCE.
*
* @param Request $request
* @param Request $request
* @return JsonResponse|ResponseFactory
*
* @throws Exception
*
* @return JsonResponse|ResponseFactory
*/
public function uploadMce(Request $request)
{
Expand All @@ -321,7 +312,7 @@ public function uploadMce(Request $request)
try {
$file = $request->file('file');

if (!$file instanceof UploadedFile) {
if (! $file instanceof UploadedFile) {
throw new UnexpectedValueException('File is not instance of UploadedFile');
}

Expand Down
26 changes: 12 additions & 14 deletions src/Lib/ImageResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class ImageResizer
/**
* Get resized image url from the given public path.
*
* @param string $path Image public path (/storage/*)
* @param int $width
* @param int $height
* @param string $type
*
* @param string $path Image public path (/storage/*)
* @param int $width
* @param int $height
* @param string $type
* @return string
*/
public static function url(string $path, $width, $height, $type = 'fit')
Expand All @@ -38,7 +37,7 @@ public static function url(string $path, $width, $height, $type = 'fit')
/**
* ImageResizer constructor.
*
* @param string $path
* @param string $path
*/
public function __construct(string $path)
{
Expand All @@ -50,15 +49,14 @@ public function __construct(string $path)
/**
* Set thumbnail size.
*
* @param int $width
* @param int $height
* @param string $type
*
* @param int $width
* @param int $height
* @param string $type
* @return $this
*/
public function setSize($width, $height, $type = 'fit')
{
if (!isset($this->pathinfo['dirname'])) {
if (! isset($this->pathinfo['dirname'])) {
return $this;
}

Expand All @@ -83,7 +81,7 @@ public function setSize($width, $height, $type = 'fit')
*/
public function getDestFileSize()
{
if (!$this->storage->exists($this->dest_file)) {
if (! $this->storage->exists($this->dest_file)) {
return false;
}

Expand All @@ -99,11 +97,11 @@ public function getDestFileSize()
*/
public function getUrl()
{
if (empty($this->path) || !$this->storage->exists($this->path)) {
if (empty($this->path) || ! $this->storage->exists($this->path)) {
return '';
}

if (!in_array(strtolower($this->pathinfo['extension']), ['jpg', 'jpeg', 'png', 'gif'])) {
if (! in_array(strtolower($this->pathinfo['extension']), ['jpg', 'jpeg', 'png', 'gif'])) {
return '';
}

Expand Down
5 changes: 2 additions & 3 deletions src/Models/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function parent()

$path = '';

if (!empty($bc)) {
if (! empty($bc)) {
$last = end($bc);
$path = $last['path'];
}
Expand All @@ -71,8 +71,7 @@ public function parent()
/**
* Format an array of directories.
*
* @param array $dirs
*
* @param array $dirs
* @return \Illuminate\Support\Collection
*/
private function formatDirectories($dirs = [])
Expand Down
6 changes: 3 additions & 3 deletions src/Models/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Directory
/**
* File constructor.
*
* @param string $directory
* @param string $directory
*/
public function __construct($directory)
{
Expand All @@ -28,7 +28,7 @@ public function __construct($directory)
/**
* Rename current directory.
*
* @param string $newName
* @param string $newName
*/
public function rename($newName)
{
Expand All @@ -42,7 +42,7 @@ public function rename($newName)
/**
* Move current directory.
*
* @param string $destinationPath
* @param string $destinationPath
*/
public function move($destinationPath)
{
Expand Down
11 changes: 5 additions & 6 deletions src/Models/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class File extends BaseFile
/**
* File constructor.
*
* @param string $file
* @param string $file
*/
public function __construct($file)
{
Expand All @@ -30,7 +30,7 @@ public function __construct($file)
/**
* Rename current file.
*
* @param string $newName
* @param string $newName
*/
public function rename($newName)
{
Expand Down Expand Up @@ -67,7 +67,7 @@ public function delete()
/**
* Move current file.
*
* @param string $destinationPath
* @param string $destinationPath
*/
public function move($destinationPath)
{
Expand Down Expand Up @@ -120,8 +120,7 @@ private function getThumbs()
/**
* Get full path for a given relative path.
*
* @param string $file
*
* @param string $file
* @return mixed
*/
public function getFullPath($file = '')
Expand Down Expand Up @@ -173,7 +172,7 @@ public function generateThumb()

if (in_array(strtolower($this->pathinfo['extension'] ?? ''), $ext)) {
$destFile = $this->getFullPath($this->getThumbPath());
if (!is_file($destFile)) {
if (! is_file($destFile)) {
Image::make($this->getFullPath())->fit(150)->save($destFile, 75);
}
}
Expand Down
Loading

0 comments on commit 5f8ce67

Please sign in to comment.