File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Okapi \CodeTransformer ;
4+
5+ use Okapi \Singleton \Singleton ;
6+
7+ /**
8+ * # Code Transformer Kernel
9+ *
10+ * The `CodeTransformerKernel` is the heart of the Code Transformer library.
11+ * It manages an environment for Code Transformation.
12+ *
13+ * 1. Extends this class and define a list of transformers in the
14+ * `$transformers` property.
15+ * 2. Call the `init()` method early in the application lifecycle.
16+ */
17+ abstract class CodeTransformerKernel
18+ {
19+ use Singleton;
20+
21+ /**
22+ * List of transformers to be applied.
23+ *
24+ * @var class-string<Transformer>[]
25+ */
26+ protected array $ transformers = [];
27+
28+ /**
29+ * Initialize the kernel.
30+ *
31+ * @param string|null $cacheDir The cache directory.
32+ * <br><b>Default:</b> ROOT_DIR/cache/code-transformer<br>
33+ * @param int|null $cacheFileMode The cache file mode.
34+ * <br><b>Default:</b> 0777 & ~{@link umask()}<br>
35+ * @param bool|null $debug Enable debug mode. This will disable the cache.
36+ * <br><b>Default:</b> false<br>
37+ *
38+ * @return void
39+ */
40+ public static function init (
41+ ?string $ cacheDir ,
42+ ?int $ cacheFileMode = null ,
43+ bool $ debug = false ,
44+ ): void {}
45+ }
You can’t perform that action at this time.
0 commit comments