====== Errorhandler class ====== Platform utilises a custom error handler, and a custom shutdown function that ensures that all semaphores are released on script end. There are also some utility functions for debugging code. ===== Typechecking ===== To introduce semi-strict type checking on functions, the class introduces the ''checkParams()'' which takes a variable number of parameters, but always in pairs of two. One pass a variable to the function and then a type name, and if the variable doesn't match the given type, then an error is triggered. Example: /** * Display name and age of person. * @param string $name Name of person. * @param int $age Age of person. */ function displayNameAndAge($name, $age) { Errorhandler::checkParams($name, 'string', $age, 'int'); echo $name.' - '.$age.' years.'; } This will trigger an error if the ''$name'' and ''$age'' variable isn't of the correct types. ==== Types ==== The following types can be checked. If anything else is typed it is considered a name of a class. |string| |int| |integer| |float| |array| |resource| |boolean| integer and floats are checked based on content and not variable type, so a string containing a valid integer number will pass as a integer.