Menu

Mangan Unique Validator with extra criteria

Panoramio and digart termination

Dev Blog
Typical title for developers blog. Contains boring things.

Introducing polite PHP in error handler

Due to issues of handling exception in __toString PHP's method, the error handler can be invoked in such methods to catch exception and display nice stack trace. However using error handling in __toString methods need special care, thus very polite syntax have been introduced.

Example code to handle exceptions

public function __toString()
{
    try
    {
        // Do some stuff throwing exception
        return 'my result';
    }
    catch (Exception $exception)
    {
        ErrorHandler::please()->takeCareOf($this, $exception);
    }
}

This is actual working code in components project:)