Overview

Namespaces

  • None
  • Peg
    • Cli
      • Commands
    • Config
    • Custom
      • Command
        • Action
          • Generate
          • Parse
      • CommandLine
      • Config
      • Localization
      • Utilities
    • Lib
      • Definitions
        • Element
      • Generator
      • Lexers
      • Plugins
      • Signals
        • Data
          • Definitions
          • Lexers
        • Type
  • PHP

Classes

  • Signal
  • SignalData
  • SignalHandler
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: /**
 3:  * @author Jefferson González
 4:  * @license MIT
 5:  */
 6: 
 7: namespace Peg\Lib\Signals;
 8: 
 9: /**
10:  * Container of variable references that is passed to every signal listener.
11:  */
12: class SignalData
13: {
14:     /**
15:      * Associative array with references to stored arguments.
16:      * @var array
17:      */
18:     public $arguments;
19:     
20:     /**
21:      * Default constructor.
22:      */
23:     public function __construct()
24:     {
25:         $this->arguments = array();
26:     }
27:     
28:     /**
29:      * Store a reference to a variable.
30:      * @param string $name Name of variable.
31:      * @param mixed $value Current variable.
32:      */
33:     public function Add($name, &$value)
34:     {
35:         $this->arguments[$name] = &$value;
36:     }
37:     
38:     /**
39:      * Override default getter so we can get stored references.
40:      * @param type $name
41:      * @return mixed Returns null if property isn't found.
42:      */
43:     public function &__get($name)
44:     {
45:         if(!isset($this->arguments[$name]))
46:             return null;
47:         
48:         return $this->arguments[$name];
49:     }
50: }
PEG Api API documentation generated by ApiGen 2.8.0