1 | <?php |
||
9 | class ParserFactory |
||
10 | { |
||
11 | const EXTENSION_JSON = 'json'; |
||
12 | const EXTENSION_MD = 'markdown'; |
||
13 | const EXTENSION_FOLDER = 'folder'; |
||
14 | const EXTENSION_YML = 'yaml'; |
||
15 | const EXTENSION_YAML = 'yaml'; |
||
16 | const EXTENSION_IMG = 'image'; |
||
17 | const EXTENSION_JS = 'file'; |
||
18 | const EXTENSION_CSS = 'file'; |
||
19 | const EXTENSION_SASS = 'sass'; |
||
20 | const EXTENSION_SCSS = 'sass'; |
||
21 | const PARSER_DEFAULT = 'default'; |
||
22 | |||
23 | /** |
||
24 | * @var ContainerInterface |
||
25 | */ |
||
26 | private $container; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $typeFilters = []; |
||
32 | |||
33 | /** |
||
34 | * ParserFactory constructor. |
||
35 | * |
||
36 | * @param ContainerInterface $container |
||
37 | */ |
||
38 | public function __construct(ContainerInterface $container) { |
||
73 | |||
74 | /** |
||
75 | * @param string $type |
||
76 | * @param callable $filter |
||
77 | */ |
||
78 | public static function addTypeFilter(string $type, callable $filter) { |
||
81 | |||
82 | /** |
||
83 | * @param $fileName |
||
84 | * |
||
85 | * @return Parser|null |
||
86 | */ |
||
87 | public function getByFileName($fileName) : ?Parser { |
||
109 | |||
110 | /** |
||
111 | * @param string $type |
||
112 | * |
||
113 | * @return Parser|mixed |
||
114 | * @throws ParserException |
||
115 | */ |
||
116 | public function getByType($type) : Parser { |
||
125 | |||
126 | } |
||
127 |