dont allow using null as view root
This commit is contained in:
parent
42d9ba0f83
commit
f391f88d7f
|
@ -76,6 +76,9 @@ class View {
|
||||||
* @throws \Exception If $root contains an invalid path
|
* @throws \Exception If $root contains an invalid path
|
||||||
*/
|
*/
|
||||||
public function __construct($root = '') {
|
public function __construct($root = '') {
|
||||||
|
if (is_null($root)) {
|
||||||
|
throw new \InvalidArgumentException('Root cant be null');
|
||||||
|
}
|
||||||
if(!Filesystem::isValidPath($root)) {
|
if(!Filesystem::isValidPath($root)) {
|
||||||
throw new \Exception();
|
throw new \Exception();
|
||||||
}
|
}
|
||||||
|
@ -85,6 +88,9 @@ class View {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAbsolutePath($path = '/') {
|
public function getAbsolutePath($path = '/') {
|
||||||
|
if ($path === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$this->assertPathLength($path);
|
$this->assertPathLength($path);
|
||||||
if ($path === '') {
|
if ($path === '') {
|
||||||
$path = '/';
|
$path = '/';
|
||||||
|
|
Loading…
Reference in New Issue