PHP Classes

File: Test.php

Recommend this page to a friend!
  Classes of Till Wehowski  >  Event Emitter  >  Test.php  >  Download  
File: Test.php
Role: Example script
Content type: text/plain
Description: Example
Class: Event Emitter
Register handlers and dispatch named events
Author: By
Last change:
Date: 5 years ago
Size: 1,823 bytes
 

Contents

Class file image Download
<?php
namespace webfan\InstallShield\apc;



class
Test
{
   public function
run(){
       echo
'test'.PHP_EOL;
       
       \
frdl\webfan\App::God(false)->apc()
          ->
on('test', 'hello', $this)
       
          ->
trigger('test')
        ;
       
       
   
       
       
/**
        * $fo = new \O;
       $fo->cancel = $clear;
       $fo->add = $addState;
       $fo->events = $eventArray;
       $fo->status = $eventData;
       $fo->stateReady = $stateReady;
       $fo->stateGet = $stateGet;
        */
       
       
$test_state = \frdl\webfan\App::God(false)->apc()
            ->
              
required(array('ready', 'test-event-1', 'ontest', 'foo', 'bar'), array($this, 'fin1'), false)
              
        ;
       
       
// print_r($test_state);
       
    // echo '$test_state->stateReady("foo") expects to be false and is: '.$test_state->stateReady("foo").PHP_EOL;
       
echo 'trigger foo'.PHP_EOL;
// echo '$test_state->stateReady("foo") expects to be false and is: '.$test_state->stateReady("foo").PHP_EOL;
        
\frdl\webfan\App::God(false)->apc()
          ->
on('foo', 'hello', $this)
        
           ->
trigger('foo', array(1,2,3))
          
                      ->
trigger('ready', array(1,2,3))
                                 ->
trigger('test-event-1', array(1,2,3))
                                            ->
trigger('ontest', array(1,2,3))
                                                       ->
trigger('foo', array(1,2,3))
                                                                  ->
trigger('bar', array(1,2,3))
        ;
       
/**
        * should print:
        * test hello world trigger foo hello world hello world fin1 final state 1 reached
        */
       
        // echo '$test_state->stateReady("foo") expects to be false and is: '.$test_state->stateReady("foo").PHP_EOL;
       
   
}
   

    public function
hello(){
        echo
'hello world'.PHP_EOL;
// echo $_SERVER['DOCUMENT_ROOT'].PHP_EOL;
   
}
       

    public function
fin1(){
        echo
'fin1 final state 1 reached'.PHP_EOL;
    }

      
}

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