mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 03:08:51 +02:00
Fixed code style.
This commit is contained in:
parent
2853e471c4
commit
d0b1024d80
212 changed files with 495 additions and 1005 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue