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,85 +0,0 @@
1
-<?php
2
-
3
-/*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
-namespace Symfony\Component\Finder;
13
-
14
-/**
15
- * Extends \SplFileInfo to support relative paths.
16
- *
17
- * @author Fabien Potencier <fabien@symfony.com>
18
- */
19
-class SplFileInfo extends \SplFileInfo
20
-{
21
-    private $relativePath;
22
-    private $relativePathname;
23
-
24
-    /**
25
-     * @param string $file             The file name
26
-     * @param string $relativePath     The relative path
27
-     * @param string $relativePathname The relative path name
28
-     */
29
-    public function __construct(string $file, string $relativePath, string $relativePathname)
30
-    {
31
-        parent::__construct($file);
32
-        $this->relativePath = $relativePath;
33
-        $this->relativePathname = $relativePathname;
34
-    }
35
-
36
-    /**
37
-     * Returns the relative path.
38
-     *
39
-     * This path does not contain the file name.
40
-     *
41
-     * @return string the relative path
42
-     */
43
-    public function getRelativePath()
44
-    {
45
-        return $this->relativePath;
46
-    }
47
-
48
-    /**
49
-     * Returns the relative path name.
50
-     *
51
-     * This path contains the file name.
52
-     *
53
-     * @return string the relative path name
54
-     */
55
-    public function getRelativePathname()
56
-    {
57
-        return $this->relativePathname;
58
-    }
59
-
60
-    public function getFilenameWithoutExtension(): string
61
-    {
62
-        $filename = $this->getFilename();
63
-
64
-        return pathinfo($filename, PATHINFO_FILENAME);
65
-    }
66
-
67
-    /**
68
-     * Returns the contents of the file.
69
-     *
70
-     * @return string the contents of the file
71
-     *
72
-     * @throws \RuntimeException
73
-     */
74
-    public function getContents()
75
-    {
76
-        set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
77
-        $content = file_get_contents($this->getPathname());
78
-        restore_error_handler();
79
-        if (false === $content) {
80
-            throw new \RuntimeException($error);
81
-        }
82
-
83
-        return $content;
84
-    }
85
-}
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,85 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+namespace Symfony\Component\Finder;
13
+
14
+/**
15
+ * Extends \SplFileInfo to support relative paths.
16
+ *
17
+ * @author Fabien Potencier <fabien@symfony.com>
18
+ */
19
+class SplFileInfo extends \SplFileInfo
20
+{
21
+    private $relativePath;
22
+    private $relativePathname;
23
+
24
+    /**
25
+     * @param string $file             The file name
26
+     * @param string $relativePath     The relative path
27
+     * @param string $relativePathname The relative path name
28
+     */
29
+    public function __construct(string $file, string $relativePath, string $relativePathname)
30
+    {
31
+        parent::__construct($file);
32
+        $this->relativePath = $relativePath;
33
+        $this->relativePathname = $relativePathname;
34
+    }
35
+
36
+    /**
37
+     * Returns the relative path.
38
+     *
39
+     * This path does not contain the file name.
40
+     *
41
+     * @return string the relative path
42
+     */
43
+    public function getRelativePath()
44
+    {
45
+        return $this->relativePath;
46
+    }
47
+
48
+    /**
49
+     * Returns the relative path name.
50
+     *
51
+     * This path contains the file name.
52
+     *
53
+     * @return string the relative path name
54
+     */
55
+    public function getRelativePathname()
56
+    {
57
+        return $this->relativePathname;
58
+    }
59
+
60
+    public function getFilenameWithoutExtension(): string
61
+    {
62
+        $filename = $this->getFilename();
63
+
64
+        return pathinfo($filename, PATHINFO_FILENAME);
65
+    }
66
+
67
+    /**
68
+     * Returns the contents of the file.
69
+     *
70
+     * @return string the contents of the file
71
+     *
72
+     * @throws \RuntimeException
73
+     */
74
+    public function getContents()
75
+    {
76
+        set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
77
+        $content = file_get_contents($this->getPathname());
78
+        restore_error_handler();
79
+        if (false === $content) {
80
+            throw new \RuntimeException($error);
81
+        }
82
+
83
+        return $content;
84
+    }
85
+}