oxcompanyvatin.php

Go to the documentation of this file.
00001 <?php
00002 
00003 
00007 class oxCompanyVatIn
00008 {
00009 
00015     private $_sCompanyVatNumber;
00016 
00022     public function __construct($sCompanyVatNumber)
00023     {
00024         $this->_sCompanyVatNumber = $sCompanyVatNumber;
00025     }
00026 
00032     public function getCountryCode()
00033     {
00034         return (string) oxStr::getStr()->strtoupper(oxStr::getStr()->substr($this->_cleanUp($this->_sCompanyVatNumber), 0, 2));
00035     }
00036 
00042     public function getNumbers()
00043     {
00044         return (string) oxStr::getStr()->substr($this->_cleanUp($this->_sCompanyVatNumber), 2);
00045     }
00046 
00054     protected function _cleanUp($sValue)
00055     {
00056         return (string) oxStr::getStr()->preg_replace("/\s|-/", '', $sValue);
00057     }
00058 
00059 
00065     public function __toString()
00066     {
00067         return $this->_sCompanyVatNumber;
00068     }
00069 }