cs
This commit is contained in:
@@ -29,9 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Portal\Utils;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\Utils\Layout as LayoutBase;
|
||||
use Espo\Core\Utils\Resource\FileReader\Params as FileReaderParams;
|
||||
use RuntimeException;
|
||||
|
||||
class Layout extends LayoutBase
|
||||
{
|
||||
@@ -41,7 +41,7 @@ class Layout extends LayoutBase
|
||||
$this->sanitizeInput($scope) !== $scope ||
|
||||
$this->sanitizeInput($name) !== $name
|
||||
) {
|
||||
throw new Error("Bad parameters.");
|
||||
throw new RuntimeException("Bad parameters.");
|
||||
}
|
||||
|
||||
$path = 'layouts/' . $scope . '/portal/' . $name . '.json';
|
||||
|
||||
@@ -84,7 +84,7 @@ class Layout
|
||||
$defaultImpl = $this->injectableFactory->create($defaultImplClassName);
|
||||
|
||||
if (!method_exists($defaultImpl, 'get')) {
|
||||
throw new RuntimeException("No 'get' method in '{$defaultImplClassName}'.");
|
||||
throw new RuntimeException("No 'get' method in '$defaultImplClassName'.");
|
||||
}
|
||||
|
||||
$data = $defaultImpl->get($scope);
|
||||
@@ -104,6 +104,6 @@ class Layout
|
||||
protected function sanitizeInput(string $name): string
|
||||
{
|
||||
/** @var string */
|
||||
return preg_replace("([\.]{2,})", '', $name);
|
||||
return preg_replace("([.]{2,})", '', $name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user