-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathunit.php
More file actions
29 lines (29 loc) · 902 Bytes
/
unit.php
File metadata and controls
29 lines (29 loc) · 902 Bytes
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
<?php
namespace
{
set_include_path(__DIR__ . DIRECTORY_SEPARATOR . 'classes');
spl_autoload_register('spl_autoload');
if (! function_exists('php_check_syntax')) {
/**
* Check the PHP syntax of (and execute) the specified file
*
* @param string $filename The name of the file being checked.
* @param string $error_message The error message generated by the syntax check. (by reference)
* @return bool Returns TRUE if the lint check passed, and FALSE if the link check failed
*/
function php_check_syntax($filename, &$error_message)
{
$out = [];
$error_message = exec(sprintf('php -l %s', escapeshellarg($filename)), $out, $return_var);
return $return_var !== false;
}
}
}
namespace Unit
{
if (PHP_SAPI !== 'cli') {
http_response_code(403);
exit();
}
\shgysk8zer0\Core\NamespacedFunction::{'\Test_funcs\lint_scripts_recursive'}(__DIR__);
}