vendor/sensiolabs/security-checker/SensioLabs/Security/SecurityChecker.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/*
* This file is part of the SensioLabs Security Checker.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SensioLabs\Security;
use SensioLabs\Security\Exception\RuntimeException;
use SensioLabs\Security\Crawler\CrawlerInterface;
use SensioLabs\Security\Crawler\DefaultCrawler;
class SecurityChecker
{
const VERSION = '4';
private $vulnerabilityCount;
private $crawler;
public function __construct(CrawlerInterface $crawler = null)
{
$this->crawler = null === $crawler ? new DefaultCrawler() : $crawler;
}
/**
* Checks a composer.lock file.
*
* @param string $lock The path to the composer.lock file
*
* @return array An array of vulnerabilities
*
* @throws RuntimeException When the lock file does not exist
* @throws RuntimeException When the certificate can not be copied
*/
public function check($lock)
{
if (is_dir($lock) && file_exists($lock.'/composer.lock')) {
$lock = $lock.'/composer.lock';
} elseif (preg_match('/composer\.json$/', $lock)) {
$lock = str_replace('composer.json', 'composer.lock', $lock);
}
if (!is_file($lock)) {
throw new RuntimeException('Lock file does not exist.');
}
list($this->vulnerabilityCount, $vulnerabilities) = $this->crawler->check($lock);
return $vulnerabilities;
}
public function getLastVulnerabilityCount()
{
return $this->vulnerabilityCount;
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。