Passed
Push — master ( e0289d...7be948 )
by Mohammed
03:41 queued 01:43
created
src/helpers/App.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,46 +21,46 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/helpers/Calculators.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -41,207 +41,207 @@
 block discarded – undo
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]] ;
128
-            } else {
129
-                            $thousands =  $this->ones[$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
+            }else {
129
+                            $thousands = $this->ones[$arr[1]].$conn.$this->tens[$arr[0]];
130 130
             }
131 131
 
132
-            if($arr[1] == 0)
132
+            if ($arr[1] == 0)
133 133
             {
134
-                if($arr[0]==1)
134
+                if ($arr[0] == 1)
135 135
                 {
136
-                    $thousands =  $this->ones[10] ;
137
-                    $thousands.=' ' . $this->thousands[39];
138
-                } else
136
+                    $thousands = $this->ones[10];
137
+                    $thousands .= ' '.$this->thousands[39];
138
+                }else
139 139
                 {
140
-                    $thousands =  $this->tens[$arr[0]] ;
141
-                    $thousands.=' ' . $this->thousands[1];
140
+                    $thousands = $this->tens[$arr[0]];
141
+                    $thousands .= ' '.$this->thousands[1];
142 142
                 }
143 143
 
144
-            } else{
145
-                if($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0)
144
+            }else {
145
+                if ($arr[2] == 0 and $arr[3] == 0 and $arr[4] == 0)
146 146
                 {
147
-                    $thousands.=' ' . $this->thousands[1];
148
-                } else
147
+                    $thousands .= ' '.$this->thousands[1];
148
+                }else
149 149
                 {
150
-                    $thousands.=' ' . $this->thousands[1199];
150
+                    $thousands .= ' '.$this->thousands[1199];
151 151
                 }
152 152
 
153 153
             }
154 154
 
155
-        } else
155
+        }else
156 156
         {
157
-            if(in_array($arr[1],[2,1])) {
158
-                            $thousands =  $this->others[$arr[1]]  . ' '  ;
159
-            } else {
160
-                            $thousands =  $this->ones[$arr[1]]  . ' ' ;
157
+            if (in_array($arr[1], [2, 1])) {
158
+                            $thousands = $this->others[$arr[1]].' ';
159
+            }else {
160
+                            $thousands = $this->ones[$arr[1]].' ';
161 161
             }
162 162
 
163 163
 
164
-            if($arr[1] == 0)
164
+            if ($arr[1] == 0)
165 165
             {
166
-                $thousands =  $this->tens[$arr[2]] ;
166
+                $thousands = $this->tens[$arr[2]];
167 167
             }
168 168
 
169
-            $thousands.=' ' . $this->thousands[39];
169
+            $thousands .= ' '.$this->thousands[39];
170 170
         }
171
-        if($this->classC($classC) != '' )
171
+        if ($this->classC($classC) != '')
172 172
         {
173
-            return $thousands . $this->config['connection_tool'] . $this->classC($classC);
173
+            return $thousands.$this->config['connection_tool'].$this->classC($classC);
174 174
         }
175 175
         return $thousands;
176 176
     }
177 177
 
178
-    public function classF($arr,$len = 6)
178
+    public function classF($arr, $len = 6)
179 179
     {
180
-        $classC = [$arr[3],$arr[4],$arr[5]];
181
-        if($arr[0]!=0)
180
+        $classC = [$arr[3], $arr[4], $arr[5]];
181
+        if ($arr[0] != 0)
182 182
         {
183
-            if($arr[1] == 0 && $arr[2]==0)
183
+            if ($arr[1] == 0 && $arr[2] == 0)
184 184
             {
185
-                $thousands =  $this->hundreds[$arr[0]] .' '. $this->thousands[1];
186
-            }else{
187
-                if($arr[1] == 0 )
185
+                $thousands = $this->hundreds[$arr[0]].' '.$this->thousands[1];
186
+            }else {
187
+                if ($arr[1] == 0)
188 188
                 {
189
-                    $thousands =  $this->hundreds[$arr[0]] .$this->config['connection_tool'].
190
-                        $this->ones[$arr[2]]  . ' '. $this->thousands[1];
191
-                }elseif($arr[2] == 0)
189
+                    $thousands = $this->hundreds[$arr[0]].$this->config['connection_tool'].
190
+                        $this->ones[$arr[2]].' '.$this->thousands[1];
191
+                }elseif ($arr[2] == 0)
192 192
                 {
193
-                    if($arr[3] == 0 and $arr[4] == 0 and $arr[5] == 0)
193
+                    if ($arr[3] == 0 and $arr[4] == 0 and $arr[5] == 0)
194 194
                     {
195 195
 
196
-                        $thousands =  $this->hundreds[$arr[0]] .$this->config['connection_tool'].
197
-                            $this->tens[$arr[1]]  . ' '. $this->thousands[1];
196
+                        $thousands = $this->hundreds[$arr[0]].$this->config['connection_tool'].
197
+                            $this->tens[$arr[1]].' '.$this->thousands[1];
198 198
 
199
-                    } else
199
+                    }else
200 200
                     {
201
-                        $thousands =  $this->hundreds[$arr[0]] .$this->config['connection_tool'].
202
-                            $this->tens[$arr[1]]  . ' '. $this->thousands[1199];
201
+                        $thousands = $this->hundreds[$arr[0]].$this->config['connection_tool'].
202
+                            $this->tens[$arr[1]].' '.$this->thousands[1199];
203 203
                     }
204
-                } else
204
+                }else
205 205
                 {
206 206
 //                    $thousands_lang = $this->thousands[1199];
207
-                    if($arr[1]==0 and $arr[2]>=1 and $arr[1]<=10) {
207
+                    if ($arr[1] == 0 and $arr[2]>=1 and $arr[1]<=10) {
208 208
                                             $thousands_lang = $this->thousands[1];
209
-                    } elseif($arr[1]>=1 and $arr[2]>=1 and $arr[1]<=9) {
209
+                    } elseif ($arr[1]>=1 and $arr[2]>=1 and $arr[1]<=9) {
210 210
                                             $thousands_lang = $this->thousands[1199];
211
-                    } elseif($arr[1]>=2) {
211
+                    } elseif ($arr[1]>=2) {
212 212
                                             $thousands_lang = $this->thousands[1199];
213 213
                     }
214 214
 
215 215
 
216
-                    $thousands = $this->classC([$arr[0],$arr[1],$arr[2]],3) . ' '. $thousands_lang;
216
+                    $thousands = $this->classC([$arr[0], $arr[1], $arr[2]], 3).' '.$thousands_lang;
217 217
 
218 218
                 }
219 219
             }
220 220
 
221 221
         }else
222 222
         {
223
-            return $this->classE([$arr[1],$arr[2],$arr[3],$arr[4],$arr[5]]);
223
+            return $this->classE([$arr[1], $arr[2], $arr[3], $arr[4], $arr[5]]);
224 224
         }
225 225
 
226
-        if($this->classC($classC)!='')
227
-                return $thousands . $this->config['connection_tool'] . $this->classC($classC);
226
+        if ($this->classC($classC) != '')
227
+                return $thousands.$this->config['connection_tool'].$this->classC($classC);
228 228
         return $thousands;
229 229
 
230 230
     }
231 231
 
232
-    public function classG($arr,$len = 7)
232
+    public function classG($arr, $len = 7)
233 233
     {
234 234
         //$classC = [$arr[2],$arr[4],$arr[5]];
235 235
         //$classC = [$arr[1],$arr[2],$arr[3]];
236
-        $classE = [$arr[1],$arr[2],$arr[3],$arr[4],$arr[5],$arr[6]];
236
+        $classE = [$arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]];
237 237
 
238
-        if($arr[0]<=2) {
239
-                    $million = $this->millions[$arr[0]] ;
240
-        } else {
241
-                    $million = $this->ones[$arr[0]] . ' ' . $this->millions['39'];
238
+        if ($arr[0]<=2) {
239
+                    $million = $this->millions[$arr[0]];
240
+        }else {
241
+                    $million = $this->ones[$arr[0]].' '.$this->millions['39'];
242 242
         }
243 243
 
244
-        return $million . $this->config['connection_tool'] . $this->classF($classE);
244
+        return $million.$this->config['connection_tool'].$this->classF($classE);
245 245
 
246 246
     }
247 247
 //    public function classH($arr,$len = 8)
Please login to merge, or discard this patch.
src/Tafqeet.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         /**
Please login to merge, or discard this patch.