@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function setAmount($number = 0) |
| 11 | 11 | { |
| 12 | - $this->parsed_number = $number . ''; |
|
| 12 | + $this->parsed_number = $number.''; |
|
| 13 | 13 | return $this; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | private function split_parsed_number_to_two_number_depend_on_comma() |
| 17 | 17 | { |
| 18 | - $arr = explode('.',$this->parsed_number); |
|
| 18 | + $arr = explode('.', $this->parsed_number); |
|
| 19 | 19 | $this->parsed_number_array = $arr; |
| 20 | 20 | $this->all_numbers_len = count($this->parsed_number_array); |
| 21 | 21 | return $this; |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | private function split_numbers_after_comma_to_array() |
| 32 | 32 | { |
| 33 | - if($this->all_numbers_len>=2) |
|
| 33 | + if ($this->all_numbers_len>=2) |
|
| 34 | 34 | { |
| 35 | 35 | $arr = str_split($this->parsed_number_array[1]); |
| 36 | 36 | |
| 37 | - if(count($arr)>=3) |
|
| 37 | + if (count($arr)>=3) |
|
| 38 | 38 | { |
| 39 | - $this->after_comma_array = [$arr[0],$arr[1]]; |
|
| 39 | + $this->after_comma_array = [$arr[0], $arr[1]]; |
|
| 40 | 40 | }else |
| 41 | 41 | { |
| 42 | 42 | $this->after_comma_array = $arr; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->after_comma_len = count($this->after_comma_array); |
| 46 | 46 | foreach ($this->after_comma_array as $digit) |
| 47 | 47 | { |
| 48 | - $this->after_comma_sum.=$digit; |
|
| 48 | + $this->after_comma_sum .= $digit; |
|
| 49 | 49 | } |
| 50 | 50 | //dd($this->after_comma_sum == 00); |
| 51 | 51 | return $this; |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | if(count($arr)>=3) |
| 38 | 38 | { |
| 39 | 39 | $this->after_comma_array = [$arr[0],$arr[1]]; |
| 40 | - }else |
|
| 40 | + } else |
|
| 41 | 41 | { |
| 42 | 42 | $this->after_comma_array = $arr; |
| 43 | 43 | } |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | use Digit; |
| 10 | 10 | |
| 11 | - public function classA($arr,$len = 1) |
|
| 11 | + public function classA($arr, $len = 1) |
|
| 12 | 12 | { |
| 13 | 13 | return $this->ones[$arr[0]]; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function classB($arr,$len = 2) |
|
| 16 | + public function classB($arr, $len = 2) |
|
| 17 | 17 | { |
| 18 | - if($this->before_comma_len >= 2) |
|
| 18 | + if ($this->before_comma_len>=2) |
|
| 19 | 19 | { |
| 20 | 20 | $ten_number_index = $this->before_comma_len - 2; |
| 21 | 21 | $single_number_index = $this->before_comma_len - 1; |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | , |
| 25 | 25 | $this->before_comma_array[$single_number_index] |
| 26 | 26 | ]; |
| 27 | - if($arr==$detecd_array) |
|
| 27 | + if ($arr == $detecd_array) |
|
| 28 | 28 | { |
| 29 | - if($arr[0]==0 and $arr[1]>=1 and $arr[1]<=10) |
|
| 29 | + if ($arr[0] == 0 and $arr[1]>=1 and $arr[1]<=10) |
|
| 30 | 30 | $this->is_main1_currency = true; |
| 31 | - elseif($arr[0]>=1 and $arr[1]>=1 and $arr[1]<=9) |
|
| 31 | + elseif ($arr[0]>=1 and $arr[1]>=1 and $arr[1]<=9) |
|
| 32 | 32 | $this->is_main1_currency = false; |
| 33 | - elseif($arr[0]>=2) |
|
| 33 | + elseif ($arr[0]>=2) |
|
| 34 | 34 | $this->is_main1_currency = false; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -41,204 +41,204 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - if($arr[0]==0 and $arr[1]==0) |
|
| 44 | + if ($arr[0] == 0 and $arr[1] == 0) |
|
| 45 | 45 | return ''; |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | - if($arr[0]==0) |
|
| 49 | + if ($arr[0] == 0) |
|
| 50 | 50 | return $this->ones[$arr[1]]; |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - if($arr[0]==1 and $arr[1]==1) |
|
| 54 | + if ($arr[0] == 1 and $arr[1] == 1) |
|
| 55 | 55 | return $this->ones[11]; |
| 56 | 56 | |
| 57 | 57 | |
| 58 | - if($arr[0]==1 and $arr[1]==0) |
|
| 58 | + if ($arr[0] == 1 and $arr[1] == 0) |
|
| 59 | 59 | return $this->ones[10]; |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - if($arr[1]==0) |
|
| 63 | + if ($arr[1] == 0) |
|
| 64 | 64 | return $this->tens[$arr[0]]; |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - if($arr[0]>1) |
|
| 69 | - return $this->ones[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]]; |
|
| 68 | + if ($arr[0]>1) |
|
| 69 | + return $this->ones[$arr[1]].$this->config['connection_tool'].$this->tens[$arr[0]]; |
|
| 70 | 70 | |
| 71 | - if(in_array($arr[1],[1,2])) |
|
| 72 | - return $this->others[$arr[1]] . ' ' . $this->tens[$arr[0]]; |
|
| 71 | + if (in_array($arr[1], [1, 2])) |
|
| 72 | + return $this->others[$arr[1]].' '.$this->tens[$arr[0]]; |
|
| 73 | 73 | |
| 74 | - return $this->ones[$arr[1]] . ' ' . $this->tens[$arr[0]]; |
|
| 74 | + return $this->ones[$arr[1]].' '.$this->tens[$arr[0]]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function classC($arr,$len = 3) |
|
| 77 | + public function classC($arr, $len = 3) |
|
| 78 | 78 | { |
| 79 | - if($arr[0]==0 and $arr[1] == 0 and $arr[2] == 0) |
|
| 79 | + if ($arr[0] == 0 and $arr[1] == 0 and $arr[2] == 0) |
|
| 80 | 80 | return ''; |
| 81 | 81 | |
| 82 | - if($arr[0]==0 and $arr[1] == 0) |
|
| 82 | + if ($arr[0] == 0 and $arr[1] == 0) |
|
| 83 | 83 | return $this->ones[$arr[2]]; |
| 84 | 84 | |
| 85 | - if($arr[0]==0) |
|
| 86 | - return $this->classB([$arr[1],$arr[2]]); |
|
| 85 | + if ($arr[0] == 0) |
|
| 86 | + return $this->classB([$arr[1], $arr[2]]); |
|
| 87 | 87 | |
| 88 | - if($arr[2] == 0 and $arr[1] == 0) |
|
| 88 | + if ($arr[2] == 0 and $arr[1] == 0) |
|
| 89 | 89 | return $this->hundreds[$arr[0]]; |
| 90 | 90 | |
| 91 | - if($arr[1]!=0) |
|
| 92 | - return $this->hundreds[$arr[0]] . $this->config['connection_tool'] . $this->classB([$arr[1],$arr[2]]); |
|
| 91 | + if ($arr[1] != 0) |
|
| 92 | + return $this->hundreds[$arr[0]].$this->config['connection_tool'].$this->classB([$arr[1], $arr[2]]); |
|
| 93 | 93 | |
| 94 | - return $this->hundreds[$arr[0]] . $this->config['connection_tool'] . $this->classA([$arr[2]]); |
|
| 94 | + return $this->hundreds[$arr[0]].$this->config['connection_tool'].$this->classA([$arr[2]]); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public function classD($arr,$len = 4) |
|
| 97 | + public function classD($arr, $len = 4) |
|
| 98 | 98 | { |
| 99 | - $classC = [$arr[1],$arr[2],$arr[3]]; |
|
| 99 | + $classC = [$arr[1], $arr[2], $arr[3]]; |
|
| 100 | 100 | |
| 101 | - if($arr[0]<=2) |
|
| 102 | - $thousands = $this->thousands[$arr[0]] ; |
|
| 101 | + if ($arr[0]<=2) |
|
| 102 | + $thousands = $this->thousands[$arr[0]]; |
|
| 103 | 103 | else |
| 104 | - $thousands = $this->ones[$arr[0]] . ' ' . $this->thousands['39']; |
|
| 104 | + $thousands = $this->ones[$arr[0]].' '.$this->thousands['39']; |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - if($arr[1] == 0 and $arr[2] == 0 and $arr[3] == 0) |
|
| 107 | + if ($arr[1] == 0 and $arr[2] == 0 and $arr[3] == 0) |
|
| 108 | 108 | return $thousands; |
| 109 | 109 | |
| 110 | - return $thousands . $this->config['connection_tool'] . $this->classC($classC); |
|
| 110 | + return $thousands.$this->config['connection_tool'].$this->classC($classC); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function classE($arr,$len = 5) |
|
| 113 | + public function classE($arr, $len = 5) |
|
| 114 | 114 | { |
| 115 | - $classC = [$arr[2],$arr[3],$arr[4]]; |
|
| 115 | + $classC = [$arr[2], $arr[3], $arr[4]]; |
|
| 116 | 116 | |
| 117 | - if($arr[0] != 0) |
|
| 117 | + if ($arr[0] != 0) |
|
| 118 | 118 | { |
| 119 | 119 | $conn = ' '; |
| 120 | 120 | |
| 121 | - if($arr[1]>=2 and $arr[0]>1) |
|
| 121 | + if ($arr[1]>=2 and $arr[0]>1) |
|
| 122 | 122 | { |
| 123 | 123 | $conn = $this->config['connection_tool']; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if(in_array($arr[1],[2,1])) |
|
| 127 | - $thousands = $this->others[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 126 | + if (in_array($arr[1], [2, 1])) |
|
| 127 | + $thousands = $this->others[$arr[1]].$conn.$this->tens[$arr[0]]; |
|
| 128 | 128 | else |
| 129 | - $thousands = $this->ones[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 129 | + $thousands = $this->ones[$arr[1]].$conn.$this->tens[$arr[0]]; |
|
| 130 | 130 | |
| 131 | - if($arr[1] == 0) |
|
| 131 | + if ($arr[1] == 0) |
|
| 132 | 132 | { |
| 133 | - if($arr[0]==1) |
|
| 133 | + if ($arr[0] == 1) |
|
| 134 | 134 | { |
| 135 | - $thousands = $this->ones[10] ; |
|
| 136 | - $thousands.=' ' . $this->thousands[39]; |
|
| 135 | + $thousands = $this->ones[10]; |
|
| 136 | + $thousands .= ' '.$this->thousands[39]; |
|
| 137 | 137 | }else |
| 138 | 138 | { |
| 139 | - $thousands = $this->tens[$arr[0]] ; |
|
| 140 | - $thousands.=' ' . $this->thousands[1]; |
|
| 139 | + $thousands = $this->tens[$arr[0]]; |
|
| 140 | + $thousands .= ' '.$this->thousands[1]; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - }else{ |
|
| 144 | - if($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0) |
|
| 143 | + }else { |
|
| 144 | + if ($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0) |
|
| 145 | 145 | { |
| 146 | - $thousands.=' ' . $this->thousands[1]; |
|
| 146 | + $thousands .= ' '.$this->thousands[1]; |
|
| 147 | 147 | }else |
| 148 | 148 | { |
| 149 | - $thousands.=' ' . $this->thousands[1199]; |
|
| 149 | + $thousands .= ' '.$this->thousands[1199]; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | }else |
| 155 | 155 | { |
| 156 | - if(in_array($arr[1],[2,1])) |
|
| 157 | - $thousands = $this->others[$arr[1]] . ' ' ; |
|
| 156 | + if (in_array($arr[1], [2, 1])) |
|
| 157 | + $thousands = $this->others[$arr[1]].' '; |
|
| 158 | 158 | else |
| 159 | - $thousands = $this->ones[$arr[1]] . ' ' ; |
|
| 159 | + $thousands = $this->ones[$arr[1]].' '; |
|
| 160 | 160 | |
| 161 | 161 | |
| 162 | - if($arr[1] == 0) |
|
| 162 | + if ($arr[1] == 0) |
|
| 163 | 163 | { |
| 164 | - $thousands = $this->tens[$arr[2]] ; |
|
| 164 | + $thousands = $this->tens[$arr[2]]; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $thousands.=' ' . $this->thousands[39]; |
|
| 167 | + $thousands .= ' '.$this->thousands[39]; |
|
| 168 | 168 | } |
| 169 | - if($this->classC($classC) != '' ) |
|
| 169 | + if ($this->classC($classC) != '') |
|
| 170 | 170 | { |
| 171 | - return $thousands . $this->config['connection_tool'] . $this->classC($classC); |
|
| 171 | + return $thousands.$this->config['connection_tool'].$this->classC($classC); |
|
| 172 | 172 | } |
| 173 | 173 | return $thousands; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - public function classF($arr,$len = 6) |
|
| 176 | + public function classF($arr, $len = 6) |
|
| 177 | 177 | { |
| 178 | - $classC = [$arr[3],$arr[4],$arr[5]]; |
|
| 179 | - if($arr[0]!=0) |
|
| 178 | + $classC = [$arr[3], $arr[4], $arr[5]]; |
|
| 179 | + if ($arr[0] != 0) |
|
| 180 | 180 | { |
| 181 | - if($arr[1] == 0 && $arr[2]==0) |
|
| 181 | + if ($arr[1] == 0 && $arr[2] == 0) |
|
| 182 | 182 | { |
| 183 | - $thousands = $this->hundreds[$arr[0]] .' '. $this->thousands[1]; |
|
| 184 | - }else{ |
|
| 185 | - if($arr[1] == 0 ) |
|
| 183 | + $thousands = $this->hundreds[$arr[0]].' '.$this->thousands[1]; |
|
| 184 | + }else { |
|
| 185 | + if ($arr[1] == 0) |
|
| 186 | 186 | { |
| 187 | - $thousands = $this->hundreds[$arr[0]] .$this->config['connection_tool']. |
|
| 188 | - $this->ones[$arr[2]] . ' '. $this->thousands[1]; |
|
| 189 | - }elseif($arr[2] == 0) |
|
| 187 | + $thousands = $this->hundreds[$arr[0]].$this->config['connection_tool']. |
|
| 188 | + $this->ones[$arr[2]].' '.$this->thousands[1]; |
|
| 189 | + }elseif ($arr[2] == 0) |
|
| 190 | 190 | { |
| 191 | - if($arr[3] == 0 and $arr[4] == 0 and $arr[5] == 0) |
|
| 191 | + if ($arr[3] == 0 and $arr[4] == 0 and $arr[5] == 0) |
|
| 192 | 192 | { |
| 193 | 193 | |
| 194 | - $thousands = $this->hundreds[$arr[0]] .$this->config['connection_tool']. |
|
| 195 | - $this->tens[$arr[1]] . ' '. $this->thousands[1]; |
|
| 194 | + $thousands = $this->hundreds[$arr[0]].$this->config['connection_tool']. |
|
| 195 | + $this->tens[$arr[1]].' '.$this->thousands[1]; |
|
| 196 | 196 | |
| 197 | 197 | }else |
| 198 | 198 | { |
| 199 | - $thousands = $this->hundreds[$arr[0]] .$this->config['connection_tool']. |
|
| 200 | - $this->tens[$arr[1]] . ' '. $this->thousands[1199]; |
|
| 199 | + $thousands = $this->hundreds[$arr[0]].$this->config['connection_tool']. |
|
| 200 | + $this->tens[$arr[1]].' '.$this->thousands[1199]; |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | else |
| 204 | 204 | { |
| 205 | 205 | // $thousands_lang = $this->thousands[1199]; |
| 206 | - if($arr[1]==0 and $arr[2]>=1 and $arr[1]<=10) |
|
| 206 | + if ($arr[1] == 0 and $arr[2]>=1 and $arr[1]<=10) |
|
| 207 | 207 | $thousands_lang = $this->thousands[1]; |
| 208 | - elseif($arr[1]>=1 and $arr[2]>=1 and $arr[1]<=9) |
|
| 208 | + elseif ($arr[1]>=1 and $arr[2]>=1 and $arr[1]<=9) |
|
| 209 | 209 | $thousands_lang = $this->thousands[1199]; |
| 210 | - elseif($arr[1]>=2) |
|
| 210 | + elseif ($arr[1]>=2) |
|
| 211 | 211 | $thousands_lang = $this->thousands[1199]; |
| 212 | 212 | |
| 213 | 213 | |
| 214 | - $thousands = $this->classC([$arr[0],$arr[1],$arr[2]],3) . ' '. $thousands_lang; |
|
| 214 | + $thousands = $this->classC([$arr[0], $arr[1], $arr[2]], 3).' '.$thousands_lang; |
|
| 215 | 215 | |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | }else |
| 220 | 220 | { |
| 221 | - return $this->classE([$arr[1],$arr[2],$arr[3],$arr[4],$arr[5]]); |
|
| 221 | + return $this->classE([$arr[1], $arr[2], $arr[3], $arr[4], $arr[5]]); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if($this->classC($classC)!='') |
|
| 225 | - return $thousands . $this->config['connection_tool'] . $this->classC($classC); |
|
| 224 | + if ($this->classC($classC) != '') |
|
| 225 | + return $thousands.$this->config['connection_tool'].$this->classC($classC); |
|
| 226 | 226 | return $thousands; |
| 227 | 227 | |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - public function classG($arr,$len = 7) |
|
| 230 | + public function classG($arr, $len = 7) |
|
| 231 | 231 | { |
| 232 | 232 | //$classC = [$arr[2],$arr[4],$arr[5]]; |
| 233 | 233 | //$classC = [$arr[1],$arr[2],$arr[3]]; |
| 234 | - $classE = [$arr[1],$arr[2],$arr[3],$arr[4],$arr[5],$arr[6]]; |
|
| 234 | + $classE = [$arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]]; |
|
| 235 | 235 | |
| 236 | - if($arr[0]<=2) |
|
| 237 | - $million = $this->millions[$arr[0]] ; |
|
| 236 | + if ($arr[0]<=2) |
|
| 237 | + $million = $this->millions[$arr[0]]; |
|
| 238 | 238 | else |
| 239 | - $million = $this->ones[$arr[0]] . ' ' . $this->millions['39']; |
|
| 239 | + $million = $this->ones[$arr[0]].' '.$this->millions['39']; |
|
| 240 | 240 | |
| 241 | - return $million . $this->config['connection_tool'] . $this->classF($classE); |
|
| 241 | + return $million.$this->config['connection_tool'].$this->classF($classE); |
|
| 242 | 242 | |
| 243 | 243 | } |
| 244 | 244 | // public function classH($arr,$len = 8) |
@@ -255,61 +255,61 @@ discard block |
||
| 255 | 255 | // return $million . $this->config['connection_tool'] . $this->classG($classE); |
| 256 | 256 | // |
| 257 | 257 | // } |
| 258 | - public function classH($arr,$len = 8) |
|
| 258 | + public function classH($arr, $len = 8) |
|
| 259 | 259 | { |
| 260 | - $classF = [$arr[2],$arr[3],$arr[4],$arr[5],$arr[6],$arr[7]]; |
|
| 260 | + $classF = [$arr[2], $arr[3], $arr[4], $arr[5], $arr[6], $arr[7]]; |
|
| 261 | 261 | |
| 262 | - if($arr[0] != 0) |
|
| 262 | + if ($arr[0] != 0) |
|
| 263 | 263 | { |
| 264 | 264 | $conn = ' '; |
| 265 | 265 | |
| 266 | - if($arr[1]>=2 and $arr[0]>1) |
|
| 266 | + if ($arr[1]>=2 and $arr[0]>1) |
|
| 267 | 267 | { |
| 268 | 268 | $conn = $this->config['connection_tool']; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if(in_array($arr[1],[2,1])) |
|
| 272 | - $million = $this->others[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 271 | + if (in_array($arr[1], [2, 1])) |
|
| 272 | + $million = $this->others[$arr[1]].$conn.$this->tens[$arr[0]]; |
|
| 273 | 273 | else |
| 274 | - $million = $this->ones[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 274 | + $million = $this->ones[$arr[1]].$conn.$this->tens[$arr[0]]; |
|
| 275 | 275 | |
| 276 | - if($arr[1] == 0) |
|
| 276 | + if ($arr[1] == 0) |
|
| 277 | 277 | { |
| 278 | - if($arr[0]==1) |
|
| 278 | + if ($arr[0] == 1) |
|
| 279 | 279 | { |
| 280 | - $million = $this->ones[10] ; |
|
| 281 | - $million.=' ' . $this->millions[39]; |
|
| 280 | + $million = $this->ones[10]; |
|
| 281 | + $million .= ' '.$this->millions[39]; |
|
| 282 | 282 | }else |
| 283 | 283 | { |
| 284 | - $million = $this->tens[$arr[0]] ; |
|
| 285 | - $million.=' ' . $this->millions[1]; |
|
| 284 | + $million = $this->tens[$arr[0]]; |
|
| 285 | + $million .= ' '.$this->millions[1]; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - }else{ |
|
| 289 | - if($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0) |
|
| 288 | + }else { |
|
| 289 | + if ($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0) |
|
| 290 | 290 | { |
| 291 | - $million.=' ' . $this->millions[1]; |
|
| 291 | + $million .= ' '.$this->millions[1]; |
|
| 292 | 292 | }else |
| 293 | 293 | { |
| 294 | - $million.=' ' . $this->millions[1199]; |
|
| 294 | + $million .= ' '.$this->millions[1199]; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | }else |
| 300 | 300 | { |
| 301 | - if(in_array($arr[1],[2,1])) |
|
| 302 | - $million = $this->others[$arr[1]] . ' ' ; |
|
| 301 | + if (in_array($arr[1], [2, 1])) |
|
| 302 | + $million = $this->others[$arr[1]].' '; |
|
| 303 | 303 | else |
| 304 | - $million = $this->ones[$arr[1]] . ' ' ; |
|
| 304 | + $million = $this->ones[$arr[1]].' '; |
|
| 305 | 305 | |
| 306 | 306 | |
| 307 | - if($arr[1] == 0) |
|
| 307 | + if ($arr[1] == 0) |
|
| 308 | 308 | { |
| 309 | - $million = $this->tens[$arr[2]] ; |
|
| 309 | + $million = $this->tens[$arr[2]]; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - $million.=' ' . $this->millions[39]; |
|
| 312 | + $million .= ' '.$this->millions[39]; |
|
| 313 | 313 | } |
| 314 | 314 | // if(in_array($arr[1],[2])) |
| 315 | 315 | // $million = $this->others[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
@@ -325,30 +325,30 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | //$million.=' ' . $this->millions[1199]; |
| 327 | 327 | |
| 328 | - return $million . $this->config['connection_tool'] . $this->classF($classF); |
|
| 328 | + return $million.$this->config['connection_tool'].$this->classF($classF); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - public function classI($arr,$len = 9) |
|
| 331 | + public function classI($arr, $len = 9) |
|
| 332 | 332 | { |
| 333 | - $classF = [$arr[3],$arr[4],$arr[5],$arr[6],$arr[7],$arr[8]]; |
|
| 333 | + $classF = [$arr[3], $arr[4], $arr[5], $arr[6], $arr[7], $arr[8]]; |
|
| 334 | 334 | |
| 335 | 335 | |
| 336 | - if(in_array($arr[1],[2])) |
|
| 337 | - $million = $this->others[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
|
| 336 | + if (in_array($arr[1], [2])) |
|
| 337 | + $million = $this->others[$arr[1]].$this->config['connection_tool'].$this->tens[$arr[0]]; |
|
| 338 | 338 | else |
| 339 | - $million = $this->ones[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
|
| 339 | + $million = $this->ones[$arr[1]].$this->config['connection_tool'].$this->tens[$arr[0]]; |
|
| 340 | 340 | |
| 341 | 341 | |
| 342 | - if($arr[1] == 0) |
|
| 342 | + if ($arr[1] == 0) |
|
| 343 | 343 | { |
| 344 | - $million = $this->tens[$arr[0]] ; |
|
| 344 | + $million = $this->tens[$arr[0]]; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | |
| 348 | - $million.=' ' . $this->millions[1199]; |
|
| 348 | + $million .= ' '.$this->millions[1199]; |
|
| 349 | 349 | |
| 350 | 350 | |
| 351 | - return $million . $this->config['connection_tool'] . $this->classF($classF); |
|
| 351 | + return $million.$this->config['connection_tool'].$this->classF($classF); |
|
| 352 | 352 | |
| 353 | 353 | } |
| 354 | 354 | |
@@ -26,12 +26,13 @@ discard block |
||
| 26 | 26 | ]; |
| 27 | 27 | if($arr==$detecd_array) |
| 28 | 28 | { |
| 29 | - if($arr[0]==0 and $arr[1]>=1 and $arr[1]<=10) |
|
| 30 | - $this->is_main1_currency = true; |
|
| 31 | - elseif($arr[0]>=1 and $arr[1]>=1 and $arr[1]<=9) |
|
| 32 | - $this->is_main1_currency = false; |
|
| 33 | - elseif($arr[0]>=2) |
|
| 34 | - $this->is_main1_currency = false; |
|
| 29 | + if($arr[0]==0 and $arr[1]>=1 and $arr[1]<=10) { |
|
| 30 | + $this->is_main1_currency = true; |
|
| 31 | + } elseif($arr[0]>=1 and $arr[1]>=1 and $arr[1]<=9) { |
|
| 32 | + $this->is_main1_currency = false; |
|
| 33 | + } elseif($arr[0]>=2) { |
|
| 34 | + $this->is_main1_currency = false; |
|
| 35 | + } |
|
| 35 | 36 | } |
| 36 | 37 | |
| 37 | 38 | |
@@ -41,55 +42,67 @@ discard block |
||
| 41 | 42 | |
| 42 | 43 | |
| 43 | 44 | |
| 44 | - if($arr[0]==0 and $arr[1]==0) |
|
| 45 | - return ''; |
|
| 45 | + if($arr[0]==0 and $arr[1]==0) { |
|
| 46 | + return ''; |
|
| 47 | + } |
|
| 46 | 48 | |
| 47 | 49 | |
| 48 | 50 | |
| 49 | - if($arr[0]==0) |
|
| 50 | - return $this->ones[$arr[1]]; |
|
| 51 | + if($arr[0]==0) { |
|
| 52 | + return $this->ones[$arr[1]]; |
|
| 53 | + } |
|
| 51 | 54 | |
| 52 | 55 | |
| 53 | 56 | |
| 54 | - if($arr[0]==1 and $arr[1]==1) |
|
| 55 | - return $this->ones[11]; |
|
| 57 | + if($arr[0]==1 and $arr[1]==1) { |
|
| 58 | + return $this->ones[11]; |
|
| 59 | + } |
|
| 56 | 60 | |
| 57 | 61 | |
| 58 | - if($arr[0]==1 and $arr[1]==0) |
|
| 59 | - return $this->ones[10]; |
|
| 62 | + if($arr[0]==1 and $arr[1]==0) { |
|
| 63 | + return $this->ones[10]; |
|
| 64 | + } |
|
| 60 | 65 | |
| 61 | 66 | |
| 62 | 67 | |
| 63 | - if($arr[1]==0) |
|
| 64 | - return $this->tens[$arr[0]]; |
|
| 68 | + if($arr[1]==0) { |
|
| 69 | + return $this->tens[$arr[0]]; |
|
| 70 | + } |
|
| 65 | 71 | |
| 66 | 72 | |
| 67 | 73 | |
| 68 | - if($arr[0]>1) |
|
| 69 | - return $this->ones[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]]; |
|
| 74 | + if($arr[0]>1) { |
|
| 75 | + return $this->ones[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]]; |
|
| 76 | + } |
|
| 70 | 77 | |
| 71 | - if(in_array($arr[1],[1,2])) |
|
| 72 | - return $this->others[$arr[1]] . ' ' . $this->tens[$arr[0]]; |
|
| 78 | + if(in_array($arr[1],[1,2])) { |
|
| 79 | + return $this->others[$arr[1]] . ' ' . $this->tens[$arr[0]]; |
|
| 80 | + } |
|
| 73 | 81 | |
| 74 | 82 | return $this->ones[$arr[1]] . ' ' . $this->tens[$arr[0]]; |
| 75 | 83 | } |
| 76 | 84 | |
| 77 | 85 | public function classC($arr,$len = 3) |
| 78 | 86 | { |
| 79 | - if($arr[0]==0 and $arr[1] == 0 and $arr[2] == 0) |
|
| 80 | - return ''; |
|
| 87 | + if($arr[0]==0 and $arr[1] == 0 and $arr[2] == 0) { |
|
| 88 | + return ''; |
|
| 89 | + } |
|
| 81 | 90 | |
| 82 | - if($arr[0]==0 and $arr[1] == 0) |
|
| 83 | - return $this->ones[$arr[2]]; |
|
| 91 | + if($arr[0]==0 and $arr[1] == 0) { |
|
| 92 | + return $this->ones[$arr[2]]; |
|
| 93 | + } |
|
| 84 | 94 | |
| 85 | - if($arr[0]==0) |
|
| 86 | - return $this->classB([$arr[1],$arr[2]]); |
|
| 95 | + if($arr[0]==0) { |
|
| 96 | + return $this->classB([$arr[1],$arr[2]]); |
|
| 97 | + } |
|
| 87 | 98 | |
| 88 | - if($arr[2] == 0 and $arr[1] == 0) |
|
| 89 | - return $this->hundreds[$arr[0]]; |
|
| 99 | + if($arr[2] == 0 and $arr[1] == 0) { |
|
| 100 | + return $this->hundreds[$arr[0]]; |
|
| 101 | + } |
|
| 90 | 102 | |
| 91 | - if($arr[1]!=0) |
|
| 92 | - return $this->hundreds[$arr[0]] . $this->config['connection_tool'] . $this->classB([$arr[1],$arr[2]]); |
|
| 103 | + if($arr[1]!=0) { |
|
| 104 | + return $this->hundreds[$arr[0]] . $this->config['connection_tool'] . $this->classB([$arr[1],$arr[2]]); |
|
| 105 | + } |
|
| 93 | 106 | |
| 94 | 107 | return $this->hundreds[$arr[0]] . $this->config['connection_tool'] . $this->classA([$arr[2]]); |
| 95 | 108 | } |
@@ -98,14 +111,16 @@ discard block |
||
| 98 | 111 | { |
| 99 | 112 | $classC = [$arr[1],$arr[2],$arr[3]]; |
| 100 | 113 | |
| 101 | - if($arr[0]<=2) |
|
| 102 | - $thousands = $this->thousands[$arr[0]] ; |
|
| 103 | - else |
|
| 104 | - $thousands = $this->ones[$arr[0]] . ' ' . $this->thousands['39']; |
|
| 114 | + if($arr[0]<=2) { |
|
| 115 | + $thousands = $this->thousands[$arr[0]] ; |
|
| 116 | + } else { |
|
| 117 | + $thousands = $this->ones[$arr[0]] . ' ' . $this->thousands['39']; |
|
| 118 | + } |
|
| 105 | 119 | |
| 106 | 120 | |
| 107 | - if($arr[1] == 0 and $arr[2] == 0 and $arr[3] == 0) |
|
| 108 | - return $thousands; |
|
| 121 | + if($arr[1] == 0 and $arr[2] == 0 and $arr[3] == 0) { |
|
| 122 | + return $thousands; |
|
| 123 | + } |
|
| 109 | 124 | |
| 110 | 125 | return $thousands . $this->config['connection_tool'] . $this->classC($classC); |
| 111 | 126 | } |
@@ -123,10 +138,11 @@ discard block |
||
| 123 | 138 | $conn = $this->config['connection_tool']; |
| 124 | 139 | } |
| 125 | 140 | |
| 126 | - if(in_array($arr[1],[2,1])) |
|
| 127 | - $thousands = $this->others[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 128 | - else |
|
| 129 | - $thousands = $this->ones[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 141 | + if(in_array($arr[1],[2,1])) { |
|
| 142 | + $thousands = $this->others[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 143 | + } else { |
|
| 144 | + $thousands = $this->ones[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 145 | + } |
|
| 130 | 146 | |
| 131 | 147 | if($arr[1] == 0) |
| 132 | 148 | { |
@@ -134,29 +150,30 @@ discard block |
||
| 134 | 150 | { |
| 135 | 151 | $thousands = $this->ones[10] ; |
| 136 | 152 | $thousands.=' ' . $this->thousands[39]; |
| 137 | - }else |
|
| 153 | + } else |
|
| 138 | 154 | { |
| 139 | 155 | $thousands = $this->tens[$arr[0]] ; |
| 140 | 156 | $thousands.=' ' . $this->thousands[1]; |
| 141 | 157 | } |
| 142 | 158 | |
| 143 | - }else{ |
|
| 159 | + } else{ |
|
| 144 | 160 | if($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0) |
| 145 | 161 | { |
| 146 | 162 | $thousands.=' ' . $this->thousands[1]; |
| 147 | - }else |
|
| 163 | + } else |
|
| 148 | 164 | { |
| 149 | 165 | $thousands.=' ' . $this->thousands[1199]; |
| 150 | 166 | } |
| 151 | 167 | |
| 152 | 168 | } |
| 153 | 169 | |
| 154 | - }else |
|
| 170 | + } else |
|
| 155 | 171 | { |
| 156 | - if(in_array($arr[1],[2,1])) |
|
| 157 | - $thousands = $this->others[$arr[1]] . ' ' ; |
|
| 158 | - else |
|
| 159 | - $thousands = $this->ones[$arr[1]] . ' ' ; |
|
| 172 | + if(in_array($arr[1],[2,1])) { |
|
| 173 | + $thousands = $this->others[$arr[1]] . ' ' ; |
|
| 174 | + } else { |
|
| 175 | + $thousands = $this->ones[$arr[1]] . ' ' ; |
|
| 176 | + } |
|
| 160 | 177 | |
| 161 | 178 | |
| 162 | 179 | if($arr[1] == 0) |
@@ -181,12 +198,12 @@ discard block |
||
| 181 | 198 | if($arr[1] == 0 && $arr[2]==0) |
| 182 | 199 | { |
| 183 | 200 | $thousands = $this->hundreds[$arr[0]] .' '. $this->thousands[1]; |
| 184 | - }else{ |
|
| 201 | + } else{ |
|
| 185 | 202 | if($arr[1] == 0 ) |
| 186 | 203 | { |
| 187 | 204 | $thousands = $this->hundreds[$arr[0]] .$this->config['connection_tool']. |
| 188 | 205 | $this->ones[$arr[2]] . ' '. $this->thousands[1]; |
| 189 | - }elseif($arr[2] == 0) |
|
| 206 | + } elseif($arr[2] == 0) |
|
| 190 | 207 | { |
| 191 | 208 | if($arr[3] == 0 and $arr[4] == 0 and $arr[5] == 0) |
| 192 | 209 | { |
@@ -194,21 +211,21 @@ discard block |
||
| 194 | 211 | $thousands = $this->hundreds[$arr[0]] .$this->config['connection_tool']. |
| 195 | 212 | $this->tens[$arr[1]] . ' '. $this->thousands[1]; |
| 196 | 213 | |
| 197 | - }else |
|
| 214 | + } else |
|
| 198 | 215 | { |
| 199 | 216 | $thousands = $this->hundreds[$arr[0]] .$this->config['connection_tool']. |
| 200 | 217 | $this->tens[$arr[1]] . ' '. $this->thousands[1199]; |
| 201 | 218 | } |
| 202 | - } |
|
| 203 | - else |
|
| 219 | + } else |
|
| 204 | 220 | { |
| 205 | 221 | // $thousands_lang = $this->thousands[1199]; |
| 206 | - if($arr[1]==0 and $arr[2]>=1 and $arr[1]<=10) |
|
| 207 | - $thousands_lang = $this->thousands[1]; |
|
| 208 | - elseif($arr[1]>=1 and $arr[2]>=1 and $arr[1]<=9) |
|
| 209 | - $thousands_lang = $this->thousands[1199]; |
|
| 210 | - elseif($arr[1]>=2) |
|
| 211 | - $thousands_lang = $this->thousands[1199]; |
|
| 222 | + if($arr[1]==0 and $arr[2]>=1 and $arr[1]<=10) { |
|
| 223 | + $thousands_lang = $this->thousands[1]; |
|
| 224 | + } elseif($arr[1]>=1 and $arr[2]>=1 and $arr[1]<=9) { |
|
| 225 | + $thousands_lang = $this->thousands[1199]; |
|
| 226 | + } elseif($arr[1]>=2) { |
|
| 227 | + $thousands_lang = $this->thousands[1199]; |
|
| 228 | + } |
|
| 212 | 229 | |
| 213 | 230 | |
| 214 | 231 | $thousands = $this->classC([$arr[0],$arr[1],$arr[2]],3) . ' '. $thousands_lang; |
@@ -216,13 +233,14 @@ discard block |
||
| 216 | 233 | } |
| 217 | 234 | } |
| 218 | 235 | |
| 219 | - }else |
|
| 236 | + } else |
|
| 220 | 237 | { |
| 221 | 238 | return $this->classE([$arr[1],$arr[2],$arr[3],$arr[4],$arr[5]]); |
| 222 | 239 | } |
| 223 | 240 | |
| 224 | - if($this->classC($classC)!='') |
|
| 225 | - return $thousands . $this->config['connection_tool'] . $this->classC($classC); |
|
| 241 | + if($this->classC($classC)!='') { |
|
| 242 | + return $thousands . $this->config['connection_tool'] . $this->classC($classC); |
|
| 243 | + } |
|
| 226 | 244 | return $thousands; |
| 227 | 245 | |
| 228 | 246 | } |
@@ -233,10 +251,11 @@ discard block |
||
| 233 | 251 | //$classC = [$arr[1],$arr[2],$arr[3]]; |
| 234 | 252 | $classE = [$arr[1],$arr[2],$arr[3],$arr[4],$arr[5],$arr[6]]; |
| 235 | 253 | |
| 236 | - if($arr[0]<=2) |
|
| 237 | - $million = $this->millions[$arr[0]] ; |
|
| 238 | - else |
|
| 239 | - $million = $this->ones[$arr[0]] . ' ' . $this->millions['39']; |
|
| 254 | + if($arr[0]<=2) { |
|
| 255 | + $million = $this->millions[$arr[0]] ; |
|
| 256 | + } else { |
|
| 257 | + $million = $this->ones[$arr[0]] . ' ' . $this->millions['39']; |
|
| 258 | + } |
|
| 240 | 259 | |
| 241 | 260 | return $million . $this->config['connection_tool'] . $this->classF($classE); |
| 242 | 261 | |
@@ -268,10 +287,11 @@ discard block |
||
| 268 | 287 | $conn = $this->config['connection_tool']; |
| 269 | 288 | } |
| 270 | 289 | |
| 271 | - if(in_array($arr[1],[2,1])) |
|
| 272 | - $million = $this->others[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 273 | - else |
|
| 274 | - $million = $this->ones[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 290 | + if(in_array($arr[1],[2,1])) { |
|
| 291 | + $million = $this->others[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 292 | + } else { |
|
| 293 | + $million = $this->ones[$arr[1]] . $conn . $this->tens[$arr[0]] ; |
|
| 294 | + } |
|
| 275 | 295 | |
| 276 | 296 | if($arr[1] == 0) |
| 277 | 297 | { |
@@ -279,29 +299,30 @@ discard block |
||
| 279 | 299 | { |
| 280 | 300 | $million = $this->ones[10] ; |
| 281 | 301 | $million.=' ' . $this->millions[39]; |
| 282 | - }else |
|
| 302 | + } else |
|
| 283 | 303 | { |
| 284 | 304 | $million = $this->tens[$arr[0]] ; |
| 285 | 305 | $million.=' ' . $this->millions[1]; |
| 286 | 306 | } |
| 287 | 307 | |
| 288 | - }else{ |
|
| 308 | + } else{ |
|
| 289 | 309 | if($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0) |
| 290 | 310 | { |
| 291 | 311 | $million.=' ' . $this->millions[1]; |
| 292 | - }else |
|
| 312 | + } else |
|
| 293 | 313 | { |
| 294 | 314 | $million.=' ' . $this->millions[1199]; |
| 295 | 315 | } |
| 296 | 316 | |
| 297 | 317 | } |
| 298 | 318 | |
| 299 | - }else |
|
| 319 | + } else |
|
| 300 | 320 | { |
| 301 | - if(in_array($arr[1],[2,1])) |
|
| 302 | - $million = $this->others[$arr[1]] . ' ' ; |
|
| 303 | - else |
|
| 304 | - $million = $this->ones[$arr[1]] . ' ' ; |
|
| 321 | + if(in_array($arr[1],[2,1])) { |
|
| 322 | + $million = $this->others[$arr[1]] . ' ' ; |
|
| 323 | + } else { |
|
| 324 | + $million = $this->ones[$arr[1]] . ' ' ; |
|
| 325 | + } |
|
| 305 | 326 | |
| 306 | 327 | |
| 307 | 328 | if($arr[1] == 0) |
@@ -333,10 +354,11 @@ discard block |
||
| 333 | 354 | $classF = [$arr[3],$arr[4],$arr[5],$arr[6],$arr[7],$arr[8]]; |
| 334 | 355 | |
| 335 | 356 | |
| 336 | - if(in_array($arr[1],[2])) |
|
| 337 | - $million = $this->others[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
|
| 338 | - else |
|
| 339 | - $million = $this->ones[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
|
| 357 | + if(in_array($arr[1],[2])) { |
|
| 358 | + $million = $this->others[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
|
| 359 | + } else { |
|
| 360 | + $million = $this->ones[$arr[1]] . $this->config['connection_tool'] . $this->tens[$arr[0]] ; |
|
| 361 | + } |
|
| 340 | 362 | |
| 341 | 363 | |
| 342 | 364 | if($arr[1] == 0) |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | public function initValidation() |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - if(is_numeric($this->parsed_number)) |
|
| 13 | + if (is_numeric($this->parsed_number)) |
|
| 14 | 14 | return $this; |
| 15 | 15 | else |
| 16 | 16 | die('is not right number '); |
@@ -10,9 +10,10 @@ |
||
| 10 | 10 | public function initValidation() |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - if(is_numeric($this->parsed_number)) |
|
| 14 | - return $this; |
|
| 15 | - else |
|
| 16 | - die('is not right number '); |
|
| 13 | + if(is_numeric($this->parsed_number)) { |
|
| 14 | + return $this; |
|
| 15 | + } else { |
|
| 16 | + die('is not right number '); |
|
| 17 | + } |
|
| 17 | 18 | } |
| 18 | 19 | } |
| 19 | 20 | \ No newline at end of file |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | public function runBeforeComma() |
| 10 | 10 | { |
| 11 | 11 | $class = $this->detectClass($this->before_comma_len); |
| 12 | - $methodName = 'Class' . $class; |
|
| 12 | + $methodName = 'Class'.$class; |
|
| 13 | 13 | |
| 14 | - if(method_exists($this,$methodName)) |
|
| 14 | + if (method_exists($this, $methodName)) |
|
| 15 | 15 | { |
| 16 | - return $this->$methodName($this->before_comma_array,$this->before_comma_len); |
|
| 16 | + return $this->$methodName($this->before_comma_array, $this->before_comma_len); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | return 'عفوا هذا الرقم خارج نطاقنا حاليا حاول لاحقاً'; |
@@ -21,46 +21,46 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function runAfterComma() |
| 23 | 23 | { |
| 24 | - $class = $this->detectClass($this->after_comma_len); |
|
| 25 | - $methodName = 'Class' . $class; |
|
| 26 | - if(method_exists($this,$methodName)) |
|
| 24 | + $class = $this->detectClass($this->after_comma_len); |
|
| 25 | + $methodName = 'Class'.$class; |
|
| 26 | + if (method_exists($this, $methodName)) |
|
| 27 | 27 | { |
| 28 | - return $this->$methodName($this->after_comma_array,$this->after_comma_len); |
|
| 28 | + return $this->$methodName($this->after_comma_array, $this->after_comma_len); |
|
| 29 | 29 | } |
| 30 | 30 | return 'عفوا هذا الرقم خارج نطاقنا حاليا حاول لاحقاً'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function detectClass($len) |
| 34 | 34 | { |
| 35 | - if($len == 1) |
|
| 35 | + if ($len == 1) |
|
| 36 | 36 | return "A"; |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - if($len == 2) |
|
| 39 | + if ($len == 2) |
|
| 40 | 40 | return "B"; |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - if($len == 3) |
|
| 43 | + if ($len == 3) |
|
| 44 | 44 | return "C"; |
| 45 | 45 | |
| 46 | 46 | |
| 47 | - if($len == 4) |
|
| 47 | + if ($len == 4) |
|
| 48 | 48 | return "D"; |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - if($len == 5) |
|
| 51 | + if ($len == 5) |
|
| 52 | 52 | return "E"; |
| 53 | 53 | |
| 54 | - if($len == 6) |
|
| 54 | + if ($len == 6) |
|
| 55 | 55 | return "F"; |
| 56 | 56 | |
| 57 | - if($len == 7) |
|
| 57 | + if ($len == 7) |
|
| 58 | 58 | return "G"; |
| 59 | 59 | |
| 60 | - if($len == 8) |
|
| 60 | + if ($len == 8) |
|
| 61 | 61 | return "H"; |
| 62 | 62 | |
| 63 | - if($len == 9) |
|
| 63 | + if ($len == 9) |
|
| 64 | 64 | return "I"; |
| 65 | 65 | |
| 66 | 66 | } |
@@ -32,36 +32,45 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function detectClass($len) |
| 34 | 34 | { |
| 35 | - if($len == 1) |
|
| 36 | - return "A"; |
|
| 35 | + if($len == 1) { |
|
| 36 | + return "A"; |
|
| 37 | + } |
|
| 37 | 38 | |
| 38 | 39 | |
| 39 | - if($len == 2) |
|
| 40 | - return "B"; |
|
| 40 | + if($len == 2) { |
|
| 41 | + return "B"; |
|
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | |
| 43 | - if($len == 3) |
|
| 44 | - return "C"; |
|
| 45 | + if($len == 3) { |
|
| 46 | + return "C"; |
|
| 47 | + } |
|
| 45 | 48 | |
| 46 | 49 | |
| 47 | - if($len == 4) |
|
| 48 | - return "D"; |
|
| 50 | + if($len == 4) { |
|
| 51 | + return "D"; |
|
| 52 | + } |
|
| 49 | 53 | |
| 50 | 54 | |
| 51 | - if($len == 5) |
|
| 52 | - return "E"; |
|
| 55 | + if($len == 5) { |
|
| 56 | + return "E"; |
|
| 57 | + } |
|
| 53 | 58 | |
| 54 | - if($len == 6) |
|
| 55 | - return "F"; |
|
| 59 | + if($len == 6) { |
|
| 60 | + return "F"; |
|
| 61 | + } |
|
| 56 | 62 | |
| 57 | - if($len == 7) |
|
| 58 | - return "G"; |
|
| 63 | + if($len == 7) { |
|
| 64 | + return "G"; |
|
| 65 | + } |
|
| 59 | 66 | |
| 60 | - if($len == 8) |
|
| 61 | - return "H"; |
|
| 67 | + if($len == 8) { |
|
| 68 | + return "H"; |
|
| 69 | + } |
|
| 62 | 70 | |
| 63 | - if($len == 9) |
|
| 64 | - return "I"; |
|
| 71 | + if($len == 9) { |
|
| 72 | + return "I"; |
|
| 73 | + } |
|
| 65 | 74 | |
| 66 | 75 | } |
| 67 | 76 | } |
| 68 | 77 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class Tafqeet |
| 11 | 11 | { |
| 12 | - use Calculators,Handler,Validation,App; |
|
| 12 | + use Calculators, Handler, Validation, App; |
|
| 13 | 13 | |
| 14 | 14 | public $config = [ |
| 15 | 15 | 'connection_tool' => ' و', |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return mixed |
| 91 | 91 | */ |
| 92 | - public static function inArabic($amount = 0,$currency = 'sar') |
|
| 92 | + public static function inArabic($amount = 0, $currency = 'sar') |
|
| 93 | 93 | { |
| 94 | 94 | |
| 95 | - $amount = money_format("%i",$amount); // update the amount to be always 2 digit after comma |
|
| 95 | + $amount = money_format("%i", $amount); // update the amount to be always 2 digit after comma |
|
| 96 | 96 | |
| 97 | 97 | // |
| 98 | 98 | return (new self)->setAmount($amount)->initValidation()->prepare()->run()->result($currency); |
@@ -107,27 +107,27 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $result = $this->config['starter'].' '; |
| 109 | 109 | |
| 110 | - if ($this->is_main1_currency){ |
|
| 110 | + if ($this->is_main1_currency) { |
|
| 111 | 111 | $result .= $this->result_before_comma.' '.$this->config['currencies'][$currency]['main1']; |
| 112 | 112 | |
| 113 | - }else{ |
|
| 113 | + }else { |
|
| 114 | 114 | $result .= $this->result_before_comma.' '.$this->config['currencies'][$currency]['main2']; |
| 115 | 115 | |
| 116 | 116 | } |
| 117 | - if ($this->after_comma_len >= 1 && $this->after_comma_sum != 00){ |
|
| 118 | - if (in_array($this->after_comma_sum,[ |
|
| 119 | - 3,4,5,6,7,8,9,10 |
|
| 120 | - ])){ |
|
| 117 | + if ($this->after_comma_len>=1 && $this->after_comma_sum != 00) { |
|
| 118 | + if (in_array($this->after_comma_sum, [ |
|
| 119 | + 3, 4, 5, 6, 7, 8, 9, 10 |
|
| 120 | + ])) { |
|
| 121 | 121 | $result .= $this->config['connection_tool'].$this->result_after_comma.' '. |
| 122 | 122 | $this->config['currencies'][$currency]['multi']; |
| 123 | - }else{ |
|
| 123 | + }else { |
|
| 124 | 124 | $result .= $this->config['connection_tool'].$this->result_after_comma.' '. |
| 125 | 125 | $this->config['currencies'][$currency]['single']; |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | $result .= ' '.$this->config['end']; |
| 129 | 129 | |
| 130 | - return str_replace(' ',' ',$result); |
|
| 130 | + return str_replace(' ', ' ', $result); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if ($this->is_main1_currency){ |
| 111 | 111 | $result .= $this->result_before_comma.' '.$this->config['currencies'][$currency]['main1']; |
| 112 | 112 | |
| 113 | - }else{ |
|
| 113 | + } else{ |
|
| 114 | 114 | $result .= $this->result_before_comma.' '.$this->config['currencies'][$currency]['main2']; |
| 115 | 115 | |
| 116 | 116 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ])){ |
| 121 | 121 | $result .= $this->config['connection_tool'].$this->result_after_comma.' '. |
| 122 | 122 | $this->config['currencies'][$currency]['multi']; |
| 123 | - }else{ |
|
| 123 | + } else{ |
|
| 124 | 124 | $result .= $this->config['connection_tool'].$this->result_after_comma.' '. |
| 125 | 125 | $this->config['currencies'][$currency]['single']; |
| 126 | 126 | } |