HelperFuncs

Static methods on HelperFuncs class

I have provided 2 static methods on the HelperFuncs class which can be found at sirJuni\Framework\Helper\HelperFuncs.

The methods are

  1. redirect($url)

It causes a redirect to the provided url. It comes handy instead of using the header function.

<?php
require __DIR__ . '/../vendor/autoload.php';

use sirJuni\Framework\Helper\HelperFuncs;

HelperFuncs::redirect("/user/Admin"); // prefix with HelperFuncs because its static member function
?>
  1. report($e)

This function is specifically for reporting exceptions. Instead of writing echo statements in the catch block, i wrote this function to report the errors based on set format.

The implementation of this function is simple

public static function report($e) {
    echo("File : " . $e->getFile() . "<br\> Line : " . $e->getLine() . "<br\> Message : " . $e->getMessage());
}

// to use
HelperFuncs::report($e);

Last updated