![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/gositeme.com/public_html/whmcs/vendor/seld/phar-utils/src/ |
<?php
/*
* This file is part of PHAR Utils.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Seld\PharUtils;
class Linter
{
/**
* Lints all php files inside a given phar with the current PHP version
*
* @param string $path Phar file path
*/
public static function lint($path)
{
foreach (new \RecursiveIteratorIterator(new \Phar($path)) as $file) {
if ($file->isDir()) {
continue;
}
if (substr($file, -4) === '.php') {
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open((defined('PHP_BINARY') ? PHP_BINARY : 'php').' -l', $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], file_get_contents((string) $file));
fclose($pipes[0]);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$exitCode = proc_close($process);
if ($exitCode !== 0) {
throw new \UnexpectedValueException('Failed linting '.$file.': '.$stderr);
}
} else {
throw new \RuntimeException('Could not start linter process');
}
}
}
}
}