for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Rj\FrontendBundle\Manifest\Loader;
use Rj\FrontendBundle\Manifest\Manifest;
abstract class AbstractManifestLoader implements ManifestLoaderInterface
{
private $path;
private $rootKey;
abstract protected function parse($path);
public function __construct($path, $rootKey = null)
if (!is_file($path)) {
throw new \InvalidArgumentException("The manifest file '$path' could not be found");
sprintf
$path
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.
// Instead of $x = "foo $bar $baz"; // Better use either $x = "foo " . $bar . " " . $baz; $x = sprintf("foo %s %s", $bar, $baz);
}
$this->path = $path;
$this->rootKey = $rootKey;
/**
* {@inheritdoc}
*/
public function load()
$entries = $this->parse($this->path);
if (!empty($this->rootKey)) {
if (!isset($entries[$this->rootKey])) {
throw new \InvalidArgumentException('Manifest file contains no '.$this->rootKey.' key');
$entries = $entries[$this->rootKey];
return new Manifest($entries);
public function getPath()
return $this->path;
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.