*/
private $total = 0;
+ /**
+ * By default the class loader is strict with naming-convention check
+ */
+ private static $strictNamingConventionCheck = TRUE;
+
/**
* Framework/application paths for classes, etc.
*/
//* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__);
}
+ /**
+ * Enables or disables strict naming-convention tests on class loading
+ *
+ * @param $strictNamingConventionCheck Whether to strictly check naming-convention
+ * @return void
+ */
+ public static function enableStrictNamingConventionCheck ($strictNamingConventionCheck = TRUE) {
+ self::$strictNamingConventionCheck = $strictNamingConventionCheck;
+ }
+
/**
* Registeres given relative path where test classes reside. For regular
* framework uses, they should not be loaded (and used).
*
* @param $className The class that shall be loaded
* @return void
+ * @throws InvalidArgumentException If strict-checking is enabled and class name is not following naming convention
*/
private function loadClassFile ($className) {
// Trace message
$classNameParts = explode("\\", $className);
// At least 3 parts should be there
- if (count($classNameParts) < 3) {
+ if ((self::$strictNamingConventionCheck === TRUE) && (count($classNameParts) < 3)) {
// Namespace scheme is: Project\Package[\SubPackage...]
throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Project\Package[\SubPackage...]\SomeFooBar', $className));
} // END - if