You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
702 B

<?php namespace Wpstudio\AssetsManifest\Classes;
class ManifestReader
{
private $manifest = null;
/**
* @param string $manifestPath
* @throws AssetsManifestException
*/
public function __construct(string $manifestPath)
{
if (!file_exists($manifestPath)) {
throw new AssetsManifestException('Not found: ' . $manifestPath);
}
if (!is_readable($manifestPath)) {
throw new AssetsManifestException('Not readable: ' . $manifestPath);
}
$this->manifest = json_decode(file_get_contents($manifestPath));
}
public function get(string $assetName)
{
return $this->manifest->$assetName;
}
}