Php.php

<?php

namespace Tlf\Lexer2\Language;

class Php implements \Tlf\Lexer2\Language {

    protected array $directives = [];

    public function __construct(){
        $parser = new \Tlf\Lexer2\Parser();
        foreach (scandir($dir=__DIR__.'/Php/') as $file){
            if (substr($file,-4)!='.cta'){
                continue;
            }
            foreach ($parser->parse_directive_code(file_get_contents($dir.'/'.$file)) as $directive_name=>$directive){
                $this->directives[$directive_name] = $directive;
            }       
        }

        //print_r($this->directives);
    }

    public function get_directives(): array
    {
        return $this->directives;
    }

    public function get_namespace(): string
    {
        return 'php';
    }
}