@@ -18,165 +18,165 @@ |
||
18 | 18 | //$dateArray[0] is number, $dateArray[1] is the time period , $dateArray[2] is the word ago |
19 | 19 | $time = $dateArray[1]; |
20 | 20 | // handl seconds |
21 | - if((new self)->isSecond($time)) |
|
21 | + if ((new self)->isSecond($time)) |
|
22 | 22 | { |
23 | - if($dateArray[0] == 1) |
|
23 | + if ($dateArray[0] == 1) |
|
24 | 24 | { |
25 | 25 | return $zaman."ثانية واحدة"; |
26 | - } elseif($dateArray[0] == 2) |
|
26 | + } elseif ($dateArray[0] == 2) |
|
27 | 27 | { |
28 | - return $zaman. "ثانيتين"; |
|
29 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
28 | + return $zaman."ثانيتين"; |
|
29 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
30 | 30 | { |
31 | - return $zaman. $dateArray[0] . " ثواني"; |
|
31 | + return $zaman.$dateArray[0]." ثواني"; |
|
32 | 32 | } else |
33 | 33 | { |
34 | - return $zaman. $dateArray[0] . " ثانية"; |
|
34 | + return $zaman.$dateArray[0]." ثانية"; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | // handl minutes |
38 | - if((new self)->isMinute($time)) |
|
38 | + if ((new self)->isMinute($time)) |
|
39 | 39 | { |
40 | - if($dateArray[0] == 1) |
|
40 | + if ($dateArray[0] == 1) |
|
41 | 41 | { |
42 | 42 | return $zaman."دقيقة واحدة"; |
43 | - } elseif($dateArray[0] == 2) |
|
43 | + } elseif ($dateArray[0] == 2) |
|
44 | 44 | { |
45 | - return $zaman. "دقيقتين"; |
|
46 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
45 | + return $zaman."دقيقتين"; |
|
46 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
47 | 47 | { |
48 | - return $zaman. $dateArray[0] . " دقائق"; |
|
48 | + return $zaman.$dateArray[0]." دقائق"; |
|
49 | 49 | } else |
50 | 50 | { |
51 | - return $zaman. $dateArray[0] . " دقيقة"; |
|
51 | + return $zaman.$dateArray[0]." دقيقة"; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | // handl hours |
55 | - if((new self)->isHour($time)) |
|
55 | + if ((new self)->isHour($time)) |
|
56 | 56 | { |
57 | - if($dateArray[0] == 1) |
|
57 | + if ($dateArray[0] == 1) |
|
58 | 58 | { |
59 | 59 | return $zaman."ساعة"; |
60 | - } elseif($dateArray[0] == 2) |
|
60 | + } elseif ($dateArray[0] == 2) |
|
61 | 61 | { |
62 | - return $zaman. "ساعتين"; |
|
63 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
62 | + return $zaman."ساعتين"; |
|
63 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
64 | 64 | { |
65 | - return $zaman. $dateArray[0] . " ساعات"; |
|
65 | + return $zaman.$dateArray[0]." ساعات"; |
|
66 | 66 | } else |
67 | 67 | { |
68 | - return $zaman. $dateArray[0] . " ساعة"; |
|
68 | + return $zaman.$dateArray[0]." ساعة"; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | // handl days |
72 | - if((new self)->isDay($time)) |
|
72 | + if ((new self)->isDay($time)) |
|
73 | 73 | { |
74 | - if($dateArray[0] == 1) |
|
74 | + if ($dateArray[0] == 1) |
|
75 | 75 | { |
76 | 76 | return $zaman." يوم"; |
77 | - } elseif($dateArray[0] == 2) |
|
77 | + } elseif ($dateArray[0] == 2) |
|
78 | 78 | { |
79 | - return $zaman. "يومين"; |
|
80 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
79 | + return $zaman."يومين"; |
|
80 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
81 | 81 | { |
82 | - return $zaman. $dateArray[0] . " أيام"; |
|
82 | + return $zaman.$dateArray[0]." أيام"; |
|
83 | 83 | } else |
84 | 84 | { |
85 | - return $zaman. $dateArray[0] . " يوم"; |
|
85 | + return $zaman.$dateArray[0]." يوم"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | // handl weeks |
89 | - if((new self)->isWeek($time)) |
|
89 | + if ((new self)->isWeek($time)) |
|
90 | 90 | { |
91 | - if($dateArray[0] == 1) |
|
91 | + if ($dateArray[0] == 1) |
|
92 | 92 | { |
93 | 93 | return $zaman." أسبوع"; |
94 | - } elseif($dateArray[0] == 2) |
|
94 | + } elseif ($dateArray[0] == 2) |
|
95 | 95 | { |
96 | - return $zaman. " أسبوعين"; |
|
97 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
96 | + return $zaman." أسبوعين"; |
|
97 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
98 | 98 | { |
99 | - return $zaman. $dateArray[0] . " أسابيع"; |
|
99 | + return $zaman.$dateArray[0]." أسابيع"; |
|
100 | 100 | } else |
101 | 101 | { |
102 | - return $zaman. $dateArray[0] . " أسبوع"; |
|
102 | + return $zaman.$dateArray[0]." أسبوع"; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | // handl months |
106 | - if((new self)->isMonth($time)) |
|
106 | + if ((new self)->isMonth($time)) |
|
107 | 107 | { |
108 | - if($dateArray[0] == 1) |
|
108 | + if ($dateArray[0] == 1) |
|
109 | 109 | { |
110 | 110 | return $zaman."شهر"; |
111 | - } elseif($dateArray[0] == 2) |
|
111 | + } elseif ($dateArray[0] == 2) |
|
112 | 112 | { |
113 | - return $zaman. " شهرين"; |
|
114 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
113 | + return $zaman." شهرين"; |
|
114 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
115 | 115 | { |
116 | - return $zaman. $dateArray[0] . " شهور"; |
|
116 | + return $zaman.$dateArray[0]." شهور"; |
|
117 | 117 | } else |
118 | 118 | { |
119 | - return $zaman. $dateArray[0] . " شهر"; |
|
119 | + return $zaman.$dateArray[0]." شهر"; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | // handl years |
123 | - if((new self)->isYear($time)) |
|
123 | + if ((new self)->isYear($time)) |
|
124 | 124 | { |
125 | - if($dateArray[0] == 1) |
|
125 | + if ($dateArray[0] == 1) |
|
126 | 126 | { |
127 | 127 | return $zaman."سنة"; |
128 | - } elseif($dateArray[0] == 2) |
|
128 | + } elseif ($dateArray[0] == 2) |
|
129 | 129 | { |
130 | - return $zaman. " سنتين"; |
|
131 | - } elseif($dateArray[0] >= 3 && $dateArray[0] <= 10 ) |
|
130 | + return $zaman." سنتين"; |
|
131 | + } elseif ($dateArray[0] >= 3 && $dateArray[0] <= 10) |
|
132 | 132 | { |
133 | - return $zaman. $dateArray[0] . " سنوات"; |
|
133 | + return $zaman.$dateArray[0]." سنوات"; |
|
134 | 134 | } else |
135 | 135 | { |
136 | - return $zaman. $dateArray[0] . " سنة"; |
|
136 | + return $zaman.$dateArray[0]." سنة"; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | public function isSecond($time) |
142 | 142 | { |
143 | - Str::startsWith($time,'second') ? $isSecond = true : $isSecond = false ; |
|
143 | + Str::startsWith($time, 'second') ? $isSecond = true : $isSecond = false; |
|
144 | 144 | return $isSecond; |
145 | 145 | } |
146 | 146 | |
147 | 147 | public function isMinute($time) |
148 | 148 | { |
149 | - Str::startsWith($time,'minute') ? $isMinute = true : $isMinute = false ; |
|
149 | + Str::startsWith($time, 'minute') ? $isMinute = true : $isMinute = false; |
|
150 | 150 | return $isMinute; |
151 | 151 | } |
152 | 152 | |
153 | 153 | public function isHour($time) |
154 | 154 | { |
155 | - Str::startsWith($time,'hour') ? $isHour = true : $isHour = false ; |
|
155 | + Str::startsWith($time, 'hour') ? $isHour = true : $isHour = false; |
|
156 | 156 | return $isHour; |
157 | 157 | } |
158 | 158 | |
159 | 159 | public function isDay($time) |
160 | 160 | { |
161 | - Str::startsWith($time,'day') ? $isDay = true : $isDay = false ; |
|
161 | + Str::startsWith($time, 'day') ? $isDay = true : $isDay = false; |
|
162 | 162 | return $isDay; |
163 | 163 | } |
164 | 164 | |
165 | 165 | public function isWeek($time) |
166 | 166 | { |
167 | - Str::startsWith($time,'week') ? $isWeek = true : $isWeek = false ; |
|
167 | + Str::startsWith($time, 'week') ? $isWeek = true : $isWeek = false; |
|
168 | 168 | return $isWeek; |
169 | 169 | } |
170 | 170 | |
171 | 171 | public function isMonth($time) |
172 | 172 | { |
173 | - Str::startsWith($time,'month') ? $isMonth = true : $isMonth = false ; |
|
173 | + Str::startsWith($time, 'month') ? $isMonth = true : $isMonth = false; |
|
174 | 174 | return $isMonth; |
175 | 175 | } |
176 | 176 | |
177 | 177 | public function isYear($time) |
178 | 178 | { |
179 | - Str::startsWith($time,'year') ? $isYear = true : $isYear = false ; |
|
179 | + Str::startsWith($time, 'year') ? $isYear = true : $isYear = false; |
|
180 | 180 | return $isYear; |
181 | 181 | } |
182 | 182 |