1 <?php
2 /* --------------------------------------------------------------
3 CustomerAddressInputValidator.inc.php 2015-02-18 gm
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 MainFactory::load_class('CustomerInputValidator');
13 MainFactory::load_class('CustomerAddressInputValidatorInterface');
14
15 /**
16 * Class CustomerAccountInputValidator
17 *
18 * This class is used for validating entered customer address data
19 *
20 * @category System
21 * @package Customer
22 * @subpackage Address
23 *
24 * @extends CustomerInputValidator
25 * @implements CustomerAddressInputValidatorInterface
26 */
27 class CustomerAddressInputValidator extends CustomerInputValidator
28 implements CustomerAddressInputValidatorInterface
29 {
30 /**
31 * Validates the entered customer address data based on a given array
32 *
33 * expects array with following keys:
34 * gender, company, firstname, lastname, street_address, suburb, postcode, city, country, state
35 *
36 * @param array $inputArray
37 *
38 * @return bool Returns the validation result (false indicates no validation error).
39 */
40 public function validateByArray(array $inputArray)
41 {
42 $this->validateGender($inputArray['gender']);
43 $this->validateCompany($inputArray['company']);
44 $this->validateFirstname($inputArray['firstname']);
45 $this->validateLastname($inputArray['lastname']);
46 $this->validateStreet($inputArray['street_address']);
47 $this->validateCountryZone($inputArray['state'], $inputArray['country']);
48 $this->validatePostcode($inputArray['postcode']);
49 $this->validateCity($inputArray['city']);
50 $this->validateCountry($inputArray['country']);
51 $this->validateSuburb($inputArray['suburb']);
52
53 return $this->getErrorStatus();
54 }
55 }
56