for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Rj\FrontendBundle\Manifest\Loader;
class JsonManifestLoader extends AbstractManifestLoader
{
/**
* {@inheritdoc}
*/
protected function parse($path)
$entries = json_decode(file_get_contents($path), true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception("Failed to parse json manifest file ($path): ".json_last_error_msg());
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);
}
return $entries;
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.