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,95 +0,0 @@
1
-<?php declare(strict_types=1);
2
-/**
3
- * Part of Windwalker project.
4
- *
5
- * @copyright  Copyright (C) 2019 LYRASOFT.
6
- * @license    GNU General Public License version 2 or later;
7
- */
8
-
9
-namespace Windwalker\Renderer\Twig;
10
-
11
-/**
12
- * The TwigFilesystemLoader class.
13
- *
14
- * @since  2.1.1
15
- */
16
-class TwigFilesystemLoader extends \Twig_Loader_Filesystem
17
-{
18
-    /**
19
-     * Property separator.
20
-     *
21
-     * @var  string
22
-     */
23
-    protected $separator;
24
-
25
-    /**
26
-     * TwigFilesystemLoader constructor.
27
-     *
28
-     * @param array|string $paths
29
-     * @param string       $separator
30
-     */
31
-    public function __construct($paths, $separator = '.')
32
-    {
33
-        $this->separator = $separator;
34
-
35
-        parent::__construct($paths);
36
-    }
37
-
38
-    /**
39
-     * Method to get property Separator
40
-     *
41
-     * @return  string
42
-     */
43
-    public function getSeparator()
44
-    {
45
-        return $this->separator;
46
-    }
47
-
48
-    /**
49
-     * Method to set property separator
50
-     *
51
-     * @param   string $separator
52
-     *
53
-     * @return  static  Return self to support chaining.
54
-     */
55
-    public function setSeparator($separator)
56
-    {
57
-        $this->separator = $separator;
58
-
59
-        return $this;
60
-    }
61
-
62
-    /**
63
-     * normalizeName
64
-     *
65
-     * @param   string $name
66
-     *
67
-     * @return  string
68
-     */
69
-    protected function normalizeName($name)
70
-    {
71
-        $ext = pathinfo($name, PATHINFO_EXTENSION);
72
-
73
-        if ($ext === 'twig') {
74
-            $name = substr($name, 0, -5);
75
-        }
76
-
77
-        $path = preg_replace('#/{2,}#', '/', str_replace($this->separator, '/', $name));
78
-
79
-        return $path . '.twig';
80
-    }
81
-
82
-    /**
83
-     * Adds a path where templates are stored.
84
-     *
85
-     * @param string $path      A path where to look for templates
86
-     * @param string $namespace A path name
87
-     */
88
-    public function addPath($path, $namespace = self::MAIN_NAMESPACE)
89
-    {
90
-        // invalidate the cache
91
-        $this->cache = [];
92
-
93
-        $this->paths[$namespace][] = rtrim($path, '/\\');
94
-    }
95
-}
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,95 @@
1
+<?php declare(strict_types=1);
2
+/**
3
+ * Part of Windwalker project.
4
+ *
5
+ * @copyright  Copyright (C) 2019 LYRASOFT.
6
+ * @license    GNU General Public License version 2 or later;
7
+ */
8
+
9
+namespace Windwalker\Renderer\Twig;
10
+
11
+/**
12
+ * The TwigFilesystemLoader class.
13
+ *
14
+ * @since  2.1.1
15
+ */
16
+class TwigFilesystemLoader extends \Twig_Loader_Filesystem
17
+{
18
+    /**
19
+     * Property separator.
20
+     *
21
+     * @var  string
22
+     */
23
+    protected $separator;
24
+
25
+    /**
26
+     * TwigFilesystemLoader constructor.
27
+     *
28
+     * @param array|string $paths
29
+     * @param string       $separator
30
+     */
31
+    public function __construct($paths, $separator = '.')
32
+    {
33
+        $this->separator = $separator;
34
+
35
+        parent::__construct($paths);
36
+    }
37
+
38
+    /**
39
+     * Method to get property Separator
40
+     *
41
+     * @return  string
42
+     */
43
+    public function getSeparator()
44
+    {
45
+        return $this->separator;
46
+    }
47
+
48
+    /**
49
+     * Method to set property separator
50
+     *
51
+     * @param   string $separator
52
+     *
53
+     * @return  static  Return self to support chaining.
54
+     */
55
+    public function setSeparator($separator)
56
+    {
57
+        $this->separator = $separator;
58
+
59
+        return $this;
60
+    }
61
+
62
+    /**
63
+     * normalizeName
64
+     *
65
+     * @param   string $name
66
+     *
67
+     * @return  string
68
+     */
69
+    protected function normalizeName($name)
70
+    {
71
+        $ext = pathinfo($name, PATHINFO_EXTENSION);
72
+
73
+        if ($ext === 'twig') {
74
+            $name = substr($name, 0, -5);
75
+        }
76
+
77
+        $path = preg_replace('#/{2,}#', '/', str_replace($this->separator, '/', $name));
78
+
79
+        return $path . '.twig';
80
+    }
81
+
82
+    /**
83
+     * Adds a path where templates are stored.
84
+     *
85
+     * @param string $path      A path where to look for templates
86
+     * @param string $namespace A path name
87
+     */
88
+    public function addPath($path, $namespace = self::MAIN_NAMESPACE)
89
+    {
90
+        // invalidate the cache
91
+        $this->cache = [];
92
+
93
+        $this->paths[$namespace][] = rtrim($path, '/\\');
94
+    }
95
+}