Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

Application modulaire fonctionnelle !

Emmanuel ROY authored on 12/08/2019 15:10:25
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,64 +0,0 @@
1
-<?php
2
-
3
-namespace Illuminate\Support;
4
-
5
-use DateInterval;
6
-use DateTimeInterface;
7
-
8
-trait InteractsWithTime
9
-{
10
-    /**
11
-     * Get the number of seconds until the given DateTime.
12
-     *
13
-     * @param  \DateTimeInterface|\DateInterval|int  $delay
14
-     * @return int
15
-     */
16
-    protected function secondsUntil($delay)
17
-    {
18
-        $delay = $this->parseDateInterval($delay);
19
-
20
-        return $delay instanceof DateTimeInterface
21
-                            ? max(0, $delay->getTimestamp() - $this->currentTime())
22
-                            : (int) $delay;
23
-    }
24
-
25
-    /**
26
-     * Get the "available at" UNIX timestamp.
27
-     *
28
-     * @param  \DateTimeInterface|\DateInterval|int  $delay
29
-     * @return int
30
-     */
31
-    protected function availableAt($delay = 0)
32
-    {
33
-        $delay = $this->parseDateInterval($delay);
34
-
35
-        return $delay instanceof DateTimeInterface
36
-                            ? $delay->getTimestamp()
37
-                            : Carbon::now()->addRealSeconds($delay)->getTimestamp();
38
-    }
39
-
40
-    /**
41
-     * If the given value is an interval, convert it to a DateTime instance.
42
-     *
43
-     * @param  \DateTimeInterface|\DateInterval|int  $delay
44
-     * @return \DateTimeInterface|int
45
-     */
46
-    protected function parseDateInterval($delay)
47
-    {
48
-        if ($delay instanceof DateInterval) {
49
-            $delay = Carbon::now()->add($delay);
50
-        }
51
-
52
-        return $delay;
53
-    }
54
-
55
-    /**
56
-     * Get the current system time as a UNIX timestamp.
57
-     *
58
-     * @return int
59
-     */
60
-    protected function currentTime()
61
-    {
62
-        return Carbon::now()->getTimestamp();
63
-    }
64
-}
Browse code

initial commit

Emmanuel ROY authored on 09/08/2019 08:39:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,64 @@
1
+<?php
2
+
3
+namespace Illuminate\Support;
4
+
5
+use DateInterval;
6
+use DateTimeInterface;
7
+
8
+trait InteractsWithTime
9
+{
10
+    /**
11
+     * Get the number of seconds until the given DateTime.
12
+     *
13
+     * @param  \DateTimeInterface|\DateInterval|int  $delay
14
+     * @return int
15
+     */
16
+    protected function secondsUntil($delay)
17
+    {
18
+        $delay = $this->parseDateInterval($delay);
19
+
20
+        return $delay instanceof DateTimeInterface
21
+                            ? max(0, $delay->getTimestamp() - $this->currentTime())
22
+                            : (int) $delay;
23
+    }
24
+
25
+    /**
26
+     * Get the "available at" UNIX timestamp.
27
+     *
28
+     * @param  \DateTimeInterface|\DateInterval|int  $delay
29
+     * @return int
30
+     */
31
+    protected function availableAt($delay = 0)
32
+    {
33
+        $delay = $this->parseDateInterval($delay);
34
+
35
+        return $delay instanceof DateTimeInterface
36
+                            ? $delay->getTimestamp()
37
+                            : Carbon::now()->addRealSeconds($delay)->getTimestamp();
38
+    }
39
+
40
+    /**
41
+     * If the given value is an interval, convert it to a DateTime instance.
42
+     *
43
+     * @param  \DateTimeInterface|\DateInterval|int  $delay
44
+     * @return \DateTimeInterface|int
45
+     */
46
+    protected function parseDateInterval($delay)
47
+    {
48
+        if ($delay instanceof DateInterval) {
49
+            $delay = Carbon::now()->add($delay);
50
+        }
51
+
52
+        return $delay;
53
+    }
54
+
55
+    /**
56
+     * Get the current system time as a UNIX timestamp.
57
+     *
58
+     * @return int
59
+     */
60
+    protected function currentTime()
61
+    {
62
+        return Carbon::now()->getTimestamp();
63
+    }
64
+}