/home/mjc1/public_html/phpMyAdmin/libraries/plugins/PluginObserver.class.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * The PluginObserver class is used alongside PluginManager to implement
 * the Observer Design Pattern.
 *
 * @package PhpMyAdmin
 */
if (! defined('PHPMYADMIN')) {
    exit;
}

/* Each PluginObserver instance contains a PluginManager instance */
require_once 'PluginManager.class.php';

/**
 * This class implements the SplObserver interface
 *
 * @package PhpMyAdmin
 * @link    http://php.net/manual/en/class.splobserver.php
 */
abstract class PluginObserver implements SplObserver
{
    
/**
     * PluginManager instance that contains a list with all the observer
     * plugins that attach to it
     *
     * @var type PluginManager
     */
    
private $_pluginManager;

    
/**
     * Constructor
     *
     * @param PluginManager $pluginManager The Plugin Manager instance
     */
    
public function __construct($pluginManager)
    {
        
$this->_pluginManager $pluginManager;
    }

    
/**
     * This method is called when any PluginManager to which the observer
     * is attached calls PluginManager::notify()
     *
     * TODO Declare this function abstract, removing its body,
     * as soon as we drop support for PHP 5.2.x.
     * See bug #3538655.
     *
     * @param SplSubject $subject The PluginManager notifying the observer
     *                            of an update.
     *
     * @return void
     */
    
public function update (SplSubject $subject)
    {
        throw new 
Exception(
            
'PluginObserver::update must be overridden in child classes.'
        
);
    }


    
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */


    /**
     * Gets the PluginManager instance that contains the list with all the
     * plugins that attached to it
     *
     * @return type PluginManager
     */
    
public function getPluginManager()
    {
        return 
$this->_pluginManager;
    }

    
/**
     * Setter for $_pluginManager
     *
     * @param PluginManager $_pluginManager the private instance that it will
     *                                      attach to
     *
     * @return void
     */
    
public function setPluginManager($_pluginManager)
    {
        
$this->_pluginManager $_pluginManager;
    }
}
?>