GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 2.2 ( 8999d4...f4c653 )
by Vermeulen
02:34
created

Date   B

Complexity

Total Complexity 51

Size/Duplication

Total Lines 458
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 67.58%

Importance

Changes 11
Bugs 4 Features 4
Metric Value
c 11
b 4
f 4
dl 0
loc 458
ccs 98
cts 145
cp 0.6758
rs 8.3206
wmc 51
lcom 1
cbo 0

17 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 24 4
A MAJ_Attributes() 0 12 1
A setZone() 0 4 1
A getDate() 0 4 1
A getAnnee() 0 4 1
A getMois() 0 4 1
A getJour() 0 4 1
A getHeure() 0 4 1
A getMinute() 0 4 1
A getSeconde() 0 4 1
A getZone() 0 4 1
B modify() 0 58 5
A getSql() 0 10 2
A lst_TimeZone() 0 5 1
A lst_TimeZoneContinent() 0 17 1
A lst_TimeZonePays() 0 17 3
D aff_simple() 0 91 25

How to fix   Complexity   

Complex Class

Complex classes like Date often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Date, and based on these observations, apply Extract Interface, too.

1
<?php
2
/**
3
 * Classes en rapport avec les Dates
4
 * @author Vermeulen Maxime <[email protected]>
5
 * @version 1.0
6
 */
7
8
namespace BFW;
9
10
use \Exception;
11
12
/**
13
 * Classe de gestion des dates
14
 * Le format de la date est aaaa-mm-jj hh:mm:ss+OO:OO
15
 * @package bfw
16
 */
17
class Date extends \DateTime implements \BFWInterface\IDate
18
{
19
    /**
20
     * @var \BFW\Kernel $_kernel L'instance du Kernel
21
     */
22
    protected $_kernel;
23
    
24
    /**
25
     * @var string $date La date au format string
26
     */
27
    protected $date = '';
28
    
29
    /**
30
     * @var string $annee L'année de la date
31
     */
32
    protected $annee = '';
33
    
34
    /**
35
     * @var string $mois Le mois de la date
36
     */
37
    protected $mois = '';
38
    
39
    /**
40
     * @var string $jour Le jour de la date
41
     */
42
    protected $jour = '';
43
    
44
    /**
45
     * @var string $heure L'heure de la date
46
     */
47
    protected $heure = '';
48
    
49
    /**
50
     * @var string $minute Les minutes de la date
51
     */
52
    protected $minute = '';
53
    
54
    /**
55
     * @var string $seconde Les secondes de la date
56
     */
57
    protected $seconde = '';
58
    
59
    /**
60
     * @var string $zone Le timezone à utiliser
61
     */
62
    protected $zone;
63
    
64
    /**
65
     * Accesseur vers l'attribut $date
66
     */
67
    public function getDate()
68
    {
69 1
        return $this->date;
70
    }
71
    
72
    /**
73
     * Accesseur vers l'attribut $annee
74
     * 
75
     * @return string
76
     */
77
    public function getAnnee()
78
    {
79 1
        return $this->annee;
80
    }
81
    
82
    /**
83
     * Accesseur vers l'attribut $mois
84
     * 
85
     * @return string
86
     */
87
    public function getMois()
88
    {
89 1
        return $this->mois;
90
    }
91
    
92
    /**
93
     * Accesseur vers l'attribut $jour
94
     * 
95
     * @return string
96
     */
97
    public function getJour()
98
    {
99 1
        return $this->jour;
100
    }
101
    
102
    /**
103
     * Accesseur vers l'attribut $heure
104
     * 
105
     * @return string
106
     */
107
    public function getHeure()
108
    {
109 1
        return $this->heure;
110
    }
111
    
112
    /**
113
     * Accesseur vers l'attribut $minute
114
     * 
115
     * @return string
116
     */
117
    public function getMinute()
118
    {
119 1
        return $this->minute;
120
    }
121
    
122
    /**
123
     * Accesseur vers l'attribut $seconde
124
     * 
125
     * @return string
126
     */
127
    public function getSeconde()
128
    {
129 1
        return $this->seconde;
130
    }
131
    
132
    /**
133
     * Accesseur vers l'attribut $zone
134
     * 
135
     * @return string
136
     */
137
    public function getZone()
138
    {
139 1
        return $this->zone;
140
    }
141
    
142
    /**
143
     * Constructeur
144
     * La date dans un format précis (aaaa-mm-jj hh:mm:ss+OO:OO)
145
     * S'il n'y a pas ":00" à la fin, alors c'est géré.
146
     * 
147
     * @param string $date (default: "now") La date sur laquelle travailler. Si pas indiqué, il s'agit de la date actuelle.
148
     */
149
    public function __construct($date="now")
150
    {
151 1
        $this->_kernel = getKernel();
152
        
153 1
        if($date != "now")
154 1
        {
155 1
            $len = strlen($date);
156 1
            $len -= 3;
157 1
            if($date[$len] == '+')
158 1
            {
159 1
                $date .= ':00';
160 1
            }
161 1
        }
162
        
163 1
        $this->date = $date;
164 1
        parent::__construct($date);
165
        
166 1
        if($date == "now")
167 1
        {
168 1
            $this->date = $this->format('Y-m-d H:i:sO');
169 1
        }
170
        
171 1
        $this->MAJ_Attributes();
172 1
    }
173
    
174
    /**
175
     * Initialise les attributs avec leurs valeurs respectives. La méthode est appelé dans le constructeur
176
     */
177
    final private function MAJ_Attributes()
178
    {
179 1
        $this->annee = parent::format('Y');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
180 1
        $this->mois = parent::format('m');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
181 1
        $this->jour = parent::format('d');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
182 1
        $this->heure = parent::format('H');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
183 1
        $this->minute = parent::format('i');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
184 1
        $this->seconde = parent::format('s');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
185 1
        $this->zone = parent::format('P');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
186
        
187 1
        $this->date = parent::format('Y-m-d H:i:sO');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of MAJ_Attributes()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
188 1
    }
189
    
190
    /**
191
     * Modifie une données de la date
192
     * 
193
     * @param string $cond La partie à modifier : year, mouth, day, jour, minute, second
194
     * 
195
     * @throws \Exception : Si le paramètre pour modifier n'est pas géré
196
     * 
197
     * @return \BFW\Date : Retourne l'objet si la modification à réussi.
198
     */
199
    public function modify($cond)
200
    {
201
        //Date actuel
202 1
        $dateOri = parent::format('Y-m-d H:i:s');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of modify()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
203
        
204
        //On tente la modif avec le paramètre de la fonction
205 1
        $mod = @parent::modify($cond); //@ pour éviter une erreur car on permet d'autres format
206 1
        $dateMod = parent::format('Y-m-d H:i:s');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of modify()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
207
        
208
        //Si la modif à marcher direct, on met à jour et on sort.
209 1
        if(!($dateOri == $dateMod || $mod == false))
210 1
        {
211 1
            $this->MAJ_Attributes();
212 1
            return $this;
213
        }
214
        
215 1
        $match = array();
216
        //Regex sur le paramètre pour récupéré le type de modification
217 1
        preg_match('#(\+|\-)([0-9]+) ([a-z]+)#i', $cond, $match);
218 1
        $match[3] = strtolower($match[3]);
219
        
220
        //Liste des possibilités qu'on permet
221
        $search = array(
222 1
            'an', 'ans',
223 1
            'mois',
224 1
            'jour', 'jours',
225 1
            'heure', 'heures',
226 1
            'minutes',
227 1
            'seconde', 'secondes'
228 1
        );
229
        
230
        //Liste des équivalent pour la fonction modify de DateTime
231
        $replace = array(
232 1
            'year', 'year',
233 1
            'month',
234 1
            'day', 'day',
235 1
            'hour', 'hour',
236 1
            'minute',
237 1
            'second', 'second'
238 1
        );
239
        
240
        //On remplace le type de modification par sa valeur pour DateTime
241 1
        $real = str_replace($search, $replace, $match[3]);
242
        
243
        //Et on retente la modif
244 1
        $mod2 = @parent::modify($match[1].$match[2].' '.$real);
245 1
        $dateMod2 = parent::format('Y-m-d H:i:s');
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (format() instead of modify()). Are you sure this is correct? If so, you might want to change this to $this->format().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
246
        
247
        //Si la modif à fail : création d'une exception
248 1
        if($dateOri == $dateMod2 || $mod2 == false)
249 1
        {
250 1
            throw new Exception('Parameter '.$match[3].' is unknown.');
251
        }
252
        
253
        //Maj des attributs et retourne l'instance courante.
254 1
        $this->MAJ_Attributes();
255 1
        return $this;
256
    }
257
    
258
    /**
259
     * Renvoi au format pour SQL (postgresql) via un array
260
     * 
261
     * @param bool $decoupe (default: false) Indique si on veux retourner un string ayant tout, ou un array ayant la date et l'heure séparé
262
     * 
263
     * @return string|array Le format pour SQL
264
     * Si string : aaaa-mm-jj hh:mm:ss
265
     * Si array : [0]=>partie date (aaaa-mm-jj), [1]=>partie heure (hh:mm:ss)
266
     */
267
    public function getSql($decoupe=false)
268
    {
269 1
        $dateSql = new \DateTime($this->date, new \DateTimeZone(self::ZONE_DEFAULT));
270 1
        $date = $dateSql->format('Y-m-d');
271 1
        $heure = $dateSql->format('H:i:s');
272
        
273 1
        if($decoupe) {return array($date, $heure);}
274
        
275 1
        return $date.' '.$heure;
276
    }
277
    
278
    /**
279
     * Modifie le timezone
280
     * 
281
     * @param string $NewZone le nouveau time zone
282
     */
283
    public function setZone($NewZone)
284
    {
285 1
        parent::setTimezone(new \DateTimeZone($NewZone));
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (setTimezone() instead of setZone()). Are you sure this is correct? If so, you might want to change this to $this->setTimezone().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
286 1
    }
287
    
288
    /**
289
     * Liste tous les timezone qui existe
290
     * 
291
     * @return array La liste des timezone possible
292
     */
293
    public function lst_TimeZone()
294
    {
295 1
        $TimeZone = parent::getTimezone();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getTimezone() instead of lst_TimeZone()). Are you sure this is correct? If so, you might want to change this to $this->getTimezone().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
296 1
        return $TimeZone->listIdentifiers();
297
    }
298
    
299
    /**
300
     * Liste les continents possible pour les timezones
301
     * 
302
     * @return string[] La liste des continents
303
     */
304
    public function lst_TimeZoneContinent()
305
    {
306
        $lst_continent = array(
307 1
            'africa', 
308 1
            'america', 
309 1
            'antartica', 
310 1
            'arctic', 
311 1
            'asia', 
312 1
            'atlantic', 
313 1
            'australia', 
314 1
            'europe', 
315 1
            'indian', 
316
            'pacific'
317 1
        );
318
        
319 1
        return $lst_continent;
320
    }
321
    
322
    /**
323
     * Liste des pays possible pour un continent donné
324
     * 
325
     * @param string $continent Le continent dans lequel on veux la liste des pays
326
     * 
327
     * @return array La liste des pays pour le continent donné
328
     */
329
    public function lst_TimeZonePays($continent)
330
    {
331 1
        $lst_all = $this->lst_TimeZone();
332 1
        $return = array();
333
        
334 1
        $pos = false;
0 ignored issues
show
Unused Code introduced by
$pos is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
335 1
        foreach($lst_all as $val)
336
        {
337 1
            $pos = strpos($val, $continent);
338 1
            if($pos !== false)
339 1
            {
340 1
                $return[] = $val;
341 1
            }
342 1
        }
343
        
344 1
        return $return;
345
    }
346
    
347
    /**
348
     * Transforme la date en un format plus facilement lisible.
349
     * 
350
     * Paramètre en entrée
351
     *      $tout :
352
     *          1 : On affiche la date en entier (jour et heure)
353
     *          0 : On affiche que le jour
354
     *      $minus : 
355
     *          1 : On affiche le texte en minuscule (hier, le)
356
     *          0 : On affiche le texte en normal (Hier, Le)
357
     * 
358
     * possibilitées en sortie : 
359
     *
360
     *      $tout == 1
361
     *          Il y 1s
362
     *          Il y 1min
363
     *          Il y 1h
364
     *          Hier à 00:00
365
     *          Le 00/00 à 00:00
366
     *          Le 00/00/0000 à 00:00 (si l'année n'est pas la même)
367
     *      
368
     *      $tout == 0
369
     *          Il y 1s
370
     *          Il y 1min
371
     *          Il y 1h
372
     *          Hier
373
     *          Le 00/00
374
     *          Le 00/00/0000 (si l'année n'est pas la même)
375
     *      
376
     *      Ou "Maintenant" (qu'importe la valeur de $tout)
377
     * 
378
     * @param bool $tout  (default: true) Affiche la date en entier (true) ou non (false).
379
     * @param bool $minus (default: false) Affiche la date en minuscule (true) ou non (false).
380
     * 
381
     * @return string La date simplifié
382
     */
383
    public function aff_simple($tout=true, $minus=false)
384
    {
385
        //Découpage de la date donnée dans l'instance de la classe
386
        $annee  = $this->annee;
387
        $mois   = $this->mois;
388
        $jour   = $this->jour;
389
        $heure  = $this->heure;
390
        $minute = $this->minute;
391
        
392
        //La date actuelle
393
        $time = new Date();
394
        
395
        
396
        /*
397
        Si c'est à l'instant même
398
            Afficher "Maintenant"
399
        Si c'est le même jour OU (c'est jour-1 ET différence d'heure < 2h)
400
            Afficher "il y a xxh"
401
        Si c'est jour-1 ET différence d'heure > 2h
402
            Afficher "Hier"
403
        Sinon
404
            Afficher au format date
405
        */
406
        
407
        $diff        = parent::diff($time);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (diff() instead of aff_simple()). Are you sure this is correct? If so, you might want to change this to $this->diff().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
408
        $diffAnnee   = $diff->format('%Y');
409
        $diffMois    = $diff->format('%M');
410
        $diffJour    = $diff->format('%D');
411
        $diffHeure   = $diff->format('%H');
412
        $diffMinute  = $diff->format('%I');
413
        $diffSeconde = $diff->format('%S');
414
        $diffInvert  = $diff->invert;
415
        
416
        //@TODO : All $diffXxx variable is on a string type, not int.
417
        if($diffAnnee == 0 && $diffMois == 0 && $diffJour == 0 && $diffHeure == 0 && $diffMinute == 0 && $diffSeconde == 0)
418
        {
419
            $aff_date = 'Maintenant';
420
            $aff_heure = '';
421
        }
422
        elseif($diffAnnee == 0 && $diffMois == 0 && $diffJour == 0 && $diffHeure <= 2)
423
        {
424
            $aff_date = 'Il y a '; //On commence par déclaré le début de l'affichage
425
            
426
            if($diffJour > 1) //Dans le cas de 23h -> $heure_diff = -1
427
            {
428
                $h = 24+$diffHeure; //24 + (-1)
429
                $aff_date .= $h.'h';
430
            }
431
            else
432
            {
433
                if($diffHeure > 0)
434
                {
435
                    $aff_date .= $diffHeure.'h';
436
                }
437
                elseif($diffHeure <= 0 && $diffMinute > 0)
438
                {
439
                    $aff_date .= $diffMinute.'min';
440
                }
441
                else
442
                {
443
                    $aff_date .= $diffSeconde.'s';
444
                }
445
            }
446
            
447
            $aff_heure = ''; #Partie prévu pour l'affichage
448
        }
449
        elseif($diffInvert == 0 && $diffAnnee == 0 && $diffMois == 0 && (($diffJour == 0 && $diffHeure > 2) || ($diffJour == 1 && $diffHeure == 0)))
450
        {
451
            //C'était hier
452
            $aff_date = 'Hier'; #On affiche donc en première partie "hier"
453
            $aff_heure = ' à '.$heure.':'.$minute; #et en seconde partie, l'heure et les minutes
454
        }
455
        else
456
        {
457
            //Sinon et bien c'était il y a plus de 48h, et on affiche la date au format habituel
458
            $aff_date  = 'Le '.$jour.'/'.$mois; //D'abord le jour et le mois
459
            $aff_heure = ' à '.$heure.':'.$minute; //Et ensuite l'heure et les minutes
460
            
461
            //Et si l'année n'est pas la meme que l'actuel, alors on rajoute l'année à la fin de la première partie l'année
462
            if($diffAnnee != 0) {$aff_date .= '/'.$annee;}
463
        }
464
        
465
        $aff = $aff_date; //On renvoi la date
466
        //Si on veut tout afficher (la date et l'heure)
467
        if($tout == 1) {$aff .= $aff_heure;}
468
        
469
        //Met la première lettre en minuscule dans le cas où l'ont veuille du minuscule
470
        if($minus === true) {$aff = mb_strtolower($aff);}
471
        
472
        return $aff; //Et on retour la date parser :D
473
    }
474
}
475