transactionSetIdentifierCode = $idCode; } public function setTransactionSetIdentifierCode(int $idCode) { if ($idCode < 100 || $idCode > 999) { throw new \Exception(); } $this->transactionSetIdentifierCode = $idCode; } public function getTransactionSetIdentifierCode() : int { return $this->transactionSetIdentifierCode; } public function setTransactionSetControlNumber(string $controlNumber) { if (strlen($controlNumber) < 4 || strlen($controlNumber) > 9) { throw new \Exception(); } $this->transactionSetControlNumber = $controlNumber; } public function getTransactionSetControlNumber() : string { return str_pad((string) $this->transactionSetControlNumber, 9, '0', STR_PAD_LEFT); } public function serialize() { return self::IDENTIFIER . '*' . $this->getTransactionSetIdentifierCode() . '*' . $this->getTransactionSetControlNumber() . '*' . self::COMPONENT_ELEMENT_SEPARATOR; } public function unserialize($raw) { $split = explode('*', $raw); $this->setTransactionSetIdentifierCode((int) $split[1]); $this->setTransactionSetControlNumber(substr($split[2], -1)); } }