SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/Locales/LocaleInfoNZL.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13.  
  14. namespace Sprout\Helpers\Locales;
  15.  
  16. use Sprout\Helpers\Validator;
  17.  
  18.  
  19. /**
  20.  * Locale info for New Zealand; see {@see LocaleInfo}
  21.  */
  22. class LocaleInfoNZL extends LocaleInfo
  23. {
  24. protected $state_name = 'Town';
  25.  
  26. protected $town_name = 'Suburb';
  27.  
  28. protected $postcode_name = 'Postcode';
  29.  
  30.  
  31. /**
  32.   * Validate address fields
  33.   *
  34.   * @param Validator $valid Validator for the form being processed
  35.   * @param bool $required Are the address fields required?
  36.   * @return void
  37.   */
  38. public function validateAddress(Validator $valid, $required = false)
  39. {
  40. parent::validateAddress($valid, $required);
  41.  
  42. $valid->check('postcode', 'Validity::positiveInt');
  43. $valid->check('postcode', 'Validity::length', 4, 4);
  44. }
  45.  
  46. }
  47.  
  48.  
  49.