HEX
Server: Apache
System: Linux server.y-p01.co.uk 3.10.0-1160.144.1.el7.tuxcare.els3.x86_64 #1 SMP Fri Mar 6 13:52:53 UTC 2026 x86_64
User: calderca (1008)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cpanel/ea-wappspector/src/Matchers/EmDash.php
<?php
declare(strict_types=1);
namespace Plesk\Wappspector\Matchers;

use League\Flysystem\Filesystem;
use Plesk\Wappspector\MatchResult\EmDash as MatchResult;
use Plesk\Wappspector\MatchResult\EmptyMatchResult;
use Plesk\Wappspector\MatchResult\MatchResultInterface;

class EmDash implements MatcherInterface
{
    public function match(Filesystem $fs, string $path): MatchResultInterface
    {
        $packageJsonPath = rtrim($path, '/') . '/package.json';
        if (!$fs->fileExists($packageJsonPath)) {
            return new EmptyMatchResult();
        }

        $json = json_decode($fs->read($packageJsonPath), true);

        return is_array($json) && (isset($json['emdash']) || isset($json['dependencies']['emdash']))
            ? new MatchResult($path)
            : new EmptyMatchResult();
    }
}