Source for file Usstate.php

Documentation is available at Usstate.php

  1. <?php
  2. /*
  3.  *  $Id: Usstate.php 1080 2007-02-10 18:17:08Z romanb $
  4.  *
  5.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16.  *
  17.  * This software consists of voluntary contributions made by many individuals
  18.  * and is licensed under the LGPL. For more information, see
  19.  * <http://www.phpdoctrine.com>.
  20.  */
  21.  
  22. /**
  23.  * Doctrine_Validator_Usstate
  24.  *
  25.  * @package     Doctrine
  26.  * @category    Object Relational Mapping
  27.  * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
  28.  * @link        www.phpdoctrine.com
  29.  * @since       1.0
  30.  * @version     $Revision: 1080 $
  31.  * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>
  32.  */
  33. {
  34.     private static $states array (
  35.                 "AK" =>    true,
  36.                 "AL" => true,
  37.                 "AR" => true,
  38.                 "AZ" => true,
  39.                 "CA" => true,
  40.                 "CO" => true,
  41.                 "CT" => true,
  42.                 "DC" => true,
  43.                 "DE" => true,
  44.                 "FL" => true,
  45.                 "GA" => true,
  46.                 "HI" => true,
  47.                 "IA" => true,
  48.                 "ID" => true,
  49.                 "IL" => true,
  50.                 "IN" => true,
  51.                 "KS" => true,
  52.                 "KY" => true,
  53.                 "LA" => true,
  54.                 "MA" => true,
  55.                 "MD" => true,
  56.                 "ME" => true,
  57.                 "MI" => true,
  58.                 "MN" => true,
  59.                 "MO" => true,
  60.                 "MS" => true,
  61.                 "MT" => true,
  62.                 "NC" => true,
  63.                 "ND" => true,
  64.                 "NE" => true,
  65.                 "NH" => true,
  66.                 "NJ" => true,
  67.                 "NM" => true,
  68.                 "NV" => true,
  69.                 "NY" => true,
  70.                 "OH" => true,
  71.                 "OK" => true,
  72.                 "OR" => true,
  73.                 "PA" => true,
  74.                 "PR" => true,
  75.                 "RI" => true,
  76.                 "SC" => true,
  77.                 "SD" => true,
  78.                 "TN" => true,
  79.                 "TX" => true,
  80.                 "UT" => true,
  81.                 "VA" => true,
  82.                 "VI" => true,
  83.                 "VT" => true,
  84.                 "WA" => true,
  85.                 "WI" => true,
  86.                 "WV" =>    true,
  87.                 "WY" =>    true
  88.             );
  89.     public function getStates()
  90.     {
  91.         return self::$states;
  92.     }
  93.     /**
  94.      * @param Doctrine_Record $record 
  95.      * @param string $key 
  96.      * @param mixed $value 
  97.      * @param string $args 
  98.      * @return boolean 
  99.      */
  100.     public function validate(Doctrine_Record $record$key$value$args)
  101.     {
  102.         return isset(self::$states[$value]);
  103.     }
  104. }