Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function add(): void
}

// Content is only required when it is a file
if (empty($content) && strpos($path, '.') !== false) {
if (empty($content) && str_contains($path, '.')) {
$missingParameters[] = 'content';
}

Expand Down
2 changes: 1 addition & 1 deletion api/components/com_media/src/Model/AdapterModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AdapterModel extends BaseModel
*/
public function getItem(): \stdClass
{
list($provider, $account) = array_pad(explode('-', $this->getState('id'), 2), 2, null);
[$provider, $account] = array_pad(explode('-', $this->getState('id'), 2), 2, null);

if ($account === null) {
throw new \Exception('Account was not set');
Expand Down
2 changes: 1 addition & 1 deletion api/components/com_media/src/Model/MediaModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getItems(): array
['adapter' => $adapterName, 'path' => $path] = $this->resolveAdapterAndPath($this->getState('path', ''));
try {
$files = $this->mediaApiModel->getFiles($adapterName, $path, $options);
} catch (FileNotFoundException $e) {
} catch (FileNotFoundException) {
throw new ResourceNotFound(
Text::sprintf('WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', $path),
404
Expand Down
16 changes: 8 additions & 8 deletions api/components/com_media/src/Model/MediumModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getItem()

try {
return $this->mediaApiModel->getFile($adapterName, $path, $options);
} catch (FileNotFoundException $e) {
} catch (FileNotFoundException) {
throw new ResourceNotFound(
Text::sprintf('WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', $path),
404
Expand Down Expand Up @@ -121,7 +121,7 @@ public function save($path = null): string
$this->mediaApiModel->move($adapterName, $oldPath, $path, $override),
'/'
);
} catch (FileNotFoundException $e) {
} catch (FileNotFoundException) {
throw new Save(
Text::sprintf(
'WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND',
Expand Down Expand Up @@ -159,23 +159,23 @@ public function save($path = null): string
);

$resultPath = $dirname . '/' . $name;
} catch (FileNotFoundException $e) {
} catch (FileNotFoundException) {
throw new Save(
Text::sprintf(
'WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND',
$dirname . '/' . $basename
),
404
);
} catch (FileExistsException $e) {
} catch (FileExistsException) {
throw new Save(
Text::sprintf(
'WEBSERVICE_COM_MEDIA_FILE_EXISTS',
$dirname . '/' . $basename
),
400
);
} catch (InvalidPathException $e) {
} catch (InvalidPathException) {
throw new Save(
Text::sprintf(
'WEBSERVICE_COM_MEDIA_BAD_FILE_TYPE',
Expand All @@ -201,15 +201,15 @@ public function save($path = null): string
$dirname,
$content
);
} catch (FileNotFoundException $e) {
} catch (FileNotFoundException) {
throw new Save(
Text::sprintf(
'WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND',
$dirname . '/' . $basename
),
404
);
} catch (InvalidPathException $e) {
} catch (InvalidPathException) {
throw new Save(
Text::sprintf(
'WEBSERVICE_COM_MEDIA_BAD_FILE_TYPE',
Expand Down Expand Up @@ -250,7 +250,7 @@ public function delete(): void

try {
$this->mediaApiModel->delete($adapterName, $path);
} catch (FileNotFoundException $e) {
} catch (FileNotFoundException) {
throw new Save(
Text::sprintf('WEBSERVICE_COM_MEDIA_FILE_NOT_FOUND', $path),
404
Expand Down