%PDF- %PDF-
Direktori : /var/www/projetos/suporte.iigd.com.br/vendor/glpi-project/inventory_format/bin/ |
Current File : //var/www/projetos/suporte.iigd.com.br/vendor/glpi-project/inventory_format/bin/validate |
#!/usr/bin/env php <?php if (file_exists($autoload = __DIR__ . '/../vendor/autoload.php')) { // Rely on self autoload (usefull for devs) require_once $autoload; } else { // Rely on parent project autoload require_once __DIR__ . '/../../../autoload.php'; } require_once __DIR__ . '/../lib/php/Converter.php'; if (count($argv) !== 2) { die("usage: ".$argv[0]." /path/to/file.json\n"); } $json_path = $argv[1]; if (parse_url($json_path, PHP_URL_SCHEME) == null) { if ($json_path[0] == '/') { //absolute path $json_path = 'file://' . $json_path; } else { //relative path: make absolute $json_path = 'file://' . getcwd() . '/' . $json_path; } } if (!file_exists($json_path)) { echo "Source file does not exists!\n"; die(1); } try { $converter = new Glpi\Inventory\Converter; $json_str = file_get_contents($json_path); $converter->validate(json_decode($json_str)); } catch (\Exception $e) { echo "File: $json_path\n"; echo $e->getMessage(); die(1); }