Why use DIRECTORY_SEPARATOR for winOS compatibility? After all, on winOS always work on both \ and /. We want use only convert from Win to Unix, but not Unix from Win
<?php
public function setViewsDir(var viewsDir)
{
var position, directory, directorySeparator, newViewsDir;
if typeof viewsDir != "string" && typeof viewsDir != "array" {
throw new Exception("Views directory must be a string or an array");
}
// we want only revert from WIN to UNIX
let directorySeparator = DIRECTORY_SEPARATOR;
if typeof viewsDir == "string" {
if substr(viewsDir, -1) != directorySeparator {
let viewsDir = viewsDir . directorySeparator;
}
let this->_viewsDirs = viewsDir;
} else {
let newViewsDir = [];
for position, directory in viewsDir {
if typeof directory != "string" {
throw new Exception("Views directory item must be a string");
}
if substr(directory, -1) != directorySeparator {
let newViewsDir[position] = directory . directorySeparator;
} else {
let newViewsDir[position] = directory;
}
}
let this->_viewsDirs = newViewsDir;
}
return this;
}
?>
DIRECTORY_SEPARATOR is OLD like PHP3