1 | <?php |
||
21 | class TrackingCode implements \JsonSerializable { |
||
22 | /** |
||
23 | * Code. |
||
24 | * |
||
25 | * Your Unique Transaction Reference. Minimum length: 8 characters. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $code; |
||
30 | |||
31 | /** |
||
32 | * Construct and initialize tracking code. |
||
33 | * |
||
34 | * @param string $code Code. |
||
35 | * @return void |
||
|
|||
36 | * @throws \InvalidArgumentException Throws exception if length of code is less than 8 characters. |
||
37 | */ |
||
38 | 3 | public function __construct( $code ) { |
|
45 | |||
46 | /** |
||
47 | * From ID. |
||
48 | * |
||
49 | * @param string|int $id ID. |
||
50 | * @return self |
||
51 | */ |
||
52 | 2 | public static function from_id( $id ) { |
|
55 | |||
56 | /** |
||
57 | * JSON serialize. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 2 | public function jsonSerialize() { |
|
64 | |||
65 | /** |
||
66 | * To string. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 2 | public function __toString() { |
|
73 | } |
||
74 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.