dont allow using null as view root

This commit is contained in:
Robin Appelman 2015-04-22 14:51:02 +02:00
parent 42d9ba0f83
commit f391f88d7f

View file

@ -76,6 +76,9 @@ class View {
* @throws \Exception If $root contains an invalid path
*/
public function __construct($root = '') {
if (is_null($root)) {
throw new \InvalidArgumentException('Root cant be null');
}
if(!Filesystem::isValidPath($root)) {
throw new \Exception();
}
@ -85,6 +88,9 @@ class View {
}
public function getAbsolutePath($path = '/') {
if ($path === null) {
return null;
}
$this->assertPathLength($path);
if ($path === '') {
$path = '/';