Skip to content

Commit

Permalink
Adds fallback for path init
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrrill committed Dec 5, 2014
1 parent 4758428 commit 3f92301
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion classes/Core/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ class Path
*/
public function __construct($path = null)
{
$this->path = ($path) ?: dirname($_SERVER['DOCUMENT_ROOT']."/../../");
if ($path !== null) {
$this->path = $path;
} else{
if ($_SERVER['DOCUMENT_ROOT']) {
$this->path = dirname($_SERVER['DOCUMENT_ROOT']."/../../");
} else {
$this->path = realpath(__DIR__."/../../../../..");
}
}
}

public function __toString()
Expand Down

0 comments on commit 3f92301

Please sign in to comment.