mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-28 12:40:08 +02:00
Fixed code style.
This commit is contained in:
parent
2853e471c4
commit
d0b1024d80
212 changed files with 495 additions and 1005 deletions
|
@ -68,7 +68,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
|
||||
|
||||
/**
|
||||
* @var array Placeholders for attachments which using built in files.
|
||||
* @var array placeholders for attachments which using built in files
|
||||
*/
|
||||
public const BUILTIN_PLACEHOLDER = ['%FOOTPRINTS%', '%FOOTPRINTS3D%'];
|
||||
|
||||
|
@ -182,7 +182,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
return true;
|
||||
}
|
||||
|
||||
return ! in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
|
||||
return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -233,7 +233,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
return null;
|
||||
}
|
||||
|
||||
if (! empty($this->original_filename)) {
|
||||
if (!empty($this->original_filename)) {
|
||||
return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION));
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
public function getURL(): ?string
|
||||
{
|
||||
if (! $this->isExternal() && ! $this->isBuiltIn()) {
|
||||
if (!$this->isExternal() && !$this->isBuiltIn()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
public function getHost(): ?string
|
||||
{
|
||||
if (! $this->isExternal()) {
|
||||
if (!$this->isExternal()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
}
|
||||
|
||||
//If we have a stored original filename, then use it
|
||||
if (! empty($this->original_filename)) {
|
||||
if (!empty($this->original_filename)) {
|
||||
return $this->original_filename;
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,6 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
return $this->attachment_type;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************************************
|
||||
* Setters
|
||||
***************************************************************************************************
|
||||
|
@ -367,7 +366,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
public function setElement(AttachmentContainingDBElement $element): self
|
||||
{
|
||||
if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
||||
}
|
||||
|
||||
|
@ -409,7 +408,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
public function setURL(?string $url): self
|
||||
{
|
||||
//Only set if the URL is not empty
|
||||
if (! empty($url)) {
|
||||
if (!empty($url)) {
|
||||
if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
|
||||
throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
|
||||
}
|
||||
|
|
|
@ -118,5 +118,4 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
|||
use TimestampTrait;
|
||||
|
||||
/**
|
||||
* @var string The name of this element.
|
||||
* @var string the name of this element
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\NotBlank()
|
||||
* @Groups({"simple", "extended", "full"})
|
||||
|
@ -92,8 +92,6 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
|||
* Change the name of this element.
|
||||
*
|
||||
* @param string $new_name the new name
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setName(string $new_name): self
|
||||
{
|
||||
|
|
|
@ -22,9 +22,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
@ -34,5 +31,4 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
*/
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
* @param AbstractStructuralDBElement $another_element the object to compare
|
||||
* IMPORTANT: both objects to compare must be from the same class (for example two "Device" objects)!
|
||||
*
|
||||
* @return bool True, if this element is child of $another_element.
|
||||
* @return bool true, if this element is child of $another_element
|
||||
*
|
||||
* @throws InvalidArgumentException if there was an error
|
||||
*/
|
||||
|
@ -140,7 +140,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
|
||||
//Check if both elements compared, are from the same type
|
||||
// (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type):
|
||||
if (! is_a($another_element, $class_name) && ! is_a($this, get_class($another_element))) {
|
||||
if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) {
|
||||
throw new InvalidArgumentException('isChildOf() only works for objects of the same type!');
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Checks if this element is an root element (has no parent).
|
||||
*
|
||||
* @return bool True if the this element is an root element.
|
||||
* @return bool true if the this element is an root element
|
||||
*/
|
||||
public function isRoot(): bool
|
||||
{
|
||||
|
@ -256,7 +256,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
$tmp[] = $this;
|
||||
|
||||
//We only allow 20 levels depth
|
||||
while (! end($tmp)->isRoot() && count($tmp) < 20) {
|
||||
while (!end($tmp)->isRoot() && count($tmp) < 20) {
|
||||
$tmp[] = end($tmp)->parent;
|
||||
}
|
||||
|
||||
|
@ -283,9 +283,6 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNotSelectable(): bool
|
||||
{
|
||||
return $this->not_selectable;
|
||||
|
@ -337,7 +334,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
*/
|
||||
public function setChildren($elements): self
|
||||
{
|
||||
if (! is_array($elements) && ! $elements instanceof Collection) {
|
||||
if (!is_array($elements) && !$elements instanceof Collection) {
|
||||
throw new InvalidArgumentException('$elements must be an array or Collection!');
|
||||
}
|
||||
|
||||
|
|
|
@ -20,24 +20,24 @@
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
interface PartsContainingRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Returns all parts associated with this element.
|
||||
* @param object $element The element for which the parts should be determined.
|
||||
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
|
||||
*
|
||||
* @param object $element the element for which the parts should be determined
|
||||
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
|
||||
*
|
||||
* @return Part[]
|
||||
*/
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
|
||||
|
||||
/**
|
||||
* Gets the count of the parts associated with this element.
|
||||
* @param object $element The element for which the parts should be determined.
|
||||
* @return int
|
||||
*
|
||||
* @param object $element the element for which the parts should be determined
|
||||
*/
|
||||
public function getPartsCount(object $element): int;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,16 +27,12 @@ interface LogWithCommentInterface
|
|||
{
|
||||
/**
|
||||
* Checks if this log entry has a user provided comment.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasComment(): bool;
|
||||
|
||||
/**
|
||||
* Gets the user provided comment associated with this log entry.
|
||||
* Returns null if not comment was set.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getComment(): ?string;
|
||||
|
||||
|
|
|
@ -29,15 +29,11 @@ interface LogWithEventUndoInterface
|
|||
{
|
||||
/**
|
||||
* Checks if this element undoes another event.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isUndoEvent(): bool;
|
||||
|
||||
/**
|
||||
* Returns the ID of the undone event or null if no event is undone.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getUndoEventID(): ?int;
|
||||
|
||||
|
@ -52,8 +48,6 @@ interface LogWithEventUndoInterface
|
|||
* Returns the mode how the event was undone:
|
||||
* "undo" = Only a single event was applied to element
|
||||
* "revert" = Element was reverted to the state it was to the timestamp of the log.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUndoMode(): string;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ interface TimeTravelInterface
|
|||
/**
|
||||
* Checks if this entry has informations which data has changed.
|
||||
*
|
||||
* @return bool True if this entry has informations about the changed data.
|
||||
* @return bool true if this entry has informations about the changed data
|
||||
*/
|
||||
public function hasOldDataInformations(): bool;
|
||||
|
||||
|
@ -40,8 +40,6 @@ interface TimeTravelInterface
|
|||
|
||||
/**
|
||||
* Returns the the timestamp associated with this change.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getTimestamp(): \DateTime;
|
||||
}
|
||||
|
|
|
@ -73,12 +73,12 @@ class LabelOptions
|
|||
protected $supported_element = 'part';
|
||||
|
||||
/**
|
||||
* @var string Any additional CSS for the label.
|
||||
* @var string any additional CSS for the label
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $additional_css = '';
|
||||
|
||||
/** @var string The mode that will be used to interpret the lines.
|
||||
/** @var string The mode that will be used to interpret the lines
|
||||
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
|
@ -90,9 +90,6 @@ class LabelOptions
|
|||
*/
|
||||
protected $lines = '';
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getWidth(): float
|
||||
{
|
||||
return $this->width;
|
||||
|
@ -108,9 +105,6 @@ class LabelOptions
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getHeight(): float
|
||||
{
|
||||
return $this->height;
|
||||
|
@ -126,9 +120,6 @@ class LabelOptions
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBarcodeType(): string
|
||||
{
|
||||
return $this->barcode_type;
|
||||
|
@ -144,9 +135,6 @@ class LabelOptions
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPictureType(): string
|
||||
{
|
||||
return $this->picture_type;
|
||||
|
@ -162,9 +150,6 @@ class LabelOptions
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSupportedElement(): string
|
||||
{
|
||||
return $this->supported_element;
|
||||
|
@ -180,9 +165,6 @@ class LabelOptions
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLines(): string
|
||||
{
|
||||
return $this->lines;
|
||||
|
@ -200,8 +182,6 @@ class LabelOptions
|
|||
|
||||
/**
|
||||
* Gets additional CSS (it will simply be attached.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalCss(): string
|
||||
{
|
||||
|
@ -218,9 +198,6 @@ class LabelOptions
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLinesMode(): string
|
||||
{
|
||||
return $this->lines_mode;
|
||||
|
|
|
@ -59,7 +59,7 @@ class LabelProfile extends AttachmentContainingDBElement
|
|||
protected $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool Determines, if this label profile should be shown in the dropdown quick menu.
|
||||
* @var bool determines, if this label profile should be shown in the dropdown quick menu
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $show_in_dropdown = true;
|
||||
|
@ -101,8 +101,6 @@ class LabelProfile extends AttachmentContainingDBElement
|
|||
|
||||
/**
|
||||
* Returns true, if this label profile should be shown in label generator quick menu.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isShowInDropdown(): bool
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
*/
|
||||
protected $user;
|
||||
|
||||
/** @var DateTime The datetime the event associated with this log entry has occured.
|
||||
/** @var DateTime The datetime the event associated with this log entry has occured
|
||||
* @ORM\Column(type="datetime", name="datetime")
|
||||
*/
|
||||
protected $timestamp;
|
||||
|
@ -223,8 +223,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* Returns the timestamp when the event that caused this log entry happened.
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getTimestamp(): DateTime
|
||||
{
|
||||
|
@ -246,8 +244,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
/**
|
||||
* Get the priority level of this log entry. 0 is highest and 7 lowest level.
|
||||
* See LEVEL_* consts in this class for more info.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLevel(): int
|
||||
{
|
||||
|
@ -276,8 +272,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* Get the priority level of this log entry as PSR3 compatible string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLevelString(): string
|
||||
{
|
||||
|
@ -298,8 +292,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* Returns the type of the event this log entry is associated with.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
|
@ -310,7 +302,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
* Returns the class name of the target element associated with this log entry.
|
||||
* Returns null, if this log entry is not associated with an log entry.
|
||||
*
|
||||
* @return string|null The class name of the target class.
|
||||
* @return string|null the class name of the target class
|
||||
*/
|
||||
public function getTargetClass(): ?string
|
||||
{
|
||||
|
@ -325,7 +317,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
* Returns the ID of the target element associated with this log entry.
|
||||
* Returns null, if this log entry is not associated with an log entry.
|
||||
*
|
||||
* @return int|null The ID of the associated element.
|
||||
* @return int|null the ID of the associated element
|
||||
*/
|
||||
public function getTargetID(): ?int
|
||||
{
|
||||
|
@ -339,7 +331,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
/**
|
||||
* Checks if this log entry is associated with an element.
|
||||
*
|
||||
* @return bool True if this log entry is associated with an element, false otherwise.
|
||||
* @return bool true if this log entry is associated with an element, false otherwise
|
||||
*/
|
||||
public function hasTarget(): bool
|
||||
{
|
||||
|
@ -349,7 +341,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
/**
|
||||
* Sets the target element associated with this element.
|
||||
*
|
||||
* @param AbstractDBElement $element The element that should be associated with this element.
|
||||
* @param AbstractDBElement $element the element that should be associated with this element
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -394,7 +386,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
*/
|
||||
final public static function levelIntToString(int $level): string
|
||||
{
|
||||
if (! isset(self::LEVEL_ID_TO_STRING[$level])) {
|
||||
if (!isset(self::LEVEL_ID_TO_STRING[$level])) {
|
||||
throw new \InvalidArgumentException('No level with this int is existing!');
|
||||
}
|
||||
|
||||
|
@ -406,12 +398,12 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
*
|
||||
* @param string $level the PSR3 compatible string that should be converted
|
||||
*
|
||||
* @return int The internal int representation.
|
||||
* @return int the internal int representation
|
||||
*/
|
||||
final public static function levelStringToInt(string $level): int
|
||||
{
|
||||
$tmp = array_flip(self::LEVEL_ID_TO_STRING);
|
||||
if (! isset($tmp[$level])) {
|
||||
if (!isset($tmp[$level])) {
|
||||
throw new \InvalidArgumentException('No level with this string is existing!');
|
||||
}
|
||||
|
||||
|
@ -422,12 +414,10 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
* Converts an target type id to an full qualified class name.
|
||||
*
|
||||
* @param int $type_id The target type ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final public static function targetTypeIdToClass(int $type_id): string
|
||||
{
|
||||
if (! isset(self::TARGET_CLASS_MAPPING[$type_id])) {
|
||||
if (!isset(self::TARGET_CLASS_MAPPING[$type_id])) {
|
||||
throw new \InvalidArgumentException('No target type with this ID is existing!');
|
||||
}
|
||||
|
||||
|
@ -439,7 +429,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
*
|
||||
* @param string $class The name of the class (FQN) that should be converted to id
|
||||
*
|
||||
* @return int The ID of the associated target type ID.
|
||||
* @return int the ID of the associated target type ID
|
||||
*/
|
||||
final public static function targetTypeClassToID(string $class): int
|
||||
{
|
||||
|
|
|
@ -54,8 +54,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
|||
|
||||
/**
|
||||
* Get the name of the collection (on target element) that was changed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCollectionName(): string
|
||||
{
|
||||
|
@ -65,8 +63,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
|||
/**
|
||||
* Gets the name of the element that was deleted.
|
||||
* Return null, if the element did not have a name.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getOldName(): ?string
|
||||
{
|
||||
|
@ -75,8 +71,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
|||
|
||||
/**
|
||||
* Returns the class of the deleted element.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDeletedElementClass(): string
|
||||
{
|
||||
|
@ -85,8 +79,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
|||
|
||||
/**
|
||||
* Returns the ID of the deleted element.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDeletedElementID(): int
|
||||
{
|
||||
|
|
|
@ -60,8 +60,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Checks if the database update was successful.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuccessful(): bool
|
||||
{
|
||||
|
@ -71,8 +69,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Gets the database version before update.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOldVersion(): string
|
||||
{
|
||||
|
@ -81,8 +77,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Gets the (target) database version after update.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNewVersion(): string
|
||||
{
|
||||
|
|
|
@ -70,8 +70,6 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
|
|||
|
||||
/**
|
||||
* Gets the instock when the part was created.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCreationInstockValue(): ?string
|
||||
{
|
||||
|
@ -80,8 +78,6 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
|
|||
|
||||
/**
|
||||
* Checks if a creation instock value was saved with this entry.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCreationInstockValue(): bool
|
||||
{
|
||||
|
|
|
@ -109,7 +109,7 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
|
|||
|
||||
public function hasOldDataInformations(): bool
|
||||
{
|
||||
return ! empty($this->extra['o']);
|
||||
return !empty($this->extra['o']);
|
||||
}
|
||||
|
||||
public function getOldData(): array
|
||||
|
|
|
@ -65,8 +65,6 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
|
|||
|
||||
/**
|
||||
* Checks if this log contains infos about which fields has changed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasChangedFieldsInfo(): bool
|
||||
{
|
||||
|
@ -115,7 +113,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
|
|||
|
||||
public function hasOldDataInformations(): bool
|
||||
{
|
||||
return ! empty($this->extra['d']);
|
||||
return !empty($this->extra['d']);
|
||||
}
|
||||
|
||||
public function getOldData(): array
|
||||
|
|
|
@ -61,8 +61,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* The class name of the exception that caused this log entry.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExceptionClass(): string
|
||||
{
|
||||
|
@ -71,8 +69,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Returns the file where the exception happened.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFile(): string
|
||||
{
|
||||
|
@ -81,8 +77,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Returns the line where the exception happened.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLine(): int
|
||||
{
|
||||
|
@ -91,8 +85,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Return the message of the exception.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
|
|
|
@ -53,8 +53,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Get the old instock.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOldInstock(): int
|
||||
{
|
||||
|
@ -63,8 +61,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Get the new instock.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNewInstock(): int
|
||||
{
|
||||
|
@ -73,8 +69,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Gets the comment associated with the instock change.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getComment(): string
|
||||
{
|
||||
|
@ -85,8 +79,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
|||
* Returns the price that has to be payed for the change (in the base currency).
|
||||
*
|
||||
* @param bool $absolute Set this to true, if you want only get the absolute value of the price (without minus)
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice(bool $absolute = false): float
|
||||
{
|
||||
|
@ -100,9 +92,9 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
|||
/**
|
||||
* Returns the difference value of the change ($new_instock - $old_instock).
|
||||
*
|
||||
* @param bool $absolute Set this to true if you want only the absolute value of the difference.
|
||||
* @param bool $absolute set this to true if you want only the absolute value of the difference
|
||||
*
|
||||
* @return int Difference is positive if instock has increased, negative if decreased.
|
||||
* @return int difference is positive if instock has increased, negative if decreased
|
||||
*/
|
||||
public function getDifference(bool $absolute = false): int
|
||||
{
|
||||
|
@ -122,7 +114,7 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
|||
/**
|
||||
* Checks if the Change was an withdrawal of parts.
|
||||
*
|
||||
* @return bool True if the change was an withdrawal, false if not.
|
||||
* @return bool true if the change was an withdrawal, false if not
|
||||
*/
|
||||
public function isWithdrawal(): bool
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
|
||||
public function setTargetElement(?AbstractDBElement $element): AbstractLogEntry
|
||||
{
|
||||
if (! $element instanceof User) {
|
||||
if (!$element instanceof User) {
|
||||
throw new \InvalidArgumentException('Target element must be a User object!');
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,6 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Return what event this log entry represents (e.g. password_reset).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEventType(): string
|
||||
{
|
||||
|
@ -104,8 +102,6 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -115,7 +111,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
*
|
||||
* @param string $ip The IP address used to login the user.
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -63,8 +63,6 @@ class UserLoginLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -74,7 +72,7 @@ class UserLoginLogEntry extends AbstractLogEntry
|
|||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
*
|
||||
* @param string $ip The IP address used to login the user.
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -61,8 +61,6 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -72,7 +70,7 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
|||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
*
|
||||
* @param string $ip The IP address used to login the user.
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -61,8 +61,6 @@ class UserNotAllowedLogEntry extends AbstractLogEntry
|
|||
|
||||
/**
|
||||
* Returns the path the user tried to accessed and what was denied.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath(): string
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
protected $symbol = '';
|
||||
|
||||
/**
|
||||
* @var float|null The guaranteed minimum value of this property.
|
||||
* @var float|null the guaranteed minimum value of this property
|
||||
* @Assert\Type({"float","null"})
|
||||
* @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical")
|
||||
* @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max")
|
||||
|
@ -73,14 +73,14 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
protected $value_min;
|
||||
|
||||
/**
|
||||
* @var float|null The typical value of this property.
|
||||
* @var float|null the typical value of this property
|
||||
* @Assert\Type({"null", "float"})
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
*/
|
||||
protected $value_typical;
|
||||
|
||||
/**
|
||||
* @var float|null The maximum value of this property.
|
||||
* @var float|null the maximum value of this property
|
||||
* @Assert\Type({"float", "null"})
|
||||
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
|
@ -95,13 +95,13 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
protected $unit = '';
|
||||
|
||||
/**
|
||||
* @var string A text value for the given property.
|
||||
* @var string a text value for the given property
|
||||
* @ORM\Column(type="string", nullable=false)
|
||||
*/
|
||||
protected $value_text = '';
|
||||
|
||||
/**
|
||||
* @var string The group this parameter belongs to.
|
||||
* @var string the group this parameter belongs to
|
||||
* @ORM\Column(type="string", nullable=false, name="param_group")
|
||||
*/
|
||||
protected $group = '';
|
||||
|
@ -109,7 +109,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
/**
|
||||
* Mapping is done in sub classes.
|
||||
*
|
||||
* @var AbstractDBElement|null The element to which this parameter belongs to.
|
||||
* @var AbstractDBElement|null the element to which this parameter belongs to
|
||||
*/
|
||||
protected $element;
|
||||
|
||||
|
@ -130,8 +130,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the element this parameter belongs to.
|
||||
*
|
||||
* @return AbstractDBElement|null
|
||||
*/
|
||||
public function getElement(): ?AbstractDBElement
|
||||
{
|
||||
|
@ -141,8 +139,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
/**
|
||||
* Return a formatted string version of the values of the string.
|
||||
* Based on the set values it can return something like this: 34 V (12 V ... 50 V) [Text].
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormattedValue(): string
|
||||
{
|
||||
|
@ -188,7 +184,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
*/
|
||||
public function setElement(AbstractDBElement $element): self
|
||||
{
|
||||
if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
||||
}
|
||||
|
||||
|
@ -211,8 +207,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the name of the group this parameter is associated to (e.g. Technical Parameters).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGroup(): string
|
||||
{
|
||||
|
@ -233,8 +227,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the mathematical symbol for this specification (e.g. "V_CB").
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSymbol(): string
|
||||
{
|
||||
|
@ -255,8 +247,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns The guaranteed minimum value of this property.
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getValueMin(): ?float
|
||||
{
|
||||
|
@ -277,8 +267,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the typical value of this property.
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getValueTypical(): ?float
|
||||
{
|
||||
|
@ -287,8 +275,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Return a formatted version with the minimum value with the unit of this parameter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueTypicalWithUnit(): string
|
||||
{
|
||||
|
@ -297,8 +283,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Return a formatted version with the maximum value with the unit of this parameter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueMaxWithUnit(): string
|
||||
{
|
||||
|
@ -307,8 +291,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Return a formatted version with the typical value with the unit of this parameter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueMinWithUnit(): string
|
||||
{
|
||||
|
@ -331,8 +313,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the guaranteed maximum value.
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getValueMax(): ?float
|
||||
{
|
||||
|
@ -353,8 +333,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the unit used by the value (e.g. "V").
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUnit(): string
|
||||
{
|
||||
|
@ -375,8 +353,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Returns the text value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValueText(): string
|
||||
{
|
||||
|
@ -397,13 +373,11 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
|
||||
/**
|
||||
* Return a string representation and (if possible) with its unit.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function formatWithUnit(float $value, string $format = '%g'): string
|
||||
{
|
||||
$str = \sprintf($format, $value);
|
||||
if (! empty($this->unit)) {
|
||||
if (!empty($this->unit)) {
|
||||
return $str.' '.$this->unit;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ trait ParametersTrait
|
|||
/**
|
||||
* Return all associated specifications.
|
||||
*
|
||||
* @return Collection
|
||||
*
|
||||
* @psalm-return Collection<int, PartParameter>
|
||||
*/
|
||||
public function getParameters(): \Doctrine\Common\Collections\Collection
|
||||
|
|
|
@ -111,7 +111,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parameters;
|
||||
|
||||
|
||||
public function getPartnameHint(): string
|
||||
{
|
||||
return $this->partname_hint;
|
||||
|
|
|
@ -99,7 +99,6 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parameters;
|
||||
|
||||
|
||||
/****************************************
|
||||
* Getters
|
||||
****************************************/
|
||||
|
|
|
@ -109,7 +109,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
protected $parameters;
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -176,7 +176,6 @@ class Part extends AttachmentContainingDBElement
|
|||
parent::__clone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all devices which uses this part.
|
||||
*
|
||||
|
|
|
@ -73,7 +73,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
protected $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment stored with this lot.
|
||||
* @var string a comment stored with this lot
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
protected $comment = '';
|
||||
|
@ -107,7 +107,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
protected $amount = 0;
|
||||
|
||||
/**
|
||||
* @var bool Determines if this lot was manually marked for refilling.
|
||||
* @var bool determines if this lot was manually marked for refilling
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $needs_refill = false;
|
||||
|
@ -128,7 +128,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
parent::__clone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current part lot is expired.
|
||||
* This is the case, if the expiration date is greater the the current date.
|
||||
|
@ -149,8 +148,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Gets the description of the part lot. Similar to a "name" of the part lot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
|
@ -171,8 +168,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Gets the comment for this part lot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getComment(): string
|
||||
{
|
||||
|
@ -193,8 +188,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Gets the expiration date for the part lot. Returns null, if no expiration date was set.
|
||||
*
|
||||
* @return DateTime|null
|
||||
*/
|
||||
public function getExpirationDate(): ?DateTime
|
||||
{
|
||||
|
@ -239,8 +232,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Return the part that is stored in this part lot.
|
||||
*
|
||||
* @return Part
|
||||
*/
|
||||
public function getPart(): Part
|
||||
{
|
||||
|
@ -261,8 +252,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Checks if the instock value in the part lot is unknown.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isInstockUnknown(): bool
|
||||
{
|
||||
|
@ -281,12 +270,9 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getAmount(): float
|
||||
{
|
||||
if ($this->part instanceof Part && ! $this->part->useFloatAmount()) {
|
||||
if ($this->part instanceof Part && !$this->part->useFloatAmount()) {
|
||||
return round($this->amount);
|
||||
}
|
||||
|
||||
|
@ -312,9 +298,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNeedsRefill(): bool
|
||||
{
|
||||
return $this->needs_refill;
|
||||
|
|
|
@ -162,7 +162,7 @@ trait InstockTrait
|
|||
public function useFloatAmount(): bool
|
||||
{
|
||||
if ($this->partUnit instanceof MeasurementUnit) {
|
||||
return ! $this->partUnit->isInteger();
|
||||
return !$this->partUnit->isInteger();
|
||||
}
|
||||
|
||||
//When no part unit is set, treat it as part count, and so use the integer value.
|
||||
|
|
|
@ -213,7 +213,7 @@ trait OrderTrait
|
|||
}
|
||||
|
||||
foreach ($all_orderdetails as $orderdetails) {
|
||||
if (! $orderdetails->getObsolete()) {
|
||||
if (!$orderdetails->getObsolete()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,8 +136,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
|
||||
/**
|
||||
* When this property is set, only one part (but many instock) is allowed to be stored in this store location.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOnlySinglePart(): bool
|
||||
{
|
||||
|
@ -156,8 +154,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
|
||||
/**
|
||||
* When this property is set, it is only possible to increase the instock of parts, that are already stored here.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isLimitToExistingParts(): bool
|
||||
{
|
||||
|
@ -174,9 +170,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MeasurementUnit|null
|
||||
*/
|
||||
public function getStorageType(): ?MeasurementUnit
|
||||
{
|
||||
return $this->storage_type;
|
||||
|
|
|
@ -57,7 +57,6 @@ use App\Entity\PriceInformations\Currency;
|
|||
use App\Validator\Constraints\BigDecimal\BigDecimalPositiveOrZero;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Brick\Math\BigDecimal;
|
||||
use Brick\Math\BigNumber;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
@ -120,8 +119,6 @@ class Supplier extends AbstractCompany
|
|||
|
||||
/**
|
||||
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
||||
*
|
||||
* @return Currency|null
|
||||
*/
|
||||
public function getDefaultCurrency(): ?Currency
|
||||
{
|
||||
|
@ -159,7 +156,7 @@ class Supplier extends AbstractCompany
|
|||
*/
|
||||
public function setShippingCosts(?BigDecimal $shipping_costs): self
|
||||
{
|
||||
if ($shipping_costs === null) {
|
||||
if (null === $shipping_costs) {
|
||||
$this->shipping_costs = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ use Brick\Math\RoundingMode;
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use DoctrineExtensions\Query\Mysql\Round;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
@ -68,7 +67,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
|
||||
/**
|
||||
* @var BigDecimal|null The exchange rate between this currency and the base currency
|
||||
* (how many base units the current currency is worth)
|
||||
* (how many base units the current currency is worth)
|
||||
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
|
||||
* @BigDecimalPositive()
|
||||
*/
|
||||
|
@ -119,9 +118,6 @@ class Currency extends AbstractStructuralDBElement
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPricedetails(): Collection
|
||||
{
|
||||
return $this->pricedetails;
|
||||
|
@ -176,13 +172,13 @@ class Currency extends AbstractStructuralDBElement
|
|||
* Sets the exchange rate of the currency.
|
||||
*
|
||||
* @param BigDecimal|null $exchange_rate The new exchange rate of the currency.
|
||||
* Set to null, if the exchange rate is unknown.
|
||||
* Set to null, if the exchange rate is unknown.
|
||||
*
|
||||
* @return Currency
|
||||
*/
|
||||
public function setExchangeRate(?BigDecimal $exchange_rate): self
|
||||
{
|
||||
if ($exchange_rate === null) {
|
||||
if (null === $exchange_rate) {
|
||||
$this->exchange_rate = null;
|
||||
}
|
||||
$tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP);
|
||||
|
|
|
@ -209,7 +209,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*/
|
||||
public function getPriceRelatedQuantity(): float
|
||||
{
|
||||
if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) {
|
||||
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->price_related_quantity);
|
||||
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
|
@ -232,7 +232,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*/
|
||||
public function getMinDiscountQuantity(): float
|
||||
{
|
||||
if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) {
|
||||
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->min_discount_quantity);
|
||||
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
|
@ -299,6 +299,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
if ((string) $tmp !== (string) $this->price) {
|
||||
$this->price = $tmp;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
*/
|
||||
protected $parameters;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
@ -113,8 +112,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
|
||||
/**
|
||||
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnforce2FA(): bool
|
||||
{
|
||||
|
@ -124,7 +121,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
/**
|
||||
* Sets if the user of this group are enforced to have two factor authentification enabled.
|
||||
*
|
||||
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
|
||||
* @param bool $enforce2FA true, if the users of this group are enforced to have 2FA enabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -340,7 +340,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
public function getBitValue(string $permission_name, int $bit_n): int
|
||||
{
|
||||
if (! $this->isValidPermissionName($permission_name)) {
|
||||
if (!$this->isValidPermissionName($permission_name)) {
|
||||
throw new InvalidArgumentException(sprintf('No permission with the name "%s" is existing!', $permission_name));
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
public function setBitValue(string $permission_name, int $bit_n, int $new_value): self
|
||||
{
|
||||
if (! $this->isValidPermissionName($permission_name)) {
|
||||
if (!$this->isValidPermissionName($permission_name)) {
|
||||
throw new InvalidArgumentException('No permission with the given name is existing!');
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
public function getRawPermissionValue(string $permission_name): int
|
||||
{
|
||||
if (! $this->isValidPermissionName($permission_name)) {
|
||||
if (!$this->isValidPermissionName($permission_name)) {
|
||||
throw new InvalidArgumentException('No permission with the given name is existing!');
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
public function setRawPermissionValue(string $permission_name, int $value): self
|
||||
{
|
||||
if (! $this->isValidPermissionName($permission_name)) {
|
||||
if (!$this->isValidPermissionName($permission_name)) {
|
||||
throw new InvalidArgumentException(sprintf('No permission with the given name %s is existing!', $permission_name));
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ class PermissionsEmbed
|
|||
*/
|
||||
public function setRawPermissionValues(array $values, ?array $values2 = null): self
|
||||
{
|
||||
if (! empty($values2)) {
|
||||
if (!empty($values2)) {
|
||||
$values = array_combine($values, $values2);
|
||||
}
|
||||
|
||||
|
@ -493,6 +493,7 @@ class PermissionsEmbed
|
|||
}
|
||||
|
||||
$mask = 0b11 << $n; //Create a mask for the data
|
||||
|
||||
return ($data & $mask) >> $n; //Apply mask and shift back
|
||||
}
|
||||
|
||||
|
|
|
@ -180,8 +180,6 @@ class U2FKey implements TwoFactorKeyInterface
|
|||
|
||||
/**
|
||||
* Gets the user, this U2F key belongs to.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function getUser(): User
|
||||
{
|
||||
|
@ -190,8 +188,6 @@ class U2FKey implements TwoFactorKeyInterface
|
|||
|
||||
/**
|
||||
* The primary key ID of this key.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getID(): int
|
||||
{
|
||||
|
|
|
@ -110,7 +110,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected $theme = '';
|
||||
|
||||
/**
|
||||
* @var string|null The hash of a token the user must provide when he wants to reset his password.
|
||||
* @var string|null the hash of a token the user must provide when he wants to reset his password
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $pw_reset_token;
|
||||
|
@ -261,7 +261,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected $permissions;
|
||||
|
||||
/**
|
||||
* @var DateTime The time until the password reset token is valid.
|
||||
* @var DateTime the time until the password reset token is valid
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
protected $pw_reset_expires;
|
||||
|
@ -367,7 +367,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Gets the currency the user prefers when showing him prices.
|
||||
*
|
||||
* @return Currency|null The currency the user prefers, or null if the global currency should be used.
|
||||
* @return Currency|null the currency the user prefers, or null if the global currency should be used
|
||||
*/
|
||||
public function getCurrency(): ?Currency
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Checks if this user is disabled (user cannot login any more).
|
||||
*
|
||||
* @return bool True, if the user is disabled.
|
||||
* @return bool true, if the user is disabled
|
||||
*/
|
||||
public function isDisabled(): bool
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Sets the status if a user is disabled.
|
||||
*
|
||||
* @param bool $disabled True if the user should be disabled.
|
||||
* @param bool $disabled true if the user should be disabled
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
|
@ -410,7 +410,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getPermissions(): PermissionsEmbed
|
||||
{
|
||||
return $this->permissions;
|
||||
|
@ -418,8 +417,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Check if the user needs a password change.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isNeedPwChange(): bool
|
||||
{
|
||||
|
@ -440,8 +437,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Returns the encrypted password reset token.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPwResetToken(): ?string
|
||||
{
|
||||
|
@ -462,8 +457,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Gets the datetime when the password reset token expires.
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getPwResetExpires(): DateTime
|
||||
{
|
||||
|
@ -498,7 +491,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
{
|
||||
$tmp = $this->getFirstName();
|
||||
//Dont add a space, if the name has only one part (it would look strange)
|
||||
if (! empty($this->getFirstName()) && ! empty($this->getLastName())) {
|
||||
if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
|
||||
$tmp .= ' ';
|
||||
}
|
||||
$tmp .= $this->getLastName();
|
||||
|
@ -513,14 +506,14 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the username of this user.
|
||||
*
|
||||
* @param string $new_name The new username.
|
||||
* @param string $new_name the new username
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName(string $new_name): AbstractNamedDBElement
|
||||
{
|
||||
// Anonymous user is not allowed to change its username
|
||||
if (! $this->isAnonymousUser()) {
|
||||
if (!$this->isAnonymousUser()) {
|
||||
$this->name = $new_name;
|
||||
}
|
||||
|
||||
|
@ -529,8 +522,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Get the first name of the user.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFirstName(): ?string
|
||||
{
|
||||
|
@ -553,8 +544,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Get the last name of the user.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastName(): ?string
|
||||
{
|
||||
|
@ -675,7 +664,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
|
||||
*
|
||||
* @return string|null The name of the theme the user wants to see, or null if the system wide should be used.
|
||||
* @return string|null the name of the theme the user wants to see, or null if the system wide should be used
|
||||
*/
|
||||
public function getTheme(): ?string
|
||||
{
|
||||
|
@ -723,8 +712,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Return true if the user should do two-factor authentication.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isGoogleAuthenticatorEnabled(): bool
|
||||
{
|
||||
|
@ -733,8 +720,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Return the user name that should be shown in Google Authenticator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGoogleAuthenticatorUsername(): string
|
||||
{
|
||||
|
@ -744,8 +729,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Return the Google Authenticator secret
|
||||
* When an empty string is returned, the Google authentication is disabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getGoogleAuthenticatorSecret(): ?string
|
||||
{
|
||||
|
@ -767,9 +750,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Check if the given code is a valid backup code.
|
||||
*
|
||||
* @param string $code The code that should be checked.
|
||||
* @param string $code the code that should be checked
|
||||
*
|
||||
* @return bool True if the backup code is valid.
|
||||
* @return bool true if the backup code is valid
|
||||
*/
|
||||
public function isBackupCode(string $code): bool
|
||||
{
|
||||
|
@ -822,8 +805,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Return the date when the backup codes were generated.
|
||||
*
|
||||
* @return DateTime|null
|
||||
*/
|
||||
public function getBackupCodesGenerationDate(): ?DateTime
|
||||
{
|
||||
|
@ -851,8 +832,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Check if U2F is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isU2FAuthEnabled(): bool
|
||||
{
|
||||
|
@ -862,8 +841,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Get all U2F Keys that are associated with this user.
|
||||
*
|
||||
* @return Collection
|
||||
*
|
||||
* @psalm-return Collection<int, TwoFactorKeyInterface>
|
||||
*/
|
||||
public function getU2FKeys(): Collection
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue