Skip to content

Commit

Permalink
Standards fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
billtomczak committed Jun 29, 2023
1 parent 8927d82 commit 28ac5b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/admin/models/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
use Joomla\CMS\Table\Table;
use Joomla\Registry\Registry;

// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
// phpcs:enable PSR1.Files.SideEffects
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace

class OsdownloadsModelFile extends AdminModel
{
Expand Down Expand Up @@ -236,7 +239,7 @@ protected function gcFileUploads()
* @return void
* @throws Exception
*/
protected function uploadFile(&$data)
protected function uploadFile(array &$data): void
{
$app = Factory::getApplication();
$files = $app->input->files->get('jform', [], 'raw');
Expand All @@ -245,10 +248,11 @@ protected function uploadFile(&$data)
$fileName = $upload->get('name');
if (empty($fileName)) {
if (empty($data['file_path'])) {
if (isset($files['file_path_upload']['name'])) {
$error = 'COM_OSDOWNLOADS_UPLOAD_ERR_REQUIRED';
} else {
if (empty($files['file_path_upload']['name'])) {
$error = 'COM_OSDOWNLOADS_UPLOAD_ERR_EMPTY_FIELD';

} else {
$error = 'COM_OSDOWNLOADS_UPLOAD_ERR_REQUIRED';
}

throw new Exception(Text::_($error));
Expand Down
3 changes: 3 additions & 0 deletions src/admin/models/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table;

// phpcs:disable PSR1.Files.SideEffects
defined('_JEXEC') or die();
// phpcs:enable PSR1.Files.SideEffects
// phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace

class OsdownloadsModelFiles extends ListModel
{
Expand Down

0 comments on commit 28ac5b8

Please sign in to comment.