DHL-PHP-SDK  v0.4
A wrapper for the DHL-XML-API Version 2
Version.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Petschko\DHL;
4 
14 use stdClass;
15 
21 abstract class Version {
27  private $version;
28 
34  private $mayor;
35 
41  private $minor;
42 
48  protected function __construct($version) {
49  $this->setVersion($version);
50  }
51 
55  protected function __destruct() {
56  unset($this->version);
57  unset($this->mayor);
58  unset($this->minor);
59  }
60 
66  public function getVersion() {
67  return $this->version;
68  }
69 
75  protected function setVersion($version) {
76  $this->version = $version;
77 
78  $numbers = explode('.', $version);
79 
80  // Update Mayor and Minor-Version-Numbers
81  $this->setMayor((int) $numbers[0]);
82  $this->setMinor((int) $numbers[1]);
83  }
84 
90  public function getMayor() {
91  return $this->mayor;
92  }
93 
99  private function setMayor($mayor) {
100  $this->mayor = $mayor;
101  }
102 
108  public function getMinor() {
109  return $this->minor;
110  }
111 
117  private function setMinor($minor) {
118  $this->minor = $minor;
119  }
120 
126  protected function getVersionClass() {
127  $class = new StdClass;
128 
129  $class->majorRelease = $this->getMayor();
130  $class->minorRelease = $this->getMinor();
131 
132  return $class;
133  }
134 }
__construct($version)
Definition: Version.php:48
setVersion($version)
Definition: Version.php:75