-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtyposcript-lint
executable file
·46 lines (38 loc) · 1.49 KB
/
typoscript-lint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env php
<?php
/*
* This file is part of tsparse.
* https://github.com/martin-helmich/ts-parse
*
* (C) 2014 Martin Helmich <kontakt@martin-helmich.de>
*
* For license information, view the LICENSE.md file.
*/
use Helmich\TypoScriptLint\Application;
use Helmich\TypoScriptParser\TypoScriptParserExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\EventDispatcher\EventDispatcher;
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
} else if (file_exists(__DIR__ . '/../../autoload.php')) {
/** @noinspection PhpIncludeInspection */
require_once __DIR__ . '/../../autoload.php';
} else {
die('Could not find an autoload.php. Did you set up all dependencies?');
}
$dispatcher = new EventDispatcher();
$container = new ContainerBuilder();
$container->setParameter('dir.cwd', getcwd());
$container->setParameter('dir.tslint_root', __DIR__);
$container->setParameter('dir.typoscriptlint_root', __DIR__);
$container->registerExtension(new TypoScriptParserExtension());
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
$loader->load('services.yml');
$container->set('dispatcher', $dispatcher);
$container->loadFromExtension('typoscript_parser');
$container->compile();
$application = new Application($container);
$application->setDispatcher($dispatcher);
$application->run();