<?php /** * Created by PhpStorm. * User: robin * Date: 5/29/16 * Time: 2:59 PM */ class AbortException extends \Exception { public function __construct($code, $reason) { parent::__construct($reason, $code, null); } } function abort($code, $reason) { throw new AbortException($code, $reason); }