Skip to content

Commit 9a5536d

Browse files
authored
Reference Number Entity added
1 parent 11fa4a3 commit 9a5536d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/Entity/ReferenceNumber.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace RahulGodiyal\PhpUpsApiWrapper\Entity;
4+
5+
class ReferenceNumber
6+
{
7+
private string $code = "";
8+
private string $value = "";
9+
10+
public function exists()
11+
{
12+
if (!empty($this->value)) {
13+
return true;
14+
}
15+
16+
return false;
17+
}
18+
19+
public function setCode(string $code): self
20+
{
21+
$this->code = $code;
22+
return $this;
23+
}
24+
25+
public function getCode(): string
26+
{
27+
return $this->code;
28+
}
29+
30+
public function setValue(string $value): self
31+
{
32+
$this->value = $value;
33+
return $this;
34+
}
35+
36+
public function getValue(): string
37+
{
38+
return $this->value;
39+
}
40+
41+
public function toArray(): array
42+
{
43+
$referenceNumber = [
44+
"Value" => $this->value
45+
];
46+
47+
if ($this->code) {
48+
$referenceNumber["Code"] = $this->code;
49+
}
50+
51+
return $referenceNumber;
52+
}
53+
}

0 commit comments

Comments
 (0)