src/Leevel/View/Compiler.php
public function getCompilers(): array
    {
        $methods = get_class_methods($this);
        $compilers = [];

        foreach ($methods as $method) {
            if ('Compiler' !== substr($method, -8)) {
                continue;
            }

            $method = substr($method, 0, -8);

            if (!in_array($method, [
                'global',
                'jsvar',
                'globalrevert',
                'revert',
            ], true)) {
                $type = strtolower(substr($method, -4));
                $tag = substr($method, 0, -4);

                if ('code' === $type) {
                    $name = $this->codeMap[$tag] ?? $tag;
                } elseif ('node' === $type) {
                    $name = $this->nodeMap[$tag] ?? $tag;
                } else {
                    $type = strtolower(substr($method, -2));
                    $tag = substr($method, 0, -2);
                    $name = $this->jsMap[$tag] ?? $tag;
                }

                $compilers[] = [
                    $type,
                    $name,
                    $tag,
                ];
            }
        }

        unset($methods);

        return $compilers;
    }
public function getCompilers(): array
    {
        $methods = get_class_methods($this);
        $compilers = [];

        foreach ($methods as $method) {
            if ('Compiler' !== substr($method, -8)) {
                continue;
            }

            $method = substr($method, 0, -8);

            if (!in_array($method, [
                'global',
                'jsvar',
                'globalrevert',
                'revert',
            ], true)) {
                $type = strtolower(substr($method, -4));
                $tag = substr($method, 0, -4);

                if ('code' === $type) {
                    $name = $this->codeMap[$tag] ?? $tag;
                } elseif ('node' === $type) {
                    $name = $this->nodeMap[$tag] ?? $tag;
                } else {
                    $type = strtolower(substr($method, -2));
                    $tag = substr($method, 0, -2);
                    $name = $this->jsMap[$tag] ?? $tag;
                }

                $compilers[] = [
                    $type,
                    $name,
                    $tag,
                ];
            }
        }

        unset($methods);

        return $compilers;
    }
获取编译器.

@return array