Fixed coding style.

This commit is contained in:
Jan Böhmer 2020-03-15 13:56:31 +01:00
parent 24939f2342
commit fd61c8d9e2
129 changed files with 962 additions and 1091 deletions

View file

@ -71,7 +71,6 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
}
/**
* @inheritDoc
* @return $this
*/
public function setTargetElement(?AbstractDBElement $element): AbstractLogEntry
@ -80,12 +79,14 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
if ($element instanceof NamedElementInterface) {
$this->setOldName($element->getName());
}
return $this;
}
public function setOldName(string $old_name): self
{
$this->extra['n'] = $old_name;
return $this;
}
@ -96,82 +97,60 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
/**
* Sets the old data for this entry.
* @param array $old_data
*
* @return $this
*/
public function setOldData(array $old_data): self
{
$this->extra['o'] = $old_data;
return $this;
}
/**
* @inheritDoc
*/
public function hasOldDataInformations(): bool
{
return !empty($this->extra['o']);
return ! empty($this->extra['o']);
}
/**
* @inheritDoc
*/
public function getOldData(): array
{
return $this->extra['o'] ?? [];
}
/**
* @inheritDoc
*/
public function hasComment(): bool
{
return isset($this->extra['m']);
}
/**
* @inheritDoc
*/
public function getComment(): ?string
{
return $this->extra['m'] ?? null;
}
/**
* @inheritDoc
*/
public function setComment(?string $new_comment): LogWithCommentInterface
{
$this->extra['m'] = $new_comment;
return $this;
}
/**
* @inheritDoc
*/
public function isUndoEvent(): bool
{
return isset($this->extra['u']);
}
/**
* @inheritDoc
*/
public function getUndoEventID(): ?int
{
return $this->extra['u'] ?? null;
}
/**
* @inheritDoc
*/
public function setUndoneEvent(AbstractLogEntry $event, string $mode = 'undo'): LogWithEventUndoInterface
{
$this->extra['u'] = $event->getID();
if ($mode === 'undo') {
if ('undo' === $mode) {
$this->extra['um'] = 1;
} elseif ($mode === 'revert') {
} elseif ('revert' === $mode) {
$this->extra['um'] = 2;
} else {
throw new \InvalidArgumentException('Passed invalid $mode!');
@ -180,15 +159,13 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
return $this;
}
/**
* @inheritDoc
*/
public function getUndoMode(): string
{
$mode_int = $this->extra['um'] ?? 1;
if ($mode_int === 1) {
if (1 === $mode_int) {
return 'undo';
}
return 'revert';
}
}