Overview

Namespaces

  • malkusch
    • bav
  • PHP

Classes

  • Agency
  • AutomaticUpdatePlan
  • BAV
  • Configuration
  • ConfigurationRegistry
  • DataBackendContainer
  • DefaultConfiguration
  • DoctrineBackendContainer
  • FileDataBackendContainer
  • LogUpdatePlan
  • PDODataBackendContainer
  • UpdatePlan
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace malkusch\bav;
  4: 
  5: /**
  6:  * The bank agency.
  7:  * 
  8:  * Every bank has one main agency and may have some more agencies
  9:  * in different cities.
 10:  *
 11:  * @author Markus Malkusch <markus@malkusch.de>
 12:  * @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations
 13:  * @license GPL
 14:  * @see BAV::getAgencies()
 15:  * @see BAV::getBICAgencies()
 16:  * @see BAV::getMainAgency()
 17:  * @api
 18:  */
 19: class Agency
 20: {
 21: 
 22:     /**
 23:      * @var int
 24:      */
 25:     private $id = 0;
 26: 
 27:     /**
 28:      * @var Bank
 29:      */
 30:     private $bank;
 31: 
 32:     /**
 33:      * @var string
 34:      */
 35:     private $bic = '';
 36: 
 37:     /**
 38:      * @var string
 39:      */
 40:     private $city = '';
 41: 
 42:     /**
 43:      * @var string
 44:      */
 45:     private $pan = '';
 46: 
 47:     /**
 48:      * @var string
 49:      */
 50:     private $postcode = '';
 51: 
 52:     /**
 53:      * @var string
 54:      */
 55:     private $shortTerm = '';
 56: 
 57:     /**
 58:      * @var string
 59:      */
 60:     private $name = '';
 61: 
 62:     /**
 63:      * Don't create this object directly.
 64:      *
 65:      * @param int $id
 66:      * @param string $name
 67:      * @param string $shortTerm
 68:      * @param string $city
 69:      * @param string $postcode
 70:      * @param string $bic might be empty
 71:      * @param string $pan might be empty
 72:      * @internal
 73:      * @see BAV::getAgencies()
 74:      * @see BAV::getMainAgency()
 75:      * @see BAV::getBICAgencies()
 76:      */
 77:     public function __construct($id, Bank $bank, $name, $shortTerm, $city, $postcode, $bic = '', $pan = '')
 78:     {
 79:         $this->id           = (int)$id;
 80:         $this->bank         = $bank;
 81:         $this->bic          = $bic;
 82:         $this->postcode     = $postcode;
 83:         $this->city         = $city;
 84:         $this->name         = $name;
 85:         $this->shortTerm    = $shortTerm;
 86:         $this->pan          = $pan;
 87:     }
 88: 
 89:     /**
 90:      * @return bool
 91:      */
 92:     public function isMainAgency()
 93:     {
 94:         return $this->bank->getMainAgency() === $this;
 95:     }
 96: 
 97:     /**
 98:      * @return Bank
 99:      */
100:     public function getBank()
101:     {
102:         return $this->bank;
103:     }
104: 
105:     /**
106:      * @return int
107:      */
108:     public function getID()
109:     {
110:         return $this->id;
111:     }
112: 
113:     /**
114:      * @return string
115:      */
116:     public function getPostcode()
117:     {
118:         return $this->postcode;
119:     }
120: 
121:     /**
122:      * @return string
123:      */
124:     public function getCity()
125:     {
126:         return $this->city;
127:     }
128: 
129:     /**
130:      * @return string
131:      */
132:     public function getName()
133:     {
134:         return $this->name;
135:     }
136: 
137:     /**
138:      * @return string
139:      */
140:     public function getShortTerm()
141:     {
142:         return $this->shortTerm;
143:     }
144: 
145:     /**
146:      * @return bool
147:      */
148:     public function hasPAN()
149:     {
150:         return ! empty($this->pan);
151:     }
152: 
153:     /**
154:      * @return bool
155:      */
156:     public function hasBIC()
157:     {
158:         return ! empty($this->bic);
159:     }
160: 
161:     /**
162:      * @throws UndefinedAttributeAgencyException
163:      * @return string
164:      */
165:     public function getPAN()
166:     {
167:         if (! $this->hasPAN()) {
168:             throw new UndefinedAttributeAgencyException($this, 'pan');
169: 
170:         }
171:         return $this->pan;
172:     }
173: 
174:     /**
175:      * @throws UndefinedAttributeAgencyException
176:      * @return string
177:      */
178:     public function getBIC()
179:     {
180:         if (! $this->hasBIC()) {
181:             throw new UndefinedAttributeAgencyException($this, 'bic');
182: 
183:         }
184:         return $this->bic;
185:     }
186: }
187: 
API documentation generated by ApiGen 2.8.0