-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.php
152 lines (129 loc) · 4.35 KB
/
constants.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/*
* This file is part of the Rejoice package.
*
* (c) Prince Dorcis <princedorcis@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Defines Framework Constants.
*
* @author Prince Dorcis <princedorcis@gmail.com>
*/
use Prinx\Config;
use Rejoice\Foundation\Path;
$paths = new Path;
$config = new Config($paths->get('app_config_dir'));
define('APP_REQUEST_INIT', $config->get('app.request_init'));
define('APP_REQUEST_END', $config->get('app.request_end'));
define('APP_REQUEST_FAILED', $config->get('app.request_failed'));
define('APP_REQUEST_CANCELLED', $config->get('app.request_cancelled'));
define('APP_REQUEST_ASK_USER_RESPONSE', $config->get('app.request_ask_user_response'));
define('APP_REQUEST_USER_SENT_RESPONSE', $config->get('app.request_user_sent_response'));
define(
'APP_REQUEST_ASK_USER_BEFORE_RELOAD_PREVIOUS_SESSION',
'__CUSTOM_REQUEST_TYPE1'
);
define(
'APP_REQUEST_RELOAD_PREVIOUS_SESSION_DIRECTLY',
'__CUSTOM_REQUEST_TYPE2'
);
define('MSG', 'message');
define('ACTIONS', 'actions');
define('ITEM_MSG', 'display');
define('ITEM_ACTION', 'next_menu');
define('ITEM_LATER', 'later');
define('SAVE_RESPONSE_AS', 'save_as');
define('DEFAULT_NEXT_MENU', 'default_next_menu');
define('MENU', 'menu');
define('VALIDATE', 'validate');
define('FORCED_MENU_FLOW', 'forced_menu_flow');
define('APP_WELCOME', '__welcome');
define('APP_BACK', '__back');
define('APP_SAME', '__same');
define('APP_END', '__end');
define('APP_SPLITTED_MENU_NEXT', '__split_next');
define('APP_SPLITTED_MENU_BACK', '__split_back');
define('APP_CONTINUE_PREVIOUS_SESSION', '__continue_previous_session');
define('APP_PAGINATE_FORWARD', '__paginate_forward');
define('APP_PAGINATE_BACK', '__paginate_back');
/*
* Actions refer to a certain type of special menu that the app can manage
* automatically:
*
* APP_WELCOME: throw the welcome menu
* APP_BACK: throw the previous menu
* APP_SAME: re-throw the current menu
* APP_END: throw a goodbye menu
* APP_CONTINUE_PREVIOUS_SESSION: throw the menu on which the user was before
* request timed out or was cancelled
*/
define('RESERVED_MENU_IDs', [
APP_WELCOME,
APP_END,
APP_BACK,
APP_SAME,
APP_CONTINUE_PREVIOUS_SESSION,
APP_SPLITTED_MENU_NEXT,
APP_SPLITTED_MENU_BACK,
APP_PAGINATE_FORWARD,
APP_PAGINATE_BACK,
]);
define('WELCOME_MENU_NAME', 'welcome');
define('MENU_MSG_DELIMITER', ':');
define(
'REQUIRED_REQUEST_PARAMS',
[
$config->get('app.request_param_user_phone_number'),
$config->get('app.request_param_user_network'),
$config->get('app.request_param_session_id'),
$config->get('app.request_param_user_response'),
$config->get('app.request_param_request_type'),
]
);
define('ALLOWED_REQUEST_CHANNELS', ['USSD', 'WHATSAPP', 'CONSOLE']);
define(
'ASK_USER_BEFORE_RELOAD_PREVIOUS_SESSION',
'ask_user_before_reload_previous_session'
);
define('DEVELOPER_SAVED_DATA', 'session_data_accessible_by_app');
define('CURRENT_MENU_ACTIONS', 'modify_menus');
define('RESERVED_MENU_ACTIONS', [
DEFAULT_NEXT_MENU,
VALIDATE,
]);
define('MENU_ENTITY_VALIDATE_RESPONSE', 'validate');
define('MENU_ENTITY_SAVE_RESPONSE_AS', 'saveAs');
define('MENU_ENTITY_DEFAULT_NEXT_MENU', 'defaultNextMenu');
define('MENU_ENTITY_MESSAGE', 'message');
define('MENU_ENTITY_ACTIONS', 'actions');
define('MENU_ENTITY_BEFORE', 'before');
define('MENU_ENTITY_AFTER', 'after');
define('MENU_ENTITY_ON_MOVE_TO_NEXT_MENU', 'onMoveToNextMenu');
define('MENU_ENTITY_ON_BACK', 'onBack');
define('MENU_ENTITY_ON_PAGINATE_FORWARD', 'onPaginateForward');
define('MENU_ENTITY_ON_PAGINATE_BACK', 'onPaginateBack');
define('MENU_ENTITIES_NAMESPACE', 'App\\Menus\\');
define('MENU_HOOKS', [
MENU_ENTITY_VALIDATE_RESPONSE,
MENU_ENTITY_SAVE_RESPONSE_AS,
MENU_ENTITY_DEFAULT_NEXT_MENU,
MENU_ENTITY_MESSAGE,
MENU_ENTITY_ACTIONS,
MENU_ENTITY_BEFORE,
MENU_ENTITY_AFTER,
MENU_ENTITY_ON_MOVE_TO_NEXT_MENU,
MENU_ENTITY_ON_BACK,
MENU_ENTITY_ON_PAGINATE_FORWARD,
MENU_ENTITY_ON_PAGINATE_BACK,
]);
define('RECEIVE_USER_RESPONSE', [
MENU_ENTITY_VALIDATE_RESPONSE,
MENU_ENTITY_SAVE_RESPONSE_AS,
MENU_ENTITY_AFTER,
MENU_ENTITY_ON_MOVE_TO_NEXT_MENU,
]);
define('DEFAULT_NAMESPACE', 'Rejoice\\');
define('DEV_ENV', ['dev', 'development', 'local', 'staging']);