@@ -18,222 +18,222 @@ |
||
18 | 18 | //$period is number, $dateArray[1] is the time $dateArray[0] , $dateArray[2] is the word ago |
19 | 19 | $time = $dateArray[1]; |
20 | 20 | $period = $dateArray[0]; |
21 | - if((new self)->isSecond($time)) |
|
21 | + if ((new self)->isSecond($time)) |
|
22 | 22 | { |
23 | - return (new self)->handelSeconds($period,$zaman); |
|
23 | + return (new self)->handelSeconds($period, $zaman); |
|
24 | 24 | } |
25 | 25 | // handl minutes |
26 | - if((new self)->isMinute($time)) |
|
26 | + if ((new self)->isMinute($time)) |
|
27 | 27 | { |
28 | - return (new self)->handelMinutes($period,$zaman); |
|
28 | + return (new self)->handelMinutes($period, $zaman); |
|
29 | 29 | } |
30 | 30 | // handl hours |
31 | - if((new self)->isHour($time)) |
|
31 | + if ((new self)->isHour($time)) |
|
32 | 32 | { |
33 | - return (new self)->handelHours($period,$zaman); |
|
33 | + return (new self)->handelHours($period, $zaman); |
|
34 | 34 | } |
35 | 35 | // handl days |
36 | - if((new self)->isDay($time)) |
|
36 | + if ((new self)->isDay($time)) |
|
37 | 37 | { |
38 | - return (new self)->handelDays($period,$zaman); |
|
38 | + return (new self)->handelDays($period, $zaman); |
|
39 | 39 | } |
40 | 40 | // handl weeks |
41 | - if((new self)->isWeek($time)) |
|
41 | + if ((new self)->isWeek($time)) |
|
42 | 42 | { |
43 | - return (new self)->handelWeeks($period,$zaman); |
|
43 | + return (new self)->handelWeeks($period, $zaman); |
|
44 | 44 | } |
45 | 45 | // handl months |
46 | - if((new self)->isMonth($time)) |
|
46 | + if ((new self)->isMonth($time)) |
|
47 | 47 | { |
48 | - return (new self)->handelMonths($period,$zaman); |
|
48 | + return (new self)->handelMonths($period, $zaman); |
|
49 | 49 | } |
50 | 50 | // handl years |
51 | - if((new self)->isYear($time)) |
|
51 | + if ((new self)->isYear($time)) |
|
52 | 52 | { |
53 | - return (new self)->handelYears($period,$zaman); |
|
53 | + return (new self)->handelYears($period, $zaman); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | 57 | public function isSecond($time) |
58 | 58 | { |
59 | - Str::startsWith($time,'second') ? $isSecond = true : $isSecond = false ; |
|
59 | + Str::startsWith($time, 'second') ? $isSecond = true : $isSecond = false; |
|
60 | 60 | return $isSecond; |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function isMinute($time) |
64 | 64 | { |
65 | - Str::startsWith($time,'minute') ? $isMinute = true : $isMinute = false ; |
|
65 | + Str::startsWith($time, 'minute') ? $isMinute = true : $isMinute = false; |
|
66 | 66 | return $isMinute; |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function isHour($time) |
70 | 70 | { |
71 | - Str::startsWith($time,'hour') ? $isHour = true : $isHour = false ; |
|
71 | + Str::startsWith($time, 'hour') ? $isHour = true : $isHour = false; |
|
72 | 72 | return $isHour; |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function isDay($time) |
76 | 76 | { |
77 | - Str::startsWith($time,'day') ? $isDay = true : $isDay = false ; |
|
77 | + Str::startsWith($time, 'day') ? $isDay = true : $isDay = false; |
|
78 | 78 | return $isDay; |
79 | 79 | } |
80 | 80 | |
81 | 81 | public function isWeek($time) |
82 | 82 | { |
83 | - Str::startsWith($time,'week') ? $isWeek = true : $isWeek = false ; |
|
83 | + Str::startsWith($time, 'week') ? $isWeek = true : $isWeek = false; |
|
84 | 84 | return $isWeek; |
85 | 85 | } |
86 | 86 | |
87 | 87 | public function isMonth($time) |
88 | 88 | { |
89 | - Str::startsWith($time,'month') ? $isMonth = true : $isMonth = false ; |
|
89 | + Str::startsWith($time, 'month') ? $isMonth = true : $isMonth = false; |
|
90 | 90 | return $isMonth; |
91 | 91 | } |
92 | 92 | |
93 | 93 | public function isYear($time) |
94 | 94 | { |
95 | - Str::startsWith($time,'year') ? $isYear = true : $isYear = false ; |
|
95 | + Str::startsWith($time, 'year') ? $isYear = true : $isYear = false; |
|
96 | 96 | return $isYear; |
97 | 97 | } |
98 | 98 | |
99 | - public function handelSeconds($period,$zaman) |
|
99 | + public function handelSeconds($period, $zaman) |
|
100 | 100 | { |
101 | 101 | // handl seconds |
102 | - if($period == 1) |
|
102 | + if ($period == 1) |
|
103 | 103 | { |
104 | 104 | return $zaman."ثانية واحدة"; |
105 | 105 | } |
106 | - elseif($period == 2) |
|
106 | + elseif ($period == 2) |
|
107 | 107 | { |
108 | - return $zaman. "ثانيتين"; |
|
108 | + return $zaman."ثانيتين"; |
|
109 | 109 | } |
110 | - elseif($period >= 3 && $period <= 10 ) |
|
110 | + elseif ($period >= 3 && $period <= 10) |
|
111 | 111 | { |
112 | - return $zaman. $period . " ثواني"; |
|
112 | + return $zaman.$period." ثواني"; |
|
113 | 113 | } |
114 | 114 | else |
115 | 115 | { |
116 | - return $zaman. $period . " ثانية"; |
|
116 | + return $zaman.$period." ثانية"; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - public function handelMinutes($period,$zaman) |
|
120 | + public function handelMinutes($period, $zaman) |
|
121 | 121 | { |
122 | - if($period == 1) |
|
122 | + if ($period == 1) |
|
123 | 123 | { |
124 | 124 | return $zaman."دقيقة واحدة"; |
125 | 125 | } |
126 | - elseif($period == 2) |
|
126 | + elseif ($period == 2) |
|
127 | 127 | { |
128 | - return $zaman. "دقيقتين"; |
|
128 | + return $zaman."دقيقتين"; |
|
129 | 129 | } |
130 | - elseif($period >= 3 && $period <= 10 ) |
|
130 | + elseif ($period >= 3 && $period <= 10) |
|
131 | 131 | { |
132 | - return $zaman. $period . " دقائق"; |
|
132 | + return $zaman.$period." دقائق"; |
|
133 | 133 | } |
134 | 134 | else |
135 | 135 | { |
136 | - return $zaman. $period . " دقيقة"; |
|
136 | + return $zaman.$period." دقيقة"; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - public function handelHours($period,$zaman) |
|
140 | + public function handelHours($period, $zaman) |
|
141 | 141 | { |
142 | - if($period == 1) |
|
142 | + if ($period == 1) |
|
143 | 143 | { |
144 | 144 | return $zaman."ساعة"; |
145 | 145 | } |
146 | - elseif($period == 2) |
|
146 | + elseif ($period == 2) |
|
147 | 147 | { |
148 | - return $zaman. "ساعتين"; |
|
148 | + return $zaman."ساعتين"; |
|
149 | 149 | } |
150 | - elseif($period >= 3 && $period <= 10 ) |
|
150 | + elseif ($period >= 3 && $period <= 10) |
|
151 | 151 | { |
152 | - return $zaman. $period . " ساعات"; |
|
152 | + return $zaman.$period." ساعات"; |
|
153 | 153 | } |
154 | 154 | else |
155 | 155 | { |
156 | - return $zaman. $period . " ساعة"; |
|
156 | + return $zaman.$period." ساعة"; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - public function handelDays($period,$zaman) |
|
160 | + public function handelDays($period, $zaman) |
|
161 | 161 | { |
162 | - if($period == 1) |
|
162 | + if ($period == 1) |
|
163 | 163 | { |
164 | 164 | return $zaman." يوم"; |
165 | 165 | } |
166 | - elseif($period == 2) |
|
166 | + elseif ($period == 2) |
|
167 | 167 | { |
168 | - return $zaman. "يومين"; |
|
168 | + return $zaman."يومين"; |
|
169 | 169 | } |
170 | - elseif($period >= 3 && $period <= 10 ) |
|
170 | + elseif ($period >= 3 && $period <= 10) |
|
171 | 171 | { |
172 | - return $zaman. $period . " أيام"; |
|
172 | + return $zaman.$period." أيام"; |
|
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
176 | - return $zaman. $period . " يوم"; |
|
176 | + return $zaman.$period." يوم"; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - public function handelWeeks($period,$zaman) |
|
180 | + public function handelWeeks($period, $zaman) |
|
181 | 181 | { |
182 | - if($period == 1) |
|
182 | + if ($period == 1) |
|
183 | 183 | { |
184 | 184 | return $zaman." أسبوع"; |
185 | 185 | } |
186 | - elseif($period == 2) |
|
186 | + elseif ($period == 2) |
|
187 | 187 | { |
188 | - return $zaman. " أسبوعين"; |
|
188 | + return $zaman." أسبوعين"; |
|
189 | 189 | } |
190 | - elseif($period >= 3 && $period <= 10 ) |
|
190 | + elseif ($period >= 3 && $period <= 10) |
|
191 | 191 | { |
192 | - return $zaman. $period . " أسابيع"; |
|
192 | + return $zaman.$period." أسابيع"; |
|
193 | 193 | } |
194 | 194 | else |
195 | 195 | { |
196 | - return $zaman. $period . " أسبوع"; |
|
196 | + return $zaman.$period." أسبوع"; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - public function handelMonths($period,$zaman) |
|
200 | + public function handelMonths($period, $zaman) |
|
201 | 201 | { |
202 | - if($period == 1) |
|
202 | + if ($period == 1) |
|
203 | 203 | { |
204 | 204 | return $zaman."شهر"; |
205 | 205 | } |
206 | - elseif($period == 2) |
|
206 | + elseif ($period == 2) |
|
207 | 207 | { |
208 | - return $zaman. " شهرين"; |
|
208 | + return $zaman." شهرين"; |
|
209 | 209 | } |
210 | - elseif($period >= 3 && $period <= 10 ) |
|
210 | + elseif ($period >= 3 && $period <= 10) |
|
211 | 211 | { |
212 | - return $zaman. $period . " شهور"; |
|
212 | + return $zaman.$period." شهور"; |
|
213 | 213 | } |
214 | 214 | else |
215 | 215 | { |
216 | - return $zaman. $period . " شهر"; |
|
216 | + return $zaman.$period." شهر"; |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - public function handelYears($period,$zaman) |
|
220 | + public function handelYears($period, $zaman) |
|
221 | 221 | { |
222 | - if($period == 1) |
|
222 | + if ($period == 1) |
|
223 | 223 | { |
224 | 224 | return $zaman."سنة"; |
225 | 225 | } |
226 | - elseif($period == 2) |
|
226 | + elseif ($period == 2) |
|
227 | 227 | { |
228 | - return $zaman. " سنتين"; |
|
228 | + return $zaman." سنتين"; |
|
229 | 229 | } |
230 | - elseif($period >= 3 && $period <= 10 ) |
|
230 | + elseif ($period >= 3 && $period <= 10) |
|
231 | 231 | { |
232 | - return $zaman. $period . " سنوات"; |
|
232 | + return $zaman.$period." سنوات"; |
|
233 | 233 | } |
234 | 234 | else |
235 | 235 | { |
236 | - return $zaman. $period . " سنة"; |
|
236 | + return $zaman.$period." سنة"; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 |
@@ -102,16 +102,13 @@ discard block |
||
102 | 102 | if($period == 1) |
103 | 103 | { |
104 | 104 | return $zaman."ثانية واحدة"; |
105 | - } |
|
106 | - elseif($period == 2) |
|
105 | + } elseif($period == 2) |
|
107 | 106 | { |
108 | 107 | return $zaman. "ثانيتين"; |
109 | - } |
|
110 | - elseif($period >= 3 && $period <= 10 ) |
|
108 | + } elseif($period >= 3 && $period <= 10 ) |
|
111 | 109 | { |
112 | 110 | return $zaman. $period . " ثواني"; |
113 | - } |
|
114 | - else |
|
111 | + } else |
|
115 | 112 | { |
116 | 113 | return $zaman. $period . " ثانية"; |
117 | 114 | } |
@@ -122,16 +119,13 @@ discard block |
||
122 | 119 | if($period == 1) |
123 | 120 | { |
124 | 121 | return $zaman."دقيقة واحدة"; |
125 | - } |
|
126 | - elseif($period == 2) |
|
122 | + } elseif($period == 2) |
|
127 | 123 | { |
128 | 124 | return $zaman. "دقيقتين"; |
129 | - } |
|
130 | - elseif($period >= 3 && $period <= 10 ) |
|
125 | + } elseif($period >= 3 && $period <= 10 ) |
|
131 | 126 | { |
132 | 127 | return $zaman. $period . " دقائق"; |
133 | - } |
|
134 | - else |
|
128 | + } else |
|
135 | 129 | { |
136 | 130 | return $zaman. $period . " دقيقة"; |
137 | 131 | } |
@@ -142,16 +136,13 @@ discard block |
||
142 | 136 | if($period == 1) |
143 | 137 | { |
144 | 138 | return $zaman."ساعة"; |
145 | - } |
|
146 | - elseif($period == 2) |
|
139 | + } elseif($period == 2) |
|
147 | 140 | { |
148 | 141 | return $zaman. "ساعتين"; |
149 | - } |
|
150 | - elseif($period >= 3 && $period <= 10 ) |
|
142 | + } elseif($period >= 3 && $period <= 10 ) |
|
151 | 143 | { |
152 | 144 | return $zaman. $period . " ساعات"; |
153 | - } |
|
154 | - else |
|
145 | + } else |
|
155 | 146 | { |
156 | 147 | return $zaman. $period . " ساعة"; |
157 | 148 | } |
@@ -162,16 +153,13 @@ discard block |
||
162 | 153 | if($period == 1) |
163 | 154 | { |
164 | 155 | return $zaman." يوم"; |
165 | - } |
|
166 | - elseif($period == 2) |
|
156 | + } elseif($period == 2) |
|
167 | 157 | { |
168 | 158 | return $zaman. "يومين"; |
169 | - } |
|
170 | - elseif($period >= 3 && $period <= 10 ) |
|
159 | + } elseif($period >= 3 && $period <= 10 ) |
|
171 | 160 | { |
172 | 161 | return $zaman. $period . " أيام"; |
173 | - } |
|
174 | - else |
|
162 | + } else |
|
175 | 163 | { |
176 | 164 | return $zaman. $period . " يوم"; |
177 | 165 | } |
@@ -182,16 +170,13 @@ discard block |
||
182 | 170 | if($period == 1) |
183 | 171 | { |
184 | 172 | return $zaman." أسبوع"; |
185 | - } |
|
186 | - elseif($period == 2) |
|
173 | + } elseif($period == 2) |
|
187 | 174 | { |
188 | 175 | return $zaman. " أسبوعين"; |
189 | - } |
|
190 | - elseif($period >= 3 && $period <= 10 ) |
|
176 | + } elseif($period >= 3 && $period <= 10 ) |
|
191 | 177 | { |
192 | 178 | return $zaman. $period . " أسابيع"; |
193 | - } |
|
194 | - else |
|
179 | + } else |
|
195 | 180 | { |
196 | 181 | return $zaman. $period . " أسبوع"; |
197 | 182 | } |
@@ -202,16 +187,13 @@ discard block |
||
202 | 187 | if($period == 1) |
203 | 188 | { |
204 | 189 | return $zaman."شهر"; |
205 | - } |
|
206 | - elseif($period == 2) |
|
190 | + } elseif($period == 2) |
|
207 | 191 | { |
208 | 192 | return $zaman. " شهرين"; |
209 | - } |
|
210 | - elseif($period >= 3 && $period <= 10 ) |
|
193 | + } elseif($period >= 3 && $period <= 10 ) |
|
211 | 194 | { |
212 | 195 | return $zaman. $period . " شهور"; |
213 | - } |
|
214 | - else |
|
196 | + } else |
|
215 | 197 | { |
216 | 198 | return $zaman. $period . " شهر"; |
217 | 199 | } |
@@ -222,16 +204,13 @@ discard block |
||
222 | 204 | if($period == 1) |
223 | 205 | { |
224 | 206 | return $zaman."سنة"; |
225 | - } |
|
226 | - elseif($period == 2) |
|
207 | + } elseif($period == 2) |
|
227 | 208 | { |
228 | 209 | return $zaman. " سنتين"; |
229 | - } |
|
230 | - elseif($period >= 3 && $period <= 10 ) |
|
210 | + } elseif($period >= 3 && $period <= 10 ) |
|
231 | 211 | { |
232 | 212 | return $zaman. $period . " سنوات"; |
233 | - } |
|
234 | - else |
|
213 | + } else |
|
235 | 214 | { |
236 | 215 | return $zaman. $period . " سنة"; |
237 | 216 | } |