/** If the class does not exist, try to include it
* If it could not be included, trigger a warning.
* @param string $className name of the class
* @param $dir application folder path
* For each class name inclusion is first tried from $thisfunction (->(),
* If the class is not found, a class from the classes root folder is tried.
* However, this behavior may be overridden on Site::getTryUseClassTryParams
* @return boolean wheather a class file was included. Also true if the class already existed.
* @throw PntValidationException if no class included
*/
function useClass($className, $dir) {
if (!$this->($className, $dir)) {
$params = $this->($className, $dir);
throw new PntValidationException(
"$this - useClass: class not found: "
.$params[0][1]. $params[0][0].", "
. $params[1][1]. $params[1][0]);
return false;
}
return true;
}
|