1 | <?php |
||
28 | abstract class WordPoints_Entity_Context { |
||
29 | |||
30 | /** |
||
31 | * The slug of this context. |
||
32 | * |
||
33 | * @since 1.0.0 |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $slug; |
||
38 | |||
39 | /** |
||
40 | * The slug of the parent of this context, if this is a sub-context. |
||
41 | * |
||
42 | * @since 1.0.0 |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $parent_slug; |
||
47 | |||
48 | /** |
||
49 | * @since 1.0.0 |
||
50 | * |
||
51 | * @param string $slug The slug of this context. |
||
52 | */ |
||
53 | public function __construct( $slug ) { |
||
56 | |||
57 | /** |
||
58 | * Get the slug of this context. |
||
59 | * |
||
60 | * @since 1.0.0 |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function get_slug() { |
||
67 | |||
68 | /** |
||
69 | * Get the slug of the parent of this context, if it is a sub-context. |
||
70 | * |
||
71 | * Most contexts are really children of other contexts. For example, the 'site' |
||
72 | * context is a child of the 'network' context, since sites can only exist within |
||
73 | * a network. |
||
74 | * |
||
75 | * @since 1.0.0 |
||
76 | * |
||
77 | * @return string|null The slug of the parent context, or null if none. |
||
78 | */ |
||
79 | public function get_parent_slug() { |
||
82 | |||
83 | /** |
||
84 | * Get the current ID of this context. |
||
85 | * |
||
86 | * @since 1.0.0 |
||
87 | * |
||
88 | * @return int|string|false The ID or slug of the context, or false if not |
||
89 | * currently in this context. |
||
90 | */ |
||
91 | abstract public function get_current_id(); |
||
92 | } |
||
93 | |||
95 |