PHP Classes

File: examples/onBefore/login.php

Recommend this page to a friend!
  Classes of Nicola Covolo  >  Decorate  >  examples/onBefore/login.php  >  Download  
File: examples/onBefore/login.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Decorate
Alter functions running code before and after
Author: By
Last change: improved examples
Date: 1 month ago
Size: 423 bytes


Class file image Download

require "../../Decorate.php";

$login = function ($name)
    if (
$name !== 'Oliver')
        throw new
Exception("sorry $name, this secret is not for you!<br>");

$secret = function ($name)
"welcome to the secret, $name<br>";

$secret = Decorate::onBefore($secret, $login);

catch (
exception $e)
    echo (

For more information send a message to info at phpclasses dot org.