forked from SMillerDev/phpdraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpdraft
More file actions
executable file
·62 lines (55 loc) · 1.4 KB
/
phpdraft
File metadata and controls
executable file
·62 lines (55 loc) · 1.4 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env php
<?php
/**
* Set up include path for source handling
*/
set_include_path(get_include_path() . ":" . __DIR__ . '/src/');
/**
* Set up required classes (with the autoloader)
*/
//require_once 'PHPDraft/Core/Autoloader.php';
require_once 'vendor/autoload.php';
use PHPDraft\In\ApibFileParser;
use PHPDraft\Out\UI;
use PHPDraft\Parse\JsonToHTML;
use PHPDraft\Parse\ParserFactory;
define('VERSION', '0');
try
{
$values = UI::main($argv);
$apib = new ApibFileParser($values['file']);
$apib = $apib->parse();
$offline = FALSE;
$online = FALSE;
try
{
$parser = ParserFactory::get();
$parser = $parser->init($apib);
}
catch (\PHPDraft\Parse\ResourceException $exception)
{
file_put_contents('php://stderr', "No drafter available.\n");
return;
}
$html = new JsonToHTML($parser->parseToJson());
$html->sorting = $values['sorting'];
$generator = $html->get_html($values['template'], $values['image'], $values['css'], $values['js']);
}
catch (\PHPDraft\Parse\ExecutionException $exception)
{
file_put_contents('php://stderr', $exception->getMessage() . PHP_EOL);
exit($exception->getCode());
}
function phpdraft_var_dump(...$vars)
{
if (defined('__PHPDRAFT_PHAR__'))
{
return;
}
echo '<pre>';
foreach ($vars as $var)
{
var_dump($var);
}
echo '</pre>';
}