Test Failed
Push — master ( 1c8415...9f6059 )
by Julien
04:01
created

Config::defineConst()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 56

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 9
cp 0
rs 8.8333
cc 7
nc 64
nop 0
crap 56
1
<?php
2
/**
3
 * This file is part of the Zemit Framework.
4
 *
5
 * (c) Zemit Team <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE.txt
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zemit\Bootstrap;
12
13
use PDO;
14
use Zemit\Filter;
15
use Zemit\Filters;
16
use Zemit\Locale;
17
use Zemit\Models\User;
18
use Zemit\Modules\Api\Controllers\UserController;
19
use Zemit\Modules\Cli\Tasks\BuildTask;
20
use Zemit\Modules\Cli\Tasks\CacheTask;
21
use Zemit\Modules\Cli\Tasks\CronTask;
22
use Zemit\Modules\Cli\Tasks\ErrorTask;
23
use Zemit\Modules\Cli\Tasks\HelpTask;
24
use Zemit\Modules\Cli\Tasks\ScaffoldTask;
25
use Zemit\Modules\Frontend\Controllers\ErrorController;
26
use Zemit\Modules\Frontend\Controllers\IndexController;
27
use Zemit\Modules\Frontend\Controllers\TestController;
0 ignored issues
show
Bug introduced by
The type Zemit\Modules\Frontend\Controllers\TestController was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
use Zemit\Modules\Oauth2\Controllers\FacebookController;
29
use Zemit\Modules\Oauth2\Controllers\GoogleController;
30
use Zemit\Mvc\Controller\Behavior\Model\Create;
31
use Zemit\Mvc\Controller\Behavior\Model\Delete;
32
use Zemit\Mvc\Controller\Behavior\Model\Restore;
33
use Zemit\Mvc\Controller\Behavior\Model\Update;
34
use Zemit\Mvc\Controller\Behavior\Skip\SkipIdentityCondition;
35
use Zemit\Mvc\Controller\Behavior\Skip\SkipWhiteList;
36
use Zemit\Providers;
0 ignored issues
show
Bug introduced by
The type Zemit\Providers was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
37
use Zemit\Utils\Env;
38
use Zemit\Version;
39
use Zemit\Provider;
40
use Phalcon\Config as PhalconConfig;
41
42
/**
43
 * Class Config
44
 * {@inheritDoc}
45
 *
46
 * @author Julien Turbide <[email protected]>
47
 * @copyright Zemit Team <[email protected]>
48
 *
49
 * @since 1.0
50
 * @version 1.0
51
 *
52
 * @package Zemit\Bootstrap
53
 */
54
class Config extends PhalconConfig
55
{
56
    public function defineConst()
57
    {
58
        // @todo remove this
59
        ini_set('error_reporting', E_ALL);
60
        ini_set('display_errors', 1);
61
        
62
        defined('VENDOR_PATH') || define('VENDOR_PATH', Env::get('ROOT_PATH', 'vendor/'));
63
        defined('ROOT_PATH') || define('ROOT_PATH', Env::get('ROOT_PATH', null));
64
        defined('APP_PATH') || define('APP_PATH', Env::get('APP_PATH', null));
65
        defined('APPLICATION_ENV') || define('APPLICATION_ENV', Env::get('APPLICATION_ENV', 'development'));
66
        defined('CORE_PATH') || define('CORE_PATH', Env::get('CORE_PATH', mb_substr(__DIR__, 0, mb_strlen(basename(__DIR__)) * -1)));
67
        defined('PRIVATE_PATH') || define('PRIVATE_PATH', Env::get('APP_PRIVATE_PATH', constant('APP_PATH') . '/private/'));
68
    }
69
    
70
    /**
71
     * Config constructor.
72
     * {@inheritDoc}
73
     *
74
     * @param array $config
75
     */
76
    public function __construct($config = [])
77
    {
78
        $this->defineConst();
79
        
80
        parent::__construct([
81
            
82
            /**
83
             * Core only settings
84
             */
85
            'core' => [
86
                'name' => 'Zemit Core',
87
                'version' => Version::get(),
88
                'package' => 'zemit-cms',
89
                'modules' => [
90
                    \Zemit\Mvc\Module::NAME_FRONTEND => [
91
                        'className' => \Zemit\Modules\Frontend\Module::class,
92
                        'path' => CORE_PATH . 'Modules/Frontend/Module.php',
93
                    ],
94
                    \Zemit\Mvc\Module::NAME_BACKEND => [
95
                        'className' => \Zemit\Modules\Backend\Module::class,
96
                        'path' => CORE_PATH . 'Modules/Backend/Module.php',
97
                    ],
98
                    \Zemit\Mvc\Module::NAME_API => [
99
                        'className' => \Zemit\Modules\Api\Module::class,
100
                        'path' => CORE_PATH . 'Modules/Api/Module.php',
101
                    ],
102
                    \Zemit\Mvc\Module::NAME_CLI => [
103
                        'className' => \Zemit\Modules\Cli\Module::class,
104
                        'path' => CORE_PATH . 'Modules/Cli/Module.php',
105
                    ],
106
                    \Zemit\Mvc\Module::NAME_OAUTH2 => [
107
                        'className' => \Zemit\Modules\Oauth2\Module::class,
108
                        'path' => CORE_PATH . 'Modules/Oauth2/Module.php',
109
                    ],
110
                ],
111
                'dir' => [
112
                    'base' => CORE_PATH,
113
                    'locales' => CORE_PATH . 'Locales',
114
                    'modules' => CORE_PATH . 'Modules',
115
                ],
116
            ],
117
            
118
            /**
119
             * Application configuration
120
             */
121
            'app' => [
122
                'namespace' => Env::get('APP_NAMESPACE', 'Zemit'), // Namespace of your application
123
                'version' => Env::get('APP_VERSION', date('Ymd')), // allow to set and force a specific version
124
                'maintenance' => Env::get('APP_MAINTENANCE', false), // Set true to force the maintenance page
125
                'env' => Env::get('APP_ENV', Env::get('APPLICATION_ENV', null)), // Set the current environnement
126
                'debug' => Env::get('APP_DEBUG', false), // Set true to display debug
127
                'cache' => Env::get('APP_CACHE', false), // Set true to activate the cache
128
                'minify' => Env::get('APP_MINIFY', false), // Set true to activate minifying
129
                'copyright' => Env::get('APP_COPYRIGHT', false), // Set true to activate the cache
130
                'profiler' => Env::get('APP_PROFILER', false), // Set true to return the profiler
131
                'logger' => Env::get('APP_LOGGER', false), // Set true to enable logging
132
                'uri' => Env::get('APP_URI', '/'), // Base URI of your application
133
                'staticUri' => Env::get('APP_STATIC_URI', '/'), // Base URI of your application
134
                'encoding' => Env::get('APP_ENCODING', 'UTF-8'), // allow to set encoding to use with the application
135
                'timezone' => Env::get('APP_TIMEZONE', 'America/Montreal'), // allow to set timezone to use with the application
136
                'timeoutLimit' => Env::get('APP_TIMEOUT_LIMIT', 60), // allow to set timeout limit to use with the application
137
                'memoryLimit' => Env::get('APP_MEMORY_LIMIT', '256M'), // allow to set timeout limit to use with the application
138
                'postLimit' => Env::get('APP_POST_LIMIT', '20M'), // allow to set timeout limit to use with the application
139
                'sendEmail' => Env::get('APP_SEND_EMAIL', false), // allow to send real email or not
140
                
141
                'dir' => [
142
                    // project
143
                    'root' => Env::get('APP_ROOT_PATH', defined('ROOT_PATH') ? ROOT_PATH ?: getcwd() : getcwd()),
144
                    'vendor' => Env::get('APP_VENDOR_PATH', VENDOR_PATH),
145
                    'app' => Env::get('APP_PATH', APP_PATH . '/'),
146
                    'public' => Env::get('APP_PUBLIC_PATH', getcwd()),
147
                    
148
                    // app
149
                    'bootstrap' => Env::get('APP_BOOTSTRAP_PATH', APP_PATH . '/Bootstrap/'),
150
                    'common' => Env::get('APP_COMMON_PATH', APP_PATH . '/Common/'),
151
                    'config' => Env::get('APP_CONFIG_PATH', APP_PATH . '/Config/'),
152
                    'modules' => Env::get('APP_MODULES_PATH', APP_PATH . '/Modules/'),
153
                    'plugins' => Env::get('APP_PLUGINS_PATH', APP_PATH . '/Plugins/'),
154
                    'private' => PRIVATE_PATH,
155
                    
156
                    // private
157
                    'cache' => Env::get('APP_CACHE_PATH', PRIVATE_PATH . '/cache/'),
158
                    'log' => Env::get('APP_LOG_PATH', PRIVATE_PATH . '/log/'),
159
                    'files' => Env::get('APP_FILE_PATH', PRIVATE_PATH . '/files/'),
160
                    'trash' => Env::get('APP_TRASH_PATH', PRIVATE_PATH . '/trash/'),
161
                    'tmp' => Env::get('APP_TMP_PATH', PRIVATE_PATH . '/tmp/'),
162
                    'migrations' => Env::get('APP_MIGRATION_PATH', PRIVATE_PATH . '/migrations/'),
163
                ],
164
            ],
165
            
166
            /**
167
             * Debug Configuration
168
             */
169
            'debug' => [
170
                'enable' => Env::get('DEBUG_ENABLE', false),
171
                'exception' => Env::get('DEBUG_EXCEPTION', true),
172
                'lowSeverity' => Env::get('DEBUG_LOW_SEVERITY', true),
173
                'showFiles' => Env::get('DEBUG_SHOW_FILES', true),
174
                'showBackTrace' => Env::get('DEBUG_SHOW_BACKTRACE', true),
175
                'showFileFragment' => Env::get('DEBUG_SHOW_FRAGMENT', true),
176
                'uri' => Env::get('DEBUG_URI'),
177
                'blacklist' => [
178
                    'server' => [
179
                        'PWD',
180
                        'PASS',
181
                        'PASSWD',
182
                        'PASSWORD',
183
                        'TOKEN',
184
                        'HASH',
185
                        'DB_PWD',
186
                        'DB_PASS',
187
                        'DB_PASSWD',
188
                        'DB_PASSWORD',
189
                        'DATABASE_PWD',
190
                        'DATABASE_PASS',
191
                        'DATABASE_PASSWD',
192
                        'DATABASE_PASSWORD',
193
                        'SECURITY_WORKFACTOR',
194
                        'SECURITY_SALT',
195
                        'PASSPHRASE',
196
                        'SECRET',
197
                        'API_SECRET',
198
                        'API_KEY',
199
                    ],
200
                ],
201
            ],
202
    
203
            /**
204
             * Response Provider Configuration
205
             * - Set default security headers
206
             */
207
            'response' => [
208
                'headers' => [
209
                    'Content-Security-Policy-Report-Only' => Env::get('RESPONSE_HEADER_CSP_REPORT_ONLY', "default-src 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; object-src 'none'; connect-src 'self';"),
210
                    'Strict-Transport-Security' => Env::get('RESPONSE_HEADER_STRICT_TRANSPORT_SECURITY', 'max-age=63072000; includeSubDomains; preload'),
211
                    'X-Content-Type-Options' => Env::get('RESPONSE_HEADER_CONTENT_TYPE_OPTIONS', 'nosniff'),
212
                    'X-Frame-Options' => Env::get('RESPONSE_HEADER_FRAME_OPTIONS', 'Deny'),
213
                    'X-XSS-Protection' => Env::get('RESPONSE_HEADER_XSS_PROTECTION', 0),
214
                ],
215
            ],
216
            
217
            /**
218
             * Identity Provider Configuration
219
             */
220
            'identity' => [
221
                'userClass' => Env::get('IDENTITY_USER_CLASS', \Zemit\Models\User::class),
222
                'emailClass' => Env::get('IDENTITY_EMAIL_CLASS', \Zemit\Models\Email::class),
223
                'sessionClass' => Env::get('IDENTITY_SESSION_CLASS', \Zemit\Models\Session::class),
224
                'sessionKey' => Env::get('IDENTITY_SESSION_KEY', 'zemit-identity'),
225
            ],
226
            
227
            /**
228
             *
229
             */
230
            'models' => [
231
                
232
                // System
233
                \Zemit\Models\Backup::class => \Zemit\Models\Backup::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Backup was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
234
                \Zemit\Models\Audit::class => \Zemit\Models\Audit::class,
235
                \Zemit\Models\AuditDetail::class => \Zemit\Models\AuditDetail::class,
236
                \Zemit\Models\Log::class => \Zemit\Models\Log::class,
237
                \Zemit\Models\Email::class => \Zemit\Models\Email::class,
238
                \Zemit\Models\Job::class => \Zemit\Models\Job::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Job was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
239
                \Zemit\Models\File::class => \Zemit\Models\File::class,
240
                \Zemit\Models\Session::class => \Zemit\Models\Session::class,
241
                
242
                # system misc
243
                \Zemit\Models\Locale::class => \Zemit\Models\Locale::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Locale was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
244
                \Zemit\Models\Translation::class => \Zemit\Models\Translation::class,
245
                \Zemit\Models\Setting::class => \Zemit\Models\Setting::class,
246
                \Zemit\Models\Template::class => \Zemit\Models\Template::class,
247
                
248
                // Workspace
249
                \Zemit\Models\Workspace::class => \Zemit\Models\Workspace::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Workspace was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
250
                \Zemit\Models\WorkspaceProject::class => \Zemit\Models\WorkspaceProject::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\WorkspaceProject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
251
                \Zemit\Models\WorkspaceUser::class => \Zemit\Models\WorkspaceUser::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\WorkspaceUser was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
252
                
253
                // Project
254
                \Zemit\Models\Project::class => \Zemit\Models\Project::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Project was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
255
                \Zemit\Models\ProjectUser::class => \Zemit\Models\ProjectUser::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\ProjectUser was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
256
                \Zemit\Models\ProjectChannel::class => \Zemit\Models\ProjectChannel::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\ProjectChannel was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
257
                \Zemit\Models\ProjectEndpoint::class => \Zemit\Models\ProjectEndpoint::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\ProjectEndpoint was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
258
                \Zemit\Models\ProjectLocale::class => \Zemit\Models\ProjectLocale::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\ProjectLocale was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
259
                
260
                // Chanel
261
                \Zemit\Models\Channel::class => \Zemit\Models\Channel::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Channel was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
262
                \Zemit\Models\ChannelChannel::class => \Zemit\Models\ChannelChannel::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\ChannelChannel was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
263
                \Zemit\Models\ChannelField::class => \Zemit\Models\ChannelField::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\ChannelField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
264
                
265
                // User
266
                \Zemit\Models\Profile::class => \Zemit\Models\Profile::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Profile was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
267
                \Zemit\Models\User::class => \Zemit\Models\User::class,
268
                \Zemit\Models\UserType::class => \Zemit\Models\UserType::class,
269
                \Zemit\Models\UserGroup::class => \Zemit\Models\UserGroup::class,
270
                \Zemit\Models\UserRole::class => \Zemit\Models\UserRole::class,
271
                \Zemit\Models\UserFeature::class => \Zemit\Models\UserFeature::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\UserFeature was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
272
                
273
                // Role
274
                \Zemit\Models\Role::class => \Zemit\Models\Role::class,
275
                \Zemit\Models\RoleRole::class => \Zemit\Models\RoleRole::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\RoleRole was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
276
                \Zemit\Models\RoleFeature::class => \Zemit\Models\RoleFeature::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\RoleFeature was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
277
                
278
                // Group
279
                \Zemit\Models\Group::class => \Zemit\Models\Group::class,
280
                \Zemit\Models\GroupRole::class => \Zemit\Models\GroupRole::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\GroupRole was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
281
                \Zemit\Models\GroupType::class => \Zemit\Models\GroupType::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\GroupType was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
282
                \Zemit\Models\GroupFeature::class => \Zemit\Models\GroupFeature::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\GroupFeature was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
283
                
284
                // Type
285
                \Zemit\Models\Type::class => \Zemit\Models\Type::class,
286
                
287
                // Feature
288
                \Zemit\Models\Feature::class => \Zemit\Models\Feature::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Feature was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
289
                
290
                // Zemit
291
                \Zemit\Models\Permission::class => \Zemit\Models\Permission::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Permission was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
292
                \Zemit\Models\Flow::class => \Zemit\Models\Flow::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Flow was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
293
                \Zemit\Models\FlowAction::class => \Zemit\Models\FlowAction::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\FlowAction was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
294
                \Zemit\Models\Field::class => \Zemit\Models\Field::class,
0 ignored issues
show
Bug introduced by
The type Zemit\Models\Field was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
295
            ],
296
            
297
            /**
298
             * Service Provider Configuration
299
             */
300
            'providers' => [
301
                // abstract => concrete
302
                Provider\Environment\ServiceProvider::class => Provider\Environment\ServiceProvider::class,
303
                Provider\Security\ServiceProvider::class => Provider\Security\ServiceProvider::class,
304
                Provider\Session\ServiceProvider::class => Provider\Session\ServiceProvider::class,
305
                Provider\Cookies\ServiceProvider::class => Provider\Cookies\ServiceProvider::class,
306
                
307
                Provider\Locale\ServiceProvider::class => Provider\Locale\ServiceProvider::class,
308
                Provider\Translate\ServiceProvider::class => Provider\Translate\ServiceProvider::class,
309
                Provider\Url\ServiceProvider::class => Provider\Url\ServiceProvider::class,
310
                Provider\Request\ServiceProvider::class => Provider\Request\ServiceProvider::class,
311
                Provider\Response\ServiceProvider::class => Provider\Response\ServiceProvider::class,
312
                Provider\Router\ServiceProvider::class => Provider\Router\ServiceProvider::class,
313
                Provider\Dispatcher\ServiceProvider::class => Provider\Dispatcher\ServiceProvider::class,
314
                Provider\VoltTemplate\ServiceProvider::class => Provider\VoltTemplate\ServiceProvider::class,
315
                Provider\View\ServiceProvider::class => Provider\View\ServiceProvider::class,
316
                
317
                Provider\Profiler\ServiceProvider::class => Provider\Profiler\ServiceProvider::class,
318
                Provider\Database\ServiceProvider::class => Provider\Database\ServiceProvider::class,
319
                Provider\DatabaseReadOnly\ServiceProvider::class => Provider\DatabaseReadOnly\ServiceProvider::class,
320
                Provider\Annotations\ServiceProvider::class => Provider\Annotations\ServiceProvider::class,
321
                Provider\ModelsManager\ServiceProvider::class => Provider\ModelsManager\ServiceProvider::class,
322
                Provider\ModelsMetadata\ServiceProvider::class => Provider\ModelsMetadata\ServiceProvider::class,
323
                Provider\ModelsCache\ServiceProvider::class => Provider\ModelsCache\ServiceProvider::class,
324
                Provider\Mailer\ServiceProvider::class => Provider\Mailer\ServiceProvider::class,
325
                Provider\Logger\ServiceProvider::class => Provider\Logger\ServiceProvider::class,
326
                Provider\FileSystem\ServiceProvider::class => Provider\FileSystem\ServiceProvider::class,
327
                
328
                Provider\Assets\ServiceProvider::class => Provider\Assets\ServiceProvider::class,
329
                Provider\Tag\ServiceProvider::class => Provider\Tag\ServiceProvider::class,
330
                Provider\Filter\ServiceProvider::class => Provider\Filter\ServiceProvider::class,
331
                Provider\Flash\ServiceProvider::class => Provider\Flash\ServiceProvider::class,
332
                Provider\Escaper\ServiceProvider::class => Provider\Escaper\ServiceProvider::class,
333
                Provider\Markdown\ServiceProvider::class => Provider\Markdown\ServiceProvider::class,
334
                Provider\Utils\ServiceProvider::class => Provider\Utils\ServiceProvider::class,
335
                Provider\Crypt\ServiceProvider::class => Provider\Crypt\ServiceProvider::class,
336
                
337
                // oauth2
338
                Provider\Identity\ServiceProvider::class => Provider\Identity\ServiceProvider::class,
339
                Provider\Oauth2Facebook\ServiceProvider::class => Provider\Oauth2Facebook\ServiceProvider::class,
340
                Provider\Oauth2Google\ServiceProvider::class => Provider\Oauth2Google\ServiceProvider::class,
341
                
342
                // lib
343
                Provider\OCR\ServiceProvider::class => Provider\OCR\ServiceProvider::class,
344
                Provider\Jwt\ServiceProvider::class => Provider\Jwt\ServiceProvider::class,
345
                Provider\V8js\ServiceProvider::class => Provider\V8js\ServiceProvider::class,
346
                Provider\Captcha\ServiceProvider::class => Provider\Captcha\ServiceProvider::class,
347
                Provider\Gravatar\ServiceProvider::class => Provider\Gravatar\ServiceProvider::class,
348
                Provider\Clamav\ServiceProvider::class => Provider\Clamav\ServiceProvider::class,
349
//                Snowair\Debugbar\ServiceProvider::class => \Snowair\Debugbar\ServiceProvider::class,
350
            ],
351
            
352
            /**
353
             * Logger Configuration
354
             */
355
            'logger' => [
356
                'enable' => Env::get('LOGGER_ENABLE', false),
357
                
358
                'error' => Env::get('LOGGER_ERROR', false),
359
                'database' => Env::get('LOGGER_DATABASE', false),
360
                'dispatcher' => Env::get('LOGGER_DISPATCHER', false),
361
                'profiler' => Env::get('LOGGER_PROFILER', false),
362
                'mailer' => Env::get('LOGGER_MAILER', false),
363
                'cron' => Env::get('LOGGER_CRON', false),
364
                'auth' => Env::get('LOGGER_AUTH', false),
365
                
366
                'driver' => explode(',', Env::get('LOGGER_DRIVER', 'noop')),
367
                'drivers' => [
368
                    'noop' => [
369
                        'adapter' => \Phalcon\Logger\Adapter\Noop::class,
370
                    ],
371
                    'stream' => [
372
                        'adapter' => \Phalcon\Logger\Adapter\Stream::class,
373
                    ],
374
                    'syslog' => [
375
                        'adapter' => \Phalcon\Logger\Adapter\Syslog::class,
376
                    ],
377
                ],
378
                'default' => [
379
                    'path' => Env::get('LOGGER_PATH', PRIVATE_PATH . '/log/'),
380
                    'format' => Env::get('LOGGER_FORMAT', '[%date%][%type%] %message%'),
381
                    'date' => Env::get('LOGGER_DATE', 'Y-m-d H:i:s'),
382
                    'filename' => Env::get('LOGGER_DEFAULT_FILENAME', 'zemit'),
383
                ],
384
            ],
385
            
386
            /**
387
             * Default filters
388
             */
389
            'filters' => [
390
                Filter::FILTER_MD5 => Filters\Md5::class,
391
                Filter::FILTER_JSON => Filters\Json::class,
392
                Filter::FILTER_IPV4 => Filters\IPv4::class,
393
                Filter::FILTER_IPV6 => Filters\IPv6::class,
394
            ],
395
            
396
            /**
397
             * Default modules
398
             * @todo change this to class => [class => '', path => '']
399
             */
400
            'modules' => [
401
                \Zemit\Mvc\Module::NAME_FRONTEND => [
402
                    'className' => \Zemit\Modules\Frontend\Module::class,
403
                    'path' => CORE_PATH . 'Modules/Frontend/Module.php',
404
                ],
405
                \Zemit\Mvc\Module::NAME_BACKEND => [
406
                    'className' => \Zemit\Modules\Backend\Module::class,
407
                    'path' => CORE_PATH . 'Modules/Backend/Module.php',
408
                ],
409
                \Zemit\Mvc\Module::NAME_API => [
410
                    'className' => \Zemit\Modules\Api\Module::class,
411
                    'path' => CORE_PATH . 'Modules/Api/Module.php',
412
                ],
413
                \Zemit\Mvc\Module::NAME_CLI => [
414
                    'className' => \Zemit\Modules\Cli\Module::class,
415
                    'path' => CORE_PATH . 'Modules/Cli/Module.php',
416
                ],
417
                \Zemit\Mvc\Module::NAME_OAUTH2 => [
418
                    'className' => \Zemit\Modules\Oauth2\Module::class,
419
                    'path' => CORE_PATH . 'Modules/Oauth2/Module.php',
420
                ],
421
                /**
422
                 * @TODO support this way too
423
                 */
424
//                \Zemit\Modules\Frontend\Module::class => \Zemit\Modules\Frontend\Module::class,
425
//                \Zemit\Modules\Backend\Module::class => \Zemit\Modules\Backend\Module::class,
426
//                \Zemit\Modules\Api\Module::class => \Zemit\Modules\Api\Module::class,
427
//                \Zemit\Modules\Cli\Module::class => \Zemit\Modules\Cli\Module::class,
428
            ],
429
            
430
            /**
431
             * Default router settings
432
             */
433
            'router' => [
434
                'defaults' => [
435
                    'namespace' => Env::get('ROUTER_DEFAULT_NAMESPACE', 'Zemit\\Modules\\Frontend\\Controllers'),
436
                    'module' => Env::get('ROUTER_DEFAULT_MODULE', 'frontend'),
437
                    'controller' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
438
                    'task' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
439
                    'action' => Env::get('ROUTER_DEFAULT_ACTION', 'index'),
440
                ],
441
                'notFound' => [
442
                    'namespace' => Env::get('ROUTER_NOTFOUND_NAMESPACE', null),
443
                    'module' => Env::get('ROUTER_NOTFOUND_MODULE', null),
444
                    'controller' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
445
                    'task' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
446
                    'action' => Env::get('ROUTER_NOTFOUND_ACTION', 'notFound'),
447
                ],
448
                'fatal' => [
449
                    'namespace' => Env::get('ROUTER_FATAL_NAMESPACE', null),
450
                    'module' => Env::get('ROUTER_FATAL_MODULE', null),
451
                    'controller' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
452
                    'task' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
453
                    'action' => Env::get('ROUTER_FATAL_ACTION', 'fatal'),
454
                ],
455
                'forbidden' => [
456
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
457
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
458
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
459
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
460
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'forbidden'),
461
                ],
462
                'unauthorized' => [
463
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
464
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
465
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
466
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
467
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'unauthorized'),
468
                ],
469
                'maintenance' => [
470
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
471
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
472
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
473
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
474
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'maintenance'),
475
                ],
476
                'error' => [
477
                    'namespace' => Env::get('ROUTER_ERROR_NAMESPACE', null),
478
                    'module' => Env::get('ROUTER_ERROR_MODULE', null),
479
                    'controller' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
480
                    'task' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
481
                    'action' => Env::get('ROUTER_ERROR_ACTION', 'index'),
482
                ],
483
            ],
484
            
485
            /**
486
             * Gravatar Configuration
487
             */
488
            'gravatar' => [
489
                'default_image' => Env::get('GRAVATAR_DEFAULT_IMAGE', 'identicon'),
490
                'size' => Env::get('GRAVATAR_SIZE', 24),
491
                'rating' => Env::get('GRAVATAR_RATING', 'pg'),
492
                'use_https' => Env::get('GRAVATAR_HTPPS', true),
493
            ],
494
            
495
            /**
496
             * reCaptcha Configuration
497
             */
498
            'reCaptcha' => [
499
                'siteKey' => Env::get('RECAPTCHA_KEY'),
500
                'secret' => Env::get('RECAPTCHA_SECRET'),
501
            ],
502
            
503
            /**
504
             * Locale Service Settings
505
             */
506
            'locale' => [
507
                'default' => Env::get('LOCALE_DEFAULT', 'en'),
508
                'sessionKey' => Env::get('LOCALE_SESSION_KEY', 'zemit-locale'),
509
                'mode' => Env::get('LOCALE_MODE', Locale::MODE_SESSION_GEOIP),
510
                'allowed' => explode(',', Env::get('LOCALE_ALLOWED', 'en')),
511
            ],
512
            
513
            /**
514
             * Translate Service Settings
515
             */
516
            'translate' => [
517
                'locale' => Env::get('TRANSLATE_LOCALE', 'en_US.utf8'),
518
                'defaultDomain' => Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages'),
519
                'category' => Env::get('TRANSLATE_CATEGORY', LC_MESSAGES),
520
                'directory' => [
521
                    Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages') => Env::get('TRANSLATE_DEFAULT_PATH', CORE_PATH . 'Locales'),
522
                ],
523
            ],
524
            
525
            /**
526
             * Default Session Configuration
527
             */
528
            'session' => [
529
                'driver' => Env::get('SESSION_DRIVER', 'stream'),
530
                'drivers' => [
531
                    'stream' => [
532
                        'adapter' => Env::get('SESSION_STREAM_ADAPTER', \Phalcon\Session\Adapter\Stream::class),
533
                        'savePath' => Env::get('SESSION_STREAM_SAVE_PATH', '/tmp')
534
                    ],
535
                    'memcached' => [
536
                        'adapter' => Env::get('SESSION_MEMCACHED_ADAPTER', \Phalcon\Session\Adapter\Libmemcached::class),
537
                        'servers' => [
538
                            [
539
                                'host' => Env::get('SESSION_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
540
                                'port' => Env::get('SESSION_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
541
                                'weight' => Env::get('SESSION_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
542
                            ],
543
                        ],
544
                        // Client options must be instance of array
545
                        'client' => [],
546
                    ],
547
                    'redis' => [
548
                        'adapter' => Env::get('SESSION_REDIS_ADAPTER', \Phalcon\Session\Adapter\Redis::class),
549
                        'host' => Env::get('SESSION_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
550
                        'port' => Env::get('SESSION_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
551
                        'index' => Env::get('SESSION_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
552
                        'auth' => Env::get('SESSION_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
553
                        'persistent' => Env::get('SESSION_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', 0)),
554
                        'socket' => Env::get('SESSION_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
555
                    ],
556
                    'noop' => [
557
                        'adapter' => Env::get('SESSION_NOOP_ADAPTER', \Phalcon\Session\Adapter\Noop::class),
558
                    ],
559
                ],
560
                'default' => [
561
                    'prefix' => Env::get('SESSION_PREFIX', 'zemit_session_'),
562
                    'uniqueId' => Env::get('SESSION_UNIQUE_ID', 'zemit_'),
563
                    'lifetime' => Env::get('SESSION_LIFETIME', 3600),
564
                ],
565
                'ini' => [
566
                    'session.save_path' => Env::get('SESSION_SAVE_PATH', ''),
567
                    'session.name' => Env::get('SESSION_NAME', 'PHPSESSID'),
568
                    'session.save_handler' => Env::get('SESSION_SAVE_HANDLER', 'files'),
569
                    'session.auto_start' => Env::get('SESSION_AUTO_START', '0'),
570
                    'session.gc_probability' => Env::get('SESSION_GC_PROBABILITY', '1'),
571
                    'session.gc_divisor' => Env::get('SESSION_GC_DIVISOR', '100'),
572
                    'session.gc_maxlifetime' => Env::get('SESSION_GC_MAXLIFETIME', '1440'),
573
                    'session.serialize_handler' => Env::get('SESSION_SERIALIZE_HANDLER', 'php'),
574
                    'session.cookie_lifetime' => Env::get('SESSION_COOKIE_LIFETIME', '0'),
575
                    'session.cookie_path' => Env::get('SESSION_COOKIE_PATH', '/'),
576
                    'session.cookie_domain' => Env::get('SESSION_COOKIE_DOMAIN', ''),
577
                    'session.cookie_secure' => Env::get('SESSION_COOKIE_SECURE', '1'),
578
                    'session.cookie_httponly' => Env::get('SESSION_COOKIE_HTTPONLY', '1'),
579
                    'session.cookie_samesite' => Env::get('SESSION_COOKIE_SAMESITE', ''),
580
                    'session.use_strict_mode' => Env::get('SESSION_USE_STRICT_MODE', '0'),
581
                    'session.use_cookies' => Env::get('SESSION_USE_COOKIES', '1'),
582
                    'session.use_only_cookies' => Env::get('SESSION_USE_ONLY_COOKIES', '1'),
583
                    'session.referer_check' => Env::get('SESSION_REFERER_CHECK', ''),
584
                    'session.cache_limiter' => Env::get('SESSION_CACHE_LIMITER', 'nocache'),
585
                    'session.cache_expire' => Env::get('SESSION_CACHE_EXPIRE', '180'),
586
                    'session.use_trans_sid' => Env::get('SESSION_USE_TRANS_SID', '0'),
587
                    'session.trans_sid_tags' => Env::get('SESSION_TRANS_SID_TAGS', 'a=href,area=href,frame=src,form='),
588
                    'session.trans_sid_hosts' => Env::get('SESSION_TRANS_SID_HOSTS', $_SERVER['HTTP_HOST']),
589
                    'session.sid_length' => Env::get('SESSION_SID_LENGTH', '32'),
590
                    'session.sid_bits_per_character' => Env::get('SESSION_SID_BITS_PER_CHARACTER', '4'),
591
                    'session.upload_progress.enabled' => Env::get('SESSION_UPLOAD_PROGRESS_ENABLED', '1'),
592
                    'session.upload_progress.cleanup' => Env::get('SESSION_UPLOAD_PROGRESS_CLEANUP', '1'),
593
                    'session.upload_progress.prefix' => Env::get('SESSION_UPLOAD_PROGRESS_PREFIX', 'upload_progress_'),
594
                    'session.upload_progress.name' => Env::get('SESSION_UPLOAD_PROGRESS_NAME', 'PHP_SESSION_UPLOAD_PROGRESS'),
595
                    'session.upload_progress.freq' => Env::get('SESSION_UPLOAD_PROGRESS_FREQ', '1%'),
596
                    'session.upload_progress.min_freq' => Env::get('SESSION_UPLOAD_PROGRESS_MIN_FREQ', '1'),
597
                    'session.lazy_write' => Env::get('SESSION_LAZY_WRITE', '1'),
598
                    'session.hash_function' => Env::get('SESSION_HASH_FUNCTION', '0'),
599
                    'session.hash_bits_per_character' => Env::get('SESSION_HASH_BITS_PER_CHARACTER', '4'),
600
                    'session.entropy_file' => Env::get('SESSION_ENTROPY_FILE', ''),
601
                    'session.entropy_length' => Env::get('SESSION_ENTROPY_LENGTH', '0'),
602
                ],
603
            ],
604
            
605
            /**
606
             * Default module/plugin structure
607
             */
608
            'module' => [
609
                'dir' => [
610
                    // default
611
                    'modules' => Env::get('MODULE_DIR_MODULES', 'Modules/'),
612
                    'controllers' => Env::get('MODULE_DIR_CONTROLLER', 'Controllers/'),
613
                    'tasks' => Env::get('MODULE_DIR_TASKS', 'Tasks/'),
614
                    'models' => Env::get('MODULE_DIR_MODELS', 'Models/'),
615
                    'views' => Env::get('MODULE_DIR_VIEWS', 'Views/'),
616
                    'bootstrap' => Env::get('MODULE_DIR_BOOTSTRAP', 'Bootstrap/'),
617
                    'locales' => Env::get('MODULE_DIR_LOCALES', 'Locales/'),
618
                    'config' => Env::get('MODULE_DIR_CONFIG', 'Config/'),
619
                    
620
                    // private
621
                    'migrations' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
622
                    'cache' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
623
                    'logs' => Env::get('MODULE_DIR_LOGS', 'Private/migrations/'),
624
                    'backups' => Env::get('MODULE_DIR_BACKUPS', 'Private/backups/'),
625
                    'files' => Env::get('MODULE_DIR_FILES', 'Private/files/'),
626
                    'trash' => Env::get('MODULE_DIR_TRASH', 'Private/trash/'),
627
                ],
628
            ],
629
            
630
            /**
631
             * Default security settings
632
             */
633
            'security' => [ // phalcon security config
634
                'workfactor' => Env::get('SECURITY_WORKFACTOR', 12), // workfactor for the phalcon security service
635
                'salt' => Env::get('SECURITY_SALT', 'ZEMIT_CORE_DEFAULT_SALT') // salt for the phalcon security service
636
            ],
637
            
638
            /**
639
             * Cache drivers configs
640
             */
641
            'cache' => [
642
                'driver' => Env::get('CACHE_DRIVER', 'memory'),
643
                'drivers' => [
644
                    'memory' => [
645
                        'adapter' => Env::get('CACHE_MEMORY_ADAPTER', \Phalcon\Cache\Adapter\Memory::class),
646
                    ],
647
                    'apcu' => [
648
                        'adapter' => Env::get('CACHE_APCU_ADAPTER', \Phalcon\Cache\Adapter\Apcu::class),
649
                    ],
650
                    'stream' => [
651
                        'adapter' => Env::get('CACHE_STREAM_ADAPTER', \Phalcon\Cache\Adapter\Stream::class),
652
                        'cacheDir' => Env::get('CACHE_STREAM_DIR', PRIVATE_PATH . '/cache/data/'),
653
                    ],
654
                    'memcached' => [
655
                        'adapter' => Env::get('CACHE_MEMCACHED_ADAPTER', \Phalcon\Cache\Adapter\Libmemcached::class),
656
                        'servers' => [
657
                            [
658
                                'host' => Env::get('CACHE_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
659
                                'port' => Env::get('CACHE_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
660
                                'weight' => Env::get('CACHE_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
661
                            ],
662
                        ],
663
                    ],
664
                    'redis' => [
665
                        'adapter' => Env::get('CACHE_REDIS_ADAPTER', \Phalcon\Cache\Adapter\Redis::class),
666
                        'host' => Env::get('CACHE_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
667
                        'port' => Env::get('CACHE_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
668
                        'index' => Env::get('CACHE_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
669
                        'auth' => Env::get('CACHE_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
670
                        'persistent' => Env::get('CACHE_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', null)),
671
                        'socket' => Env::get('CACHE_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
672
                    ],
673
                ],
674
                'default' => [
675
                    'prefix' => Env::get('CACHE_PREFIX', 'zemit_cache_'),
676
                    'lifetime' => Env::get('CACHE_LIFETIME', 86400),
677
                    'defaultSerializer' => Env::get('CACHE_DEFAULT_SERIALIZER', 'Php'),
678
                ],
679
            ],
680
            
681
            /**
682
             * Metadata Configuration
683
             */
684
            'metadata' => [
685
                'driver' => Env::get('METADATA_DRIVER', 'memory'),
686
                'drivers' => [
687
                    'apcu' => [
688
                        'adapter' => Env::get('METADATA_APCU_ADAPTER', \Phalcon\Mvc\Model\MetaData\Apcu::class),
689
                    ],
690
                    'memory' => [
691
                        'adapter' => Env::get('METADATA_MEMORY_ADAPTER', \Phalcon\Mvc\Model\MetaData\Memory::class),
692
                    ],
693
                    'stream' => [
694
                        'adapter' => Env::get('METADATA_STREAM_ADAPTER', \Phalcon\Mvc\Model\MetaData\Stream::class),
695
                        'metaDataDir' => Env::get('METADATA_STREAM_DIR', PRIVATE_PATH . '/cache/metadata/'),
696
                    ],
697
                    'memcached' => [
698
                        'adapter' => Env::get('METADATA_MEMCACHED_ADAPTER', \Phalcon\Mvc\Model\MetaData\Libmemcached::class),
699
                        'servers' => [
700
                            [
701
                                'host' => Env::get('METADATA_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
702
                                'port' => Env::get('METADATA_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
703
                                'weight' => Env::get('METADATA_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
704
                            ],
705
                        ],
706
                    ],
707
                    'redis' => [
708
                        'adapter' => Env::get('METADATA_REDIS_ADAPTER', \Phalcon\Mvc\Model\MetaData\Redis::class),
709
                        'host' => Env::get('METADATA_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
710
                        'port' => Env::get('METADATA_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
711
                        'index' => Env::get('METADATA_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
712
                        'auth' => Env::get('METADATA_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
713
                        'persistent' => Env::get('METADATA_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', null)),
714
                        'socket' => Env::get('METADATA_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
715
                    ],
716
                    'wincache' => [
717
                        'adapter' => Env::get('METADATA_WINCACHE_ADAPTER', \Phalcon\Mvc\Model\MetaData\Wincache::class),
718
                    ],
719
                ],
720
                'default' => [
721
                    'lifetime' => Env::get('METADATA_LIFETIME', 172800),
722
                    'prefix' => Env::get('METADATA_PREFIX', 'zemit_metadata_'),
723
                ],
724
            ],
725
            
726
            /**
727
             * Annotations Configuration
728
             * - Memory
729
             * - Apcu
730
             * - Stream
731
             * - Memcached
732
             * - Redis
733
             * - Aerospike
734
             */
735
            'annotations' => [
736
                'default' => Env::get('ANNOTATIONS_DRIVER', 'memory'),
737
                'drivers' => [
738
                    'memory' => [
739
                        'adapter' => Env::get('ANNOTATIONS_MEMORY_ADAPTER', \Phalcon\Annotations\Adapter\Memory::class),
740
                    ],
741
                    'apcu' => [
742
                        'adapter' => Env::get('ANNOTATIONS_APCU_ADAPTER', \Phalcon\Annotations\Adapter\Apcu::class),
743
                    ],
744
                    'file' => [
745
                        'adapter' => Env::get('ANNOTATIONS_STREAM_ADAPTER', \Phalcon\Annotations\Adapter\Stream::class),
746
                        'annotationsDir' => Env::get('ANNOTATIONS_STREAM_DIR', PRIVATE_PATH . '/cache/annotations'),
747
                    ],
748
                    'memcached' => [
749
                        'adapter' => Env::get('ANNOTATIONS_MEMCACHED_ADAPTER', \Phalcon\Annotations\Adapter\Memcached::class),
750
                        'servers' => [
751
                            [
752
                                'host' => Env::get('ANNOTATIONS_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
753
                                'port' => Env::get('ANNOTATIONS_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
754
                                'weight' => Env::get('ANNOTATIONS_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
755
                            ],
756
                        ],
757
                    ],
758
                    'redis' => [
759
                        'adapter' => Env::get('ANNOTATIONS_REDIS_ADAPTER', \Phalcon\Annotations\Adapter\Redis::class),
760
                        'host' => Env::get('ANNOTATIONS_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
761
                        'port' => Env::get('ANNOTATIONS_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
762
                        'index' => Env::get('ANNOTATIONS_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
763
                        'auth' => Env::get('ANNOTATIONS_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
764
                        'persistent' => Env::get('ANNOTATIONS_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', null)),
765
                        'socket' => Env::get('ANNOTATIONS_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
766
                    ],
767
                    'aerospike' => [
768
                        'adapter' => Env::get('ANNOTATIONS_AEROSPIKE_ADAPTER', \Phalcon\Annotations\Adapter\Aerospike::class),
769
                    ],
770
                ],
771
                'prefix' => Env::get('ANNOTATIONS_PREFIX', 'zemit_annotations_'),
772
                'lifetime' => Env::get('ANNOTATIONS_LIFETIME', 86400),
773
            ],
774
            
775
            /**
776
             * Database configuration
777
             */
778
            'database' => [
779
                'default' => Env::get('DATABASE_ADAPTER', 'mysql'),
780
                'drivers' => [
781
                    'mysql' => [
782
                        'adapter' => 'Mysql',
783
                        'host' => Env::get('DATABASE_HOST', 'localhost'),
784
                        'port' => Env::get('DATABASE_PORT', 3306),
785
                        'dbname' => Env::get('DATABASE_DBNAME', ''),
786
                        'username' => Env::get('DATABASE_USERNAME', 'root'),
787
                        'password' => Env::get('DATABASE_PASSWORD', ''),
788
                        'charset' => Env::get('DATABASE_CHARSET', 'utf8'),
789
                        'options' => [
790
                            \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . Env::get('DATABASE_CHARSET', 'utf8'),
791
                            \PDO::ATTR_EMULATE_PREPARES => Env::get('DATABASE_PDO_EMULATE_PREPARES', false), // https://stackoverflow.com/questions/10113562/pdo-mysql-use-pdoattr-emulate-prepares-or-not
792
                            \PDO::ATTR_STRINGIFY_FETCHES => Env::get('DATABASE_PDO_STRINGIFY_FETCHES', false),
793
                            \PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => Env::get('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
794
                        ],
795
                        /**
796
                         * ReadOnly Configuration
797
                         */
798
                        'readOnly' => [
799
                            'enable' => Env::get('DATABASE_READONLY_ENABLE', false),
800
                            'host' => Env::get('DATABASE_READONLY_HOST'),
801
                            'port' => Env::get('DATABASE_READONLY_PORT'),
802
                            'dbname' => Env::get('DATABASE_READONLY_DBNAME'),
803
                            'username' => Env::get('DATABASE_READONLY_USERNAME'),
804
                            'password' => Env::get('DATABASE_READONLY_PASSWORD'),
805
                            'charset' => Env::get('DATABASE_READONLY_CHARSET'),
806
                        ],
807
                    ],
808
                ],
809
            ],
810
            
811
            /**
812
             * Mailer configuration
813
             */
814
            'mailer' => [
815
                'driver' => Env::get('MAILER_DRIVER', 'sendmail'),
816
                'drivers' => [
817
                    'mail' => [
818
                        'driver' => 'mail',
819
                    ],
820
                    'sendmail' => [
821
                        'driver' => 'sendmail',
822
                        'sendmail' => Env::get('MAILER_SENDMAIL', '/usr/sbin/sendmail -bs'),
823
                    ],
824
                    'smtp' => [
825
                        'driver' => 'smtp',
826
                        'host' => Env::get('MAILER_SMTP_HOST', 'localhost'),
827
                        'port' => Env::get('MAILER_SMTP_PORT', 25),
828
                        'encryption' => Env::get('MAILER_SMTP_ENCRYPTION', ''),
829
                        'username' => Env::get('MAILER_SMTP_USERNAME', ''),
830
                        'password' => Env::get('MAILER_SMTP_PASSWORD', ''),
831
                    ],
832
                ],
833
                'default' => [
834
                    'charset' => Env::get('MAILER_CHARSET', 'utf-8'),
835
                    'viewsDir' => Env::get('MAILER_VIEWS_DIR', APP_PATH . '/Modules/Frontend/Views/'),
836
                    'baseUri' => Env::get('MAILER_BASE_URI', null),
837
                ],
838
                'from' => [
839
                    'email' => Env::get('MAILER_FROM_EMAIL', 'zemit@localhost'),
840
                    'name' => Env::get('MAILER_FROM_NAME', 'Zemit'),
841
                ],
842
                'to' => [...explode(',', Env::get('MAILER_TO_EMAIL', ''))],
843
                'cc' => [...explode(',', Env::get('MAILER_CC_EMAIL', ''))],
844
                'bcc' => [...explode(',', Env::get('MAILER_BCC_EMAIL', ''))],
845
            ],
846
            
847
            /**
848
             * Cookies
849
             */
850
            'cookies' => [
851
                'useEncryption' => Env::get('COOKIES_USE_ENCRYPTION', true),
852
                'signKey' => Env::get('COOKIES_SIGN_KEY', ''),
853
            ],
854
            
855
            /**
856
             * Oauth2
857
             */
858
            'oauth2' => [
859
                'client' => [
860
                    'clientId' => Env::get('OAUTH2_CLIENT_ID'),
861
                    'clientSecret' => Env::get('OAUTH2_CLIENT_SECRET'),
862
                    'redirectUri' => Env::get('OAUTH2_CLIENT_REDIRECT_URI', '/oauth2/client/redirect'),
863
                    'urlAuthorize' => Env::get('OAUTH2_CLIENT_URL_AUTHORIZE', '/oauth2/client/authorize'),
864
                    'urlAccessToken' => Env::get('OAUTH2_CLIENT_URL_ACCESS_TOKEN', '/oauth2/client/token'),
865
                    'urlResourceOwnerDetails' => Env::get('OAUTH2_CLIENT_URL_RESOURCE', '/oauth2/client/resource'),
866
                    'proxy' => Env::get('OAUTH2_CLIENT_PROXY', null),
867
                    'verify' => Env::get('OAUTH2_CLIENT_VERIFY', true),
868
                ],
869
                'facebook' => [
870
                    'clientId' => Env::get('OAUTH2_FACEBOOK_CLIENT_ID'),
871
                    'clientSecret' => Env::get('OAUTH2_FACEBOOK_CLIENT_SECRET'),
872
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/facebook/callback'),
873
                    'graphApiVersion' => Env::get('OAUTH2_FACEBOOK_GRAPH_API_VERSION', 'v2.10'),
874
                ],
875
                'google' => [
876
                    'clientId' => Env::get('OAUTH2_GOOGLE_CLIENT_ID'),
877
                    'clientSecret' => Env::get('OAUTH2_GOOGLE_CLIENT_SECRET'),
878
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/google/callback'),
879
                    'hostedDomain' => Env::get('OAUTH2_FACEBOOK_CLIENT_HOSTED_DOMAIN', null), // optional; used to restrict access to users on your G Suite/Google Apps for Business accounts
880
                ],
881
                'instagram' => [
882
                
883
                ],
884
                'linked' => [
885
                
886
                ],
887
                'twitter' => [
888
                
889
                ],
890
                'github' => [
891
                
892
                ],
893
                'apple' => [
894
                
895
                ],
896
            ],
897
            
898
            /**
899
             * Dotenv
900
             */
901
            'dotenv' => [
902
                'filePath' => '',
903
            ],
904
            
905
            /**
906
             * Client config to pass to front-end
907
             */
908
            'client' => [],
909
            
910
            /**
911
             * Application permissions
912
             */
913
            'permissions' => [
914
                'features' => [
915
                    // This feature allow to administer users
916
                    'user' => [
917
                        'behaviors' => [
918
                        ],
919
                        'components' => [
920
                        ]
921
                    ],
922
                ],
923
                'roles' => [
924
                    // Everyone
925
                    'everyone' => [
926
                        'behaviors' => [
927
                        
928
                        ],
929
                        'features' => [
930
                            'user',
931
                        ],
932
                        'components' => [
933
                        
934
                        ],
935
                        'controllers' => [
936
                            IndexController::class => ['*'],
937
                            ErrorController::class => ['*'],
938
                            TestController::class => ['*'],
939
                            UserController::class => ['*'],
940
                            FacebookController::class => ['*'],
941
                            GoogleController::class => ['*'],
942
                        ],
943
                        'tasks' => [
944
                            CronTask::class => ['*'],
945
                            CacheTask::class => ['*'],
946
                            ErrorTask::class => ['*'],
947
                            ScaffoldTask::class => ['*'],
948
                            HelpTask::class => ['*'],
949
                            BuildTask::class => ['*'],
950
                        ],
951
                        'models' => [
952
                        
953
                        ],
954
                        'views' => [
955
                        
956
                        ],
957
                    ],
958
                    // Visitor Only
959
                    'visitor' => [
960
                    
961
                    ],
962
                    // Guest Only
963
                    'guest' => [
964
                    
965
                    ],
966
                    // User only
967
                    'user' => [
968
                    
969
                    ],
970
                    // Admin only
971
                    'admin' => [
972
                        'inherit' => [
973
                        ],
974
                        'behaviors' => [
975
                        ],
976
                    ],
977
                    // Dev only
978
                    'dev' => [
979
                        'inherit' => [
980
                            'admin'
981
                        ],
982
                    ],
983
                ]
984
            ],
985
        ]);
986
        if (!empty($config)) {
987
            $this->merge(new PhalconConfig($config));
988
        }
989
    }
990
    
991
    /**
992
     * Merge the specified environment config with this one
993
     * This should be used to overwrite specific values only
994
     *
995
     * @param null|string $env If null, will fetch the current environement from $this->app->env
996
     *
997
     * @return Config $this Return the merged current config
998
     */
999
    public function mergeEnvConfig($env = null)
1000
    {
1001
        $configFile = $this->app->dir->config . (isset($env) ? $env : $this->app->env) . '.php';
0 ignored issues
show
Bug Best Practice introduced by
The property app does not exist on Zemit\Bootstrap\Config. Since you implemented __get, consider adding a @property annotation.
Loading history...
1002
        
1003
        if (file_exists($configFile)) {
1004
            $envConfig = require_once $configFile;
1005
            if (!empty($envConfig)) {
1006
                $envConfig = is_callable($envConfig) ? $envConfig() : $envConfig;
1007
                if (is_array($envConfig)) {
1008
                    $this->merge(new PhalconConfig($envConfig));
1009
                }
1010
            }
1011
        }
1012
        
1013
        return $this;
1014
    }
1015
}
1016
1017
//if (php_sapi_name() === 'cli') {
1018
//    $devtoolConfig = new Config();
1019
//    return $devtoolConfig->mergeEnvConfig();
1020
//}
1021