Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / libraries / plugins / PluginManager.class.php
blob28400b7b6cd6f66e61e8247828415327d13531e7
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * The PluginManager class is used alongside PluginObserver to implement
5 * the Observer Design Pattern.
7 * @package PhpMyAdmin
8 */
9 if (! defined('PHPMYADMIN')) {
10 exit;
13 /**
14 * This class implements the SplSubject interface
16 * @todo implement all methods
17 * @package PhpMyAdmin
18 * @link http://php.net/manual/en/class.splsubject.php
21 class PluginManager implements SplSubject
23 /**
24 * Contains a list with all the plugins that attach to it
26 * @var type SplObjectStorage
28 private $_storage;
30 /**
31 * Contains information about the current plugin state
33 * @var type string
35 private $_status;
37 /**
38 * Constructor
39 * Initializes $_storage with an empty SplObjectStorage
41 public function __construct()
43 $this->_storage = new SplObjectStorage();
46 /**
47 * Attaches an SplObserver so that it can be notified of updates
49 * @param SplObserver $observer The SplObserver to attach
51 * @return void
53 function attach (SplObserver $observer )
55 $this->_storage->attach($observer);
58 /**
59 * Detaches an observer from the subject to no longer notify it of updates
61 * @param SplObserver $observer The SplObserver to detach
63 * @return void
65 function detach (SplObserver $observer)
67 $this->_storage->detach($observer);
70 /**
71 * It is called after setStatus() was run by a certain plugin, and has
72 * the role of sending a notification to all of the plugins in $_storage,
73 * by calling the update() method for each of them.
75 * @todo implement
76 * @return void
78 function notify ()
82 /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
84 /**
85 * Gets the list with all the plugins that attach to it
87 * @return type SplObjectStorage
89 public function getStorage()
91 return $this->_storage;
94 /**
95 * Setter for $_storage
97 * @param SplObjectStorage $_storage the list with all the plugins that
98 * attach to it
100 * @return void
102 public function setStorage($_storage)
104 $this->_storage = $_storage;
108 * Gets the information about the current plugin state
109 * It is called by all the plugins in $_storage in their update() method
111 * @return type mixed
113 public function getStatus()
115 return $this->_status;
119 * Setter for $_status
120 * If a plugin changes its status, this has to be remembered in order to
121 * notify the rest of the plugins that they should update
123 * @param mixed $_status contains information about the current plugin state
125 * @return void
127 public function setStatus($_status)
129 $this->_status = $_status;