mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-12 23:38:42 +00:00
php cs fixer
This commit is contained in:
parent
6926c00775
commit
3d65a24d33
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\Media\Controller\ApiController;
|
use Modules\Media\Controller\ApiController;
|
||||||
use Modules\Media\Models\PermissionState;
|
use Modules\Media\Models\PermissionState;
|
||||||
|
|
@ -18,7 +18,7 @@ return [
|
||||||
'data' => [
|
'data' => [
|
||||||
'field_name' => [
|
'field_name' => [
|
||||||
'type' => 'string', 'default' => 'Hello', 'validation' => '[\\w]*', 'required' => false,'annotation' => [],
|
'type' => 'string', 'default' => 'Hello', 'validation' => '[\\w]*', 'required' => false,'annotation' => [],
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\Media\Controller\BackendController;
|
use Modules\Media\Controller\BackendController;
|
||||||
use Modules\Media\Models\PermissionState;
|
use Modules\Media\Models\PermissionState;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@ namespace Modules\Media\Controller;
|
||||||
|
|
||||||
use Modules\Media\Models\Media;
|
use Modules\Media\Models\Media;
|
||||||
use Modules\Media\Models\MediaMapper;
|
use Modules\Media\Models\MediaMapper;
|
||||||
use Modules\Media\Models\Collection;
|
|
||||||
use Modules\Media\Models\CollectionMapper;
|
|
||||||
use Modules\Media\Models\UploadFile;
|
use Modules\Media\Models\UploadFile;
|
||||||
use Modules\Media\Models\UploadStatus;
|
use Modules\Media\Models\UploadStatus;
|
||||||
use phpOMS\Message\NotificationLevel;
|
use phpOMS\Message\NotificationLevel;
|
||||||
|
|
@ -128,7 +126,7 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
public static function createMediaPath(string $basePath = 'Modules/Media/Files') : string
|
public static function createMediaPath(string $basePath = 'Modules/Media/Files') : string
|
||||||
{
|
{
|
||||||
$rndPath = \str_pad(\dechex(\mt_rand(0, 65535)), 4, '0', STR_PAD_LEFT);
|
$rndPath = \str_pad(\dechex(\mt_rand(0, 65535)), 4, '0', \STR_PAD_LEFT);
|
||||||
return $basePath . '/' . $rndPath[0] . $rndPath[1] . '/' . $rndPath[2] . $rndPath[3];
|
return $basePath . '/' . $rndPath[0] . $rndPath[1] . '/' . $rndPath[2] . $rndPath[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class UploadFile
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
if (\count($files) === \count($files, COUNT_RECURSIVE)) {
|
if (\count($files) === \count($files, \COUNT_RECURSIVE)) {
|
||||||
$files = [$files];
|
$files = [$files];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ class UploadFile
|
||||||
$result[$key]['status'] = UploadStatus::WRONG_PARAMETERS;
|
$result[$key]['status'] = UploadStatus::WRONG_PARAMETERS;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} elseif ($f['error'] !== UPLOAD_ERR_OK) {
|
} elseif ($f['error'] !== \UPLOAD_ERR_OK) {
|
||||||
$result[$key]['status'] = $this->getUploadError($f['error']);
|
$result[$key]['status'] = $this->getUploadError($f['error']);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
@ -223,7 +223,7 @@ class UploadFile
|
||||||
$sha .= '.' . $extension;
|
$sha .= '.' . $extension;
|
||||||
$fileName = $sha;
|
$fileName = $sha;
|
||||||
$rnd = \mt_rand();
|
$rnd = \mt_rand();
|
||||||
$limit++;
|
++$limit;
|
||||||
} while (\file_exists($path . '/' . $fileName) && $limit < self::PATH_GENERATION_LIMIT);
|
} while (\file_exists($path . '/' . $fileName) && $limit < self::PATH_GENERATION_LIMIT);
|
||||||
|
|
||||||
if ($limit >= self::PATH_GENERATION_LIMIT) {
|
if ($limit >= self::PATH_GENERATION_LIMIT) {
|
||||||
|
|
@ -282,7 +282,7 @@ class UploadFile
|
||||||
private function findOutputDir(array $files) : string
|
private function findOutputDir(array $files) : string
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
$rndPath = \str_pad(\dechex(\rand(0, 65535)), 4, '0', STR_PAD_LEFT);
|
$rndPath = \str_pad(\dechex(\mt_rand(0, 65535)), 4, '0', \STR_PAD_LEFT);
|
||||||
} while (\file_exists($this->outputDir . '/' . $rndPath));
|
} while (\file_exists($this->outputDir . '/' . $rndPath));
|
||||||
|
|
||||||
return $this->outputDir . '/' . $rndPath;
|
return $this->outputDir . '/' . $rndPath;
|
||||||
|
|
@ -300,11 +300,11 @@ class UploadFile
|
||||||
private function getUploadError($error) : int
|
private function getUploadError($error) : int
|
||||||
{
|
{
|
||||||
switch ($error) {
|
switch ($error) {
|
||||||
case UPLOAD_ERR_NO_FILE:
|
case \UPLOAD_ERR_NO_FILE:
|
||||||
// TODO: no file sent
|
// TODO: no file sent
|
||||||
return UploadStatus::NOTHING_UPLOADED;
|
return UploadStatus::NOTHING_UPLOADED;
|
||||||
case UPLOAD_ERR_INI_SIZE:
|
case \UPLOAD_ERR_INI_SIZE:
|
||||||
case UPLOAD_ERR_FORM_SIZE:
|
case \UPLOAD_ERR_FORM_SIZE:
|
||||||
return UploadStatus::UPLOAD_SIZE;
|
return UploadStatus::UPLOAD_SIZE;
|
||||||
default:
|
default:
|
||||||
return UploadStatus::UNKNOWN_ERROR;
|
return UploadStatus::UNKNOWN_ERROR;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Orange Management
|
* Orange Management
|
||||||
*
|
*
|
||||||
|
|
@ -19,7 +19,7 @@ include __DIR__ . '/template-functions.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \phpOMS\Views\View $this
|
* @var \phpOMS\Views\View $this
|
||||||
* @var $media \Modules\Media\Models\Media
|
* @var $media \Modules\Media\Models\Media
|
||||||
*/
|
*/
|
||||||
$media = $this->getData('media');
|
$media = $this->getData('media');
|
||||||
echo $this->getData('nav')->render();
|
echo $this->getData('nav')->render();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
use \phpOMS\System\File\ExtensionType;
|
use \phpOMS\System\File\ExtensionType;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user