<?php
declare(strict_types=1);
namespace Plesk\Wappspector\Matchers;
use JsonException;
use League\Flysystem\Filesystem;
use Plesk\Wappspector\MatchResult\EmptyMatchResult;
use Plesk\Wappspector\MatchResult\MatchResultInterface;
use Plesk\Wappspector\MatchResult\NodeJs as MatchResult;
class NodeJs implements MatcherInterface
{
public function match(Filesystem $fs, string $path): MatchResultInterface
{
$packageFile = rtrim($path, '/') . '/package.json';
if (!$fs->fileExists($packageFile)) {
return new EmptyMatchResult();
}
$json = [];
try {
$json = json_decode($fs->read($packageFile), true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException) {
// ignore package.json errors
}
return new MatchResult($path, null, $json['name'] ?? null);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| CakePHP.php | File | 1.02 KB | 0644 |
|
| CodeIgniter.php | File | 1.14 KB | 0644 |
|
| Composer.php | File | 1.09 KB | 0644 |
|
| DotNet.php | File | 1.05 KB | 0644 |
|
| Drupal.php | File | 1.63 KB | 0644 |
|
| Duda.php | File | 1.72 KB | 0644 |
|
| Joomla.php | File | 3.79 KB | 0644 |
|
| Laravel.php | File | 1.9 KB | 0644 |
|
| MatcherInterface.php | File | 343 B | 0644 |
|
| NodeJs.php | File | 866 B | 0644 |
|
| Php.php | File | 1.07 KB | 0644 |
|
| Prestashop.php | File | 1.41 KB | 0644 |
|
| Python.php | File | 742 B | 0644 |
|
| Ruby.php | File | 713 B | 0644 |
|
| Sitejet.php | File | 976 B | 0644 |
|
| Siteplus.php | File | 1.79 KB | 0644 |
|
| Sitepro.php | File | 980 B | 0644 |
|
| Symfony.php | File | 905 B | 0644 |
|
| Typo3.php | File | 1.77 KB | 0644 |
|
| UpLevelMatcherTrait.php | File | 982 B | 0644 |
|
| WebPresenceBuilder.php | File | 1.97 KB | 0644 |
|
| Wordpress.php | File | 1.48 KB | 0644 |
|
| Yii.php | File | 1.64 KB | 0644 |
|