mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Applied rector suggestions
This commit is contained in:
parent
4106bcef5f
commit
20f32c7f12
170 changed files with 808 additions and 761 deletions
|
@ -47,9 +47,9 @@ class FilenameSanatizer
|
|||
'-', $filename);
|
||||
|
||||
// avoids ".", ".." or ".hiddenFiles"
|
||||
$filename = ltrim($filename, '.-');
|
||||
$filename = ltrim((string) $filename, '.-');
|
||||
//Limit filename length to 255 bytes
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
return mb_strcut(pathinfo($filename, PATHINFO_FILENAME), 0, 255 - ($ext ? strlen($ext) + 1 : 0), mb_detect_encoding($filename)) . ($ext ? '.' . $ext : '');
|
||||
return mb_strcut(pathinfo($filename, PATHINFO_FILENAME), 0, 255 - ($ext !== '' && $ext !== '0' ? strlen($ext) + 1 : 0), mb_detect_encoding($filename)) . ($ext !== '' && $ext !== '0' ? '.' . $ext : '');
|
||||
}
|
||||
}
|
|
@ -174,11 +174,7 @@ final class ProjectBuildRequest
|
|||
*/
|
||||
public function getLotWithdrawAmount(PartLot|int $lot): float
|
||||
{
|
||||
if ($lot instanceof PartLot) {
|
||||
$lot_id = $lot->getID();
|
||||
} else { // Then it must be an int
|
||||
$lot_id = $lot;
|
||||
}
|
||||
$lot_id = $lot instanceof PartLot ? $lot->getID() : $lot;
|
||||
|
||||
if (! array_key_exists($lot_id, $this->withdraw_amounts)) {
|
||||
throw new \InvalidArgumentException('The given lot is not in the withdraw amounts array!');
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace App\Helpers;
|
|||
/**
|
||||
* Helper functions for logic operations with trinary logic.
|
||||
* True and false are represented as classical boolean values, undefined is represented as null.
|
||||
* @see \App\Tests\Helpers\TrinaryLogicHelperTest
|
||||
*/
|
||||
class TrinaryLogicHelper
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue