console.php
1.2 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
<?php
set_time_limit(0);
set_include_path(implode(PATH_SEPARATOR, array(
realpath(__DIR__.'/../../../infra/infra_php'),
get_include_path(),
)));
require_once __DIR__.'/../../SEI.php';
//error_reporting(E_ALL & ~E_NOTICE);
if(!array_key_exists('argv', $_SERVER)) {
die('Este script somente pode ser executado por linha de comando');
}
$numRetorno = 0;
try {
print PHP_EOL;
print PenConsoleRN::format('PEN - Commad Line Interface', 'green', true).PHP_EOL;
print PHP_EOL;
$objActionRN = new PenConsoleActionRN();
$objPenConsoleRN = new PenConsoleRN($objActionRN);
$strRetorno = $objPenConsoleRN->run();
if(empty($_SERVER['argv']))
print PenConsoleRN::format('Sucesso: ', 'blue', true);
print $strRetorno.PHP_EOL;
}
catch(\InfraException $e) {
$numRetorno = 1;
print PenConsoleRN::format('Erro: ', 'red', true);
print PenConsoleRN::format($e->getStrDescricao());
}
catch(\Exception $e) {
print PenConsoleRN::format('Erro: ', 'red', true);
print PenConsoleRN::format($e->getMessage());
$numRetorno = 1;
}
print PHP_EOL;
print PHP_EOL;
exit($numRetorno);