| Server IP : 161.248.188.39 / Your IP : 216.73.216.53 Web Server : Apache System : Linux 161-248-188-39.cprapid.com 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Sat Dec 2 05:23:44 EST 2023 x86_64 User : mysoftbd ( 1002) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /opt/cpanel/ea-wappspector/src/ |
Upload File : |
<?php
namespace Plesk\Wappspector;
use Plesk\Wappspector\Matchers\MatcherInterface;
use Plesk\Wappspector\MatchResult\EmptyMatchResult;
use Plesk\Wappspector\MatchResult\MatchResultInterface;
use Throwable;
final class Wappspector
{
/**
* @param callable $fsFactory
*/
public function __construct(private $fsFactory, private array $matchers)
{
}
/**
* @return MatchResultInterface[]
* @throws Throwable
*/
public function run(string $path, string $basePath = '/', int $matchersLimit = 0): iterable
{
$fs = ($this->fsFactory)($basePath);
$result = [];
/** @var MatcherInterface $matcher */
foreach ($this->matchers as $matcher) {
if (($match = $matcher->match($fs, $path)) instanceof EmptyMatchResult) {
continue;
}
$result[] = $match;
if ($matchersLimit > 0 && count($result) >= $matchersLimit) {
break;
}
}
return $result;
}
}