123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace Core\App\Factory;
- class EntityFactory
- {
- public $prefix;
- const UM = 'BUC';
-
- public function stripSpecialChars($string)
- {
- $string = str_replace(array("\n", "\r", " "), array('', '', ''), $string);
- $string = preg_replace('/[%&\'"]/', '', $string);
- $string = html_entity_decode($string, ENT_COMPAT, 'UTF-8');
- //$string = preg_replace( '/[^[:print:]]/', '',$string);
- return $string;
- }
- public function setPrefix($prefix)
- {
- $this->prefix = $prefix;
- }
- public function getPrefix()
- {
- return $this->prefix;
- }
- public function getTaxRate($taxRate)
- {
- if(empty($taxRate) || !is_numeric($taxRate))
- {
- return 0;
- }
- if($taxRate < 1)
- {
- $tax = $taxRate * 100;
- $tax = (int) $tax;
- }
- else
- {
- $tax = (int) $taxRate;
- }
- return $tax;
- }
- public function getTaxName($taxRate)
- {
- return $this->getTaxRate($taxRate) . '%';
- }
- }
|