Exemplo n.º 1
0
 private static function initialize()
 {
     if (self::$initialized) {
         return;
     }
     self::$initialized = true;
 }
Exemplo n.º 2
0
 public function get_state_data($year, $state_abbr)
 {
     $state = StateConstants::abbreviation_to_full_name($state_abbr);
     $response = array();
     if (!in_array($year, $this->supported_years)) {
         $response['success'] = false;
         $response['reason'] = "Invalid year";
     } else {
         if ($state === false) {
             $response['success'] = false;
             $response['reason'] = "Invalid state";
         } else {
             $state = strtolower(StateConstants::abbreviation_to_full_name($state_abbr));
             $state = str_replace(" ", "_", $state);
             $handle = file_get_contents(CDN_URL . "tax_tables/" . $year . "/" . $state . ".json", "r");
             $tax_table = json_decode($handle);
             $response['success'] = true;
             $response['data'] = $tax_table;
         }
     }
     return $response;
 }