Completed
Branch master (07b0df)
by judicael
05:36 queued 02:38
created
bundles/lib/Date.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public static function getWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : Date
43 43
     {
44
-        $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
44
+        $iFirstDayInYear = date("N", mktime(0, 0, 0, 1, 1, $iYear));
45 45
 
46 46
         if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; }
47 47
 
48
-        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; }
48
+        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek - 1) * 604800; } else { $iWeekInSeconds = 0; }
49 49
 
50 50
         $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift;
51 51
         $iTimestampLastDay = mktime(0, 0, 0, 1, 6, $iYear) + $iWeekInSeconds + $iShift + 604800;
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public static function getMiddleWeek(int $iWeek, int $iYear, string $sFormat = "Y-m-d") : array
158 158
     {
159
-        $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
159
+        $iFirstDayInYear = date("N", mktime(0, 0, 0, 1, 1, $iYear));
160 160
 
161 161
         if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; }
162 162
         else { $iShift = (8 - $iFirstDayInYear) * 86400; }
163 163
 
164
-        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; }
164
+        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek - 1) * 604800; }
165 165
         else { $iWeekInSeconds = 0; }
166 166
 
167 167
         if (date('N') > 2) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         if (preg_replace('/^([0-9]+)-[0-9]+-[0-9]+$/', '$1', $aDates[0]) != date('Y')) {
181 181
 
182 182
             $aDates[0] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', date('Y').'$1', $aDates[0]);
183
-            $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y')+1).'$1', $aDates[1]);
183
+            $aDates[1] = preg_replace('/^[0-9]+(-[0-9]+-[0-9]+)$/', (date('Y') + 1).'$1', $aDates[1]);
184 184
         }
185 185
 
186 186
         return $aDates;
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
         $oDateTime = DateTime::createFromFormat('Y-m-d H:i:s', $sDateTime);
222 222
         $iTimeStamp = time() - $oDateTime->getTimestamp();
223 223
 
224
-        if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; }
225
-        if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; }
226
-        if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; }
227
-        if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; }
228
-        else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; }
224
+        if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp / 60).' '.$sMinutes.$sEndReturn; }
225
+        if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp / 3600).' '.$sHours.$sEndReturn; }
226
+        if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp / 86400).' '.$sDays.$sEndReturn; }
227
+        if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp / 2592000).' '.$sMonths.$sEndReturn; }
228
+        else { return $sStartReturn.' '.(int)($iTimeStamp / 31536000).' '.$sYears.$sEndReturn; }
229 229
     }
230 230
 }
Please login to merge, or discard this patch.
Braces   +7 added lines, -29 removed lines patch added patch discarded remove patch
@@ -76,18 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         if ($sLanguage == 'fr') {
78 78
 
79
-            if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; }
80
-            else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; }
81
-            else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; }
82
-            else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; }
83
-            else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; }
84
-            else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; }
85
-            else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; }
86
-            else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; }
87
-            else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; }
88
-            else if ($sMonth == 10) { return 'Octobre'; }
89
-            else if ($sMonth == 11) { return 'Novembre'; }
90
-            else if ($sMonth == 12) { return 'Décembre'; }
79
+            if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; } else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; } else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; } else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; } else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; } else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; } else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; } else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; } else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; } else if ($sMonth == 10) { return 'Octobre'; } else if ($sMonth == 11) { return 'Novembre'; } else if ($sMonth == 12) { return 'Décembre'; }
91 80
         }
92 81
     }
93 82
 
@@ -103,13 +92,7 @@  discard block
 block discarded – undo
103 92
     {
104 93
         if ($sLanguage == 'fr') {
105 94
 
106
-            if ($sDay == 0) { return 'dimanche'; }
107
-            else if ($sDay == 1) { return 'lundi'; }
108
-            else if ($sDay == 2) { return 'mardi'; }
109
-            else if ($sDay == 3) { return 'mercredi'; }
110
-            else if ($sDay == 4) { return 'jeudi'; }
111
-            else if ($sDay == 5) { return 'vendredi'; }
112
-            else if ($sDay == 6) { return 'samedi'; }
95
+            if ($sDay == 0) { return 'dimanche'; } else if ($sDay == 1) { return 'lundi'; } else if ($sDay == 2) { return 'mardi'; } else if ($sDay == 3) { return 'mercredi'; } else if ($sDay == 4) { return 'jeudi'; } else if ($sDay == 5) { return 'vendredi'; } else if ($sDay == 6) { return 'samedi'; }
113 96
         }
114 97
     }
115 98
 
@@ -136,8 +119,7 @@  discard block
 block discarded – undo
136 119
             if ($iMonth == $aToday['mois']) {
137 120
 
138 121
                 if ($iDay > $aToday['jour']) { $iYears--; }
139
-            }
140
-            else {
122
+            } else {
141 123
 
142 124
                 $iYears--;
143 125
             }
@@ -158,18 +140,15 @@  discard block
 block discarded – undo
158 140
     {
159 141
         $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear));
160 142
 
161
-        if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; }
162
-        else { $iShift = (8 - $iFirstDayInYear) * 86400; }
143
+        if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; }
163 144
 
164
-        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; }
165
-        else { $iWeekInSeconds = 0; }
145
+        if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; }
166 146
 
167 147
         if (date('N') > 2) {
168 148
 
169 149
             $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800;
170 150
             $iTimestampLastDay = $iTimestamp + 604800;
171
-        }
172
-        else {
151
+        } else {
173 152
 
174 153
             $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000;
175 154
             $iTimestampLastDay = $iTimestamp + 604800;
@@ -224,7 +203,6 @@  discard block
 block discarded – undo
224 203
         if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; }
225 204
         if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; }
226 205
         if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; }
227
-        if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; }
228
-        else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; }
206
+        if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; } else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; }
229 207
     }
230 208
 }
Please login to merge, or discard this patch.
bundles/lib/Form.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@
 block discarded – undo
180 180
 
181 181
             for ($i = 1; $i <= 31; $i++) {
182 182
 
183
-                if ($i < 10) { $aDay['0'.$i] = '0'.$i; }
184
-                else { $aDay[$i] = $i; }
183
+                if ($i < 10) { $aDay['0'.$i] = '0'.$i; } else { $aDay[$i] = $i; }
185 184
             }
186 185
 
187 186
             $this->_aElement[$sName.'_day'] = new Select($sName, $aDay);
Please login to merge, or discard this patch.
bundles/core/UrlManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
                         $aRoutes = array();
84 84
 
85
-                        foreach($oHost->routes as $sKey => $oRoute) {
85
+                        foreach ($oHost->routes as $sKey => $oRoute) {
86 86
 
87 87
                             if ($sKey === $sCode) {
88 88
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
             throw new \Exception();
134 134
         }
135 135
 
136
-        $sStringToEncode = str_replace(['à','á','â','ã','ä','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ù','ú','û','ü','ý','ÿ','À','Á','Â','Ã','Ä','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ñ','Ò','Ó','Ô','Õ','Ö','Ù','Ú','Û','Ü','Ý'],
137
-            ['a','a','a','a','a','c','e','e','e','e','i','i','i','i','n','o','o','o','o','o','u','u','u','u','y','y','A','A','A','A','A','C','E','E','E','E','I','I','I','I','N','O','O','O','O','O','U','U','U','U','Y'],
136
+        $sStringToEncode = str_replace(['à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý'],
137
+            ['a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y'],
138 138
                 $sStringToEncode);
139 139
 
140 140
         $sStringToEncode = preg_replace('/[^a-zA-Z0-9_]+/', '_', preg_quote($sStringToEncode));
Please login to merge, or discard this patch.