Удалена поддержка base_name в документе коррекции (#5)

pull/10/head
Anthony Axenov 2021-11-20 23:46:39 +08:00
parent e1120051c1
commit b35b9bfa87
1 changed files with 22 additions and 59 deletions

View File

@ -20,46 +20,34 @@ class CorrectionInfo extends Entity
* @var string Тип коррекции. Тег ФФД - 1173. * @var string Тип коррекции. Тег ФФД - 1173.
*/ */
protected string $type; protected string $type;
/** /**
* @var string Дата документа основания для коррекции. Тег ФФД - 1178. * @var string Дата документа основания для коррекции. Тег ФФД - 1178.
*/ */
protected string $base_date; protected string $base_date;
/** /**
* @var string Номер документа основания для коррекции. Тег ФФД - 1179. * @var string Номер документа основания для коррекции. Тег ФФД - 1179.
*/ */
protected string $base_number; protected string $base_number;
/**
* @var string Описание коррекции. Тег ФФД - 1177.
*/
protected string $base_name;
/** /**
* CorrectionInfo constructor. * CorrectionInfo constructor.
* *
* @param string|null $type Тип коррекции * @param string|null $type Тип коррекции
* @param string|null $base_date Дата документа * @param string|null $base_date Дата документа
* @param string|null $base_number Номер документа * @param string|null $base_number Номер документа
* @param string|null $base_name Описание коррекции
*/ */
public function __construct(?string $type = null, ?string $base_date = null, ?string $base_number = null, ?string $base_name = null) public function __construct(
{ ?string $type = null,
if ($type) { ?string $base_date = null,
$this->setType($type); ?string $base_number = null
} ) {
if ($base_date) { $type && $this->setType($type);
$this->setDate($base_date); $base_date && $this->setDate($base_date);
} $base_number && $this->setNumber($base_number);
if ($base_number) {
$this->setNumber($base_number);
}
if ($base_name) {
$this->setName($base_name);
}
} }
/** /**
* Возвращает номер документа основания для коррекции. * Возвращает номер документа основания для коррекции.
* Тег ФФД - 1179. * Тег ФФД - 1179.
@ -70,7 +58,7 @@ class CorrectionInfo extends Entity
{ {
return $this->base_number; return $this->base_number;
} }
/** /**
* Устанавливает номер документа основания для коррекции. * Устанавливает номер документа основания для коррекции.
* Тег ФФД - 1179. * Тег ФФД - 1179.
@ -83,31 +71,7 @@ class CorrectionInfo extends Entity
$this->base_number = trim($number); $this->base_number = trim($number);
return $this; return $this;
} }
/**
* Возвращает описание коррекции.
* Тег ФФД - 1177.
*
* @return string|null
*/
public function getName(): ?string
{
return $this->base_name;
}
/**
* Устанавливает описание коррекции.
* Тег ФФД - 1177.
*
* @param string $name
* @return $this
*/
public function setName(string $name): CorrectionInfo
{
$this->base_name = trim($name);
return $this;
}
/** /**
* Возвращает дату документа основания для коррекции. * Возвращает дату документа основания для коррекции.
* Тег ФФД - 1178. * Тег ФФД - 1178.
@ -118,7 +82,7 @@ class CorrectionInfo extends Entity
{ {
return $this->base_date; return $this->base_date;
} }
/** /**
* Устанавливает дату документа основания для коррекции. * Устанавливает дату документа основания для коррекции.
* Тег ФФД - 1178. * Тег ФФД - 1178.
@ -131,7 +95,7 @@ class CorrectionInfo extends Entity
$this->base_date = $date; $this->base_date = $date;
return $this; return $this;
} }
/** /**
* Возвращает тип коррекции. * Возвращает тип коррекции.
* Тег ФФД - 1173. * Тег ФФД - 1173.
@ -142,7 +106,7 @@ class CorrectionInfo extends Entity
{ {
return $this->type; return $this->type;
} }
/** /**
* Устанавливает тип коррекции. * Устанавливает тип коррекции.
* Тег ФФД - 1173. * Тег ФФД - 1173.
@ -155,17 +119,16 @@ class CorrectionInfo extends Entity
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function jsonSerialize() public function jsonSerialize(): object
{ {
return [ return (object)[
'type' => $this->getType() ?? '', // обязателен 'type' => $this->getType() ?? '', // обязателен
'base_date' => $this->getDate() ?? '', // обязателен 'base_date' => $this->getDate() ?? '', // обязателен
'base_number' => $this->getNumber() ?? '', // обязателен 'base_number' => $this->getNumber() ?? '', // обязателен
'base_name' => $this->getName() ?? '' // не обязателен
]; ];
} }
} }