~canonical-sysadmins/wordpress/wp-plugin-all-in-one-event-calendar

« back to all changes in this revision

Viewing changes to lib/event/callback/abstract.php

  • Committer: Haw Loeung
  • Date: 2017-10-11 23:25:38 UTC
  • Revision ID: haw.loeung@canonical.com-20171011232538-gcewjkv2qzduv38s
Initial import of Time.ly's All-in-One Event Calendar plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Abstract Class for Callback Events.
 
5
 *
 
6
 * @author       Time.ly Network Inc.
 
7
 * @since       2.0
 
8
 *
 
9
 * @package       AI1EC
 
10
 * @subpackage AI1EC.Event
 
11
 */
 
12
abstract class Ai1ec_Event_Callback_Abstract {
 
13
 
 
14
    /**
 
15
     * @var Ai1ec_Registry_Object The Object registry.
 
16
     */
 
17
    protected $_registry      = null;
 
18
 
 
19
    /**
 
20
     * @var string The registry method name defined in the class map.
 
21
     */
 
22
    protected $_registry_name = null;
 
23
 
 
24
    /**
 
25
     * @var string The method invoked by the current callback.
 
26
     */
 
27
    protected $_method          = null;
 
28
 
 
29
    /**
 
30
     * Initiate callback objects.
 
31
     *
 
32
     * @param Ai1ec_Registry_Object $registry Registry object.
 
33
     * @param string                $path      Registry method name defined in the class map.
 
34
     * @param string                $method      Method invoked by the currect callback.
 
35
     *
 
36
     * @return void Constructor does not return.
 
37
     */
 
38
    public function __construct(
 
39
        Ai1ec_Registry_Object $registry,
 
40
        $path,
 
41
        $method
 
42
    ) {
 
43
        $this->_registry      = $registry;
 
44
        $this->_registry_name = $path;
 
45
        $this->_method          = $method;
 
46
    }
 
47
 
 
48
    /**
 
49
     * Invoke the method added to the current callback.
 
50
     *
 
51
     * @return mixed Value returned by the current method.
 
52
     */
 
53
    public function run() {
 
54
        $argv = func_get_args();
 
55
        return $this->_registry->dispatch(
 
56
            $this->_registry_name,
 
57
            $this->_method,
 
58
            $argv
 
59
        );
 
60
    }
 
61
 
 
62
}
 
 
b'\\ No newline at end of file'