Test Failed
Push — master ( 9c9189...1c8415 )
by Julien
03:47
created

Config::mergeEnvConfig()   A

Complexity

Conditions 6
Paths 12

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 12.1743

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
ccs 4
cts 9
cp 0.4444
rs 9.2222
cc 6
nc 12
nop 1
crap 12.1743
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 4
    public function defineConst()
57
    {
58
        // @todo remove this
59 4
        ini_set('error_reporting', E_ALL);
60 4
        ini_set('display_errors', 1);
61
        
62 4
        defined('VENDOR_PATH') || define('VENDOR_PATH', Env::get('ROOT_PATH', 'vendor/'));
63 4
        defined('ROOT_PATH') || define('ROOT_PATH', Env::get('ROOT_PATH', null));
64 4
        defined('APP_PATH') || define('APP_PATH', Env::get('APP_PATH', null));
65 4
        defined('APPLICATION_ENV') || define('APPLICATION_ENV', Env::get('APPLICATION_ENV', 'development'));
66 4
        defined('CORE_PATH') || define('CORE_PATH', Env::get('CORE_PATH', mb_substr(__DIR__, 0, mb_strlen(basename(__DIR__)) * -1)));
67 4
        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 4
    public function __construct($config = [])
77
    {
78 4
        $this->defineConst();
79
        
80 4
        parent::__construct([
81
            
82
            /**
83
             * Core only settings
84
             */
85
            'core' => [
86 4
                'name' => 'Zemit Core',
87 4
                'version' => Version::get(),
88
                'package' => 'zemit-cms',
89
                'modules' => [
90 4
                    \Zemit\Mvc\Module::NAME_FRONTEND => [
91
                        'className' => \Zemit\Modules\Frontend\Module::class,
92 4
                        'path' => CORE_PATH . 'Modules/Frontend/Module.php',
93
                    ],
94
                    \Zemit\Mvc\Module::NAME_BACKEND => [
95
                        'className' => \Zemit\Modules\Backend\Module::class,
96 4
                        'path' => CORE_PATH . 'Modules/Backend/Module.php',
97
                    ],
98
                    \Zemit\Mvc\Module::NAME_API => [
99
                        'className' => \Zemit\Modules\Api\Module::class,
100 4
                        'path' => CORE_PATH . 'Modules/Api/Module.php',
101
                    ],
102
                    \Zemit\Mvc\Module::NAME_CLI => [
103
                        'className' => \Zemit\Modules\Cli\Module::class,
104 4
                        'path' => CORE_PATH . 'Modules/Cli/Module.php',
105
                    ],
106
                    \Zemit\Mvc\Module::NAME_OAUTH2 => [
107
                        'className' => \Zemit\Modules\Oauth2\Module::class,
108 4
                        'path' => CORE_PATH . 'Modules/Oauth2/Module.php',
109
                    ],
110
                ],
111
                'dir' => [
112 4
                    'base' => CORE_PATH,
113 4
                    'locales' => CORE_PATH . 'Locales',
114 4
                    'modules' => CORE_PATH . 'Modules',
115
                ],
116
            ],
117
            
118
            /**
119
             * Application configuration
120
             */
121
            'app' => [
122 4
                'namespace' => Env::get('APP_NAMESPACE', 'Zemit'), // Namespace of your application
123 4
                'version' => Env::get('APP_VERSION', date('Ymd')), // allow to set and force a specific version
124 4
                'maintenance' => Env::get('APP_MAINTENANCE', false), // Set true to force the maintenance page
125 4
                'env' => Env::get('APP_ENV', Env::get('APPLICATION_ENV', null)), // Set the current environnement
126 4
                'debug' => Env::get('APP_DEBUG', false), // Set true to display debug
127 4
                'cache' => Env::get('APP_CACHE', false), // Set true to activate the cache
128 4
                'minify' => Env::get('APP_MINIFY', false), // Set true to activate minifying
129 4
                'copyright' => Env::get('APP_COPYRIGHT', false), // Set true to activate the cache
130 4
                'profiler' => Env::get('APP_PROFILER', false), // Set true to return the profiler
131 4
                'logger' => Env::get('APP_LOGGER', false), // Set true to enable logging
132 4
                'uri' => Env::get('APP_URI', '/'), // Base URI of your application
133 4
                'staticUri' => Env::get('APP_STATIC_URI', '/'), // Base URI of your application
134 4
                'encoding' => Env::get('APP_ENCODING', 'UTF-8'), // allow to set encoding to use with the application
135 4
                'timezone' => Env::get('APP_TIMEZONE', 'America/Montreal'), // allow to set timezone to use with the application
136 4
                'timeoutLimit' => Env::get('APP_TIMEOUT_LIMIT', 60), // allow to set timeout limit to use with the application
137 4
                'memoryLimit' => Env::get('APP_MEMORY_LIMIT', '256M'), // allow to set timeout limit to use with the application
138 4
                'postLimit' => Env::get('APP_POST_LIMIT', '20M'), // allow to set timeout limit to use with the application
139 4
                'sendEmail' => Env::get('APP_SEND_EMAIL', false), // allow to send real email or not
140
                
141
                'dir' => [
142
                    // project
143 4
                    'root' => Env::get('APP_ROOT_PATH', defined('ROOT_PATH') ? ROOT_PATH ?: getcwd() : getcwd()),
144 4
                    'vendor' => Env::get('APP_VENDOR_PATH', VENDOR_PATH),
145 4
                    'app' => Env::get('APP_PATH', APP_PATH . '/'),
146 4
                    'public' => Env::get('APP_PUBLIC_PATH', getcwd()),
147
                    
148
                    // app
149 4
                    'bootstrap' => Env::get('APP_BOOTSTRAP_PATH', APP_PATH . '/Bootstrap/'),
150 4
                    'common' => Env::get('APP_COMMON_PATH', APP_PATH . '/Common/'),
151 4
                    'config' => Env::get('APP_CONFIG_PATH', APP_PATH . '/Config/'),
152 4
                    'modules' => Env::get('APP_MODULES_PATH', APP_PATH . '/Modules/'),
153 4
                    'plugins' => Env::get('APP_PLUGINS_PATH', APP_PATH . '/Plugins/'),
154
                    'private' => PRIVATE_PATH,
155
                    
156
                    // private
157 4
                    'cache' => Env::get('APP_CACHE_PATH', PRIVATE_PATH . '/cache/'),
158 4
                    'log' => Env::get('APP_LOG_PATH', PRIVATE_PATH . '/log/'),
159 4
                    'files' => Env::get('APP_FILE_PATH', PRIVATE_PATH . '/files/'),
160 4
                    'trash' => Env::get('APP_TRASH_PATH', PRIVATE_PATH . '/trash/'),
161 4
                    'tmp' => Env::get('APP_TMP_PATH', PRIVATE_PATH . '/tmp/'),
162 4
                    'migrations' => Env::get('APP_MIGRATION_PATH', PRIVATE_PATH . '/migrations/'),
163
                ],
164
            ],
165
            
166
            /**
167
             * Debug Configuration
168
             */
169
            'debug' => [
170 4
                'enable' => Env::get('DEBUG_ENABLE', false),
171 4
                'exception' => Env::get('DEBUG_EXCEPTION', true),
172 4
                'lowSeverity' => Env::get('DEBUG_LOW_SEVERITY', true),
173 4
                'showFiles' => Env::get('DEBUG_SHOW_FILES', true),
174 4
                'showBackTrace' => Env::get('DEBUG_SHOW_BACKTRACE', true),
175 4
                'showFileFragment' => Env::get('DEBUG_SHOW_FRAGMENT', true),
176 4
                '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 4
                    '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 4
                    'Strict-Transport-Security' => Env::get('RESPONSE_HEADER_STRICT_TRANSPORT_SECURITY', 'max-age=63072000; includeSubDomains; preload'),
211 4
                    'X-Content-Type-Options' => Env::get('RESPONSE_HEADER_CONTENT_TYPE_OPTIONS', 'nosniff'),
212 4
                    'X-Frame-Options' => Env::get('RESPONSE_HEADER_FRAME_OPTIONS', 'Deny'),
213 4
                    'X-XSS-Protection' => Env::get('RESPONSE_HEADER_XSS_PROTECTION', 0),
214
                ],
215
            ],
216
            
217
            /**
218
             * Identity Provider Configuration
219
             */
220
            'identity' => [
221 4
                'userClass' => Env::get('IDENTITY_USER_CLASS', \Zemit\Models\User::class),
222 4
                'emailClass' => Env::get('IDENTITY_EMAIL_CLASS', \Zemit\Models\Email::class),
223 4
                'sessionClass' => Env::get('IDENTITY_SESSION_CLASS', \Zemit\Models\Session::class),
224 4
                '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 4
                'enable' => Env::get('LOGGER_ENABLE', false),
357
                
358 4
                'error' => Env::get('LOGGER_ERROR', false),
359 4
                'database' => Env::get('LOGGER_DATABASE', false),
360 4
                'dispatcher' => Env::get('LOGGER_DISPATCHER', false),
361 4
                'profiler' => Env::get('LOGGER_PROFILER', false),
362 4
                'mailer' => Env::get('LOGGER_MAILER', false),
363 4
                'cron' => Env::get('LOGGER_CRON', false),
364 4
                'auth' => Env::get('LOGGER_AUTH', false),
365
                
366 4
                '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 4
                    'path' => Env::get('LOGGER_PATH', PRIVATE_PATH . '/log/'),
380 4
                    'format' => Env::get('LOGGER_FORMAT', '[%date%][%type%] %message%'),
381 4
                    'date' => Env::get('LOGGER_DATE', 'Y-m-d H:i:s'),
382 4
                    'filename' => Env::get('LOGGER_DEFAULT_FILENAME', 'zemit'),
383
                ],
384
            ],
385
            
386
            /**
387
             * Default filters
388
             */
389
            'filters' => [
390 4
                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 4
                \Zemit\Mvc\Module::NAME_FRONTEND => [
402
                    'className' => \Zemit\Modules\Frontend\Module::class,
403 4
                    'path' => CORE_PATH . 'Modules/Frontend/Module.php',
404
                ],
405
                \Zemit\Mvc\Module::NAME_BACKEND => [
406
                    'className' => \Zemit\Modules\Backend\Module::class,
407 4
                    'path' => CORE_PATH . 'Modules/Backend/Module.php',
408
                ],
409
                \Zemit\Mvc\Module::NAME_API => [
410
                    'className' => \Zemit\Modules\Api\Module::class,
411 4
                    'path' => CORE_PATH . 'Modules/Api/Module.php',
412
                ],
413
                \Zemit\Mvc\Module::NAME_CLI => [
414
                    'className' => \Zemit\Modules\Cli\Module::class,
415 4
                    'path' => CORE_PATH . 'Modules/Cli/Module.php',
416
                ],
417
                \Zemit\Mvc\Module::NAME_OAUTH2 => [
418
                    'className' => \Zemit\Modules\Oauth2\Module::class,
419 4
                    '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 4
                    'namespace' => Env::get('ROUTER_DEFAULT_NAMESPACE', 'Zemit\\Modules\\Frontend\\Controllers'),
436 4
                    'module' => Env::get('ROUTER_DEFAULT_MODULE', 'frontend'),
437 4
                    'controller' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
438 4
                    'task' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
439 4
                    'action' => Env::get('ROUTER_DEFAULT_ACTION', 'index'),
440
                ],
441
                'notFound' => [
442 4
                    'namespace' => Env::get('ROUTER_NOTFOUND_NAMESPACE', null),
443 4
                    'module' => Env::get('ROUTER_NOTFOUND_MODULE', null),
444 4
                    'controller' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
445 4
                    'task' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
446 4
                    'action' => Env::get('ROUTER_NOTFOUND_ACTION', 'notFound'),
447
                ],
448
                'fatal' => [
449 4
                    'namespace' => Env::get('ROUTER_FATAL_NAMESPACE', null),
450 4
                    'module' => Env::get('ROUTER_FATAL_MODULE', null),
451 4
                    'controller' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
452 4
                    'task' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
453 4
                    'action' => Env::get('ROUTER_FATAL_ACTION', 'fatal'),
454
                ],
455
                'forbidden' => [
456 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
457 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
458 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
459 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
460 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'forbidden'),
461
                ],
462
                'unauthorized' => [
463 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
464 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
465 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
466 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
467 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'unauthorized'),
468
                ],
469
                'maintenance' => [
470 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
471 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
472 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
473 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
474 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'maintenance'),
475
                ],
476
                'error' => [
477 4
                    'namespace' => Env::get('ROUTER_ERROR_NAMESPACE', null),
478 4
                    'module' => Env::get('ROUTER_ERROR_MODULE', null),
479 4
                    'controller' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
480 4
                    'task' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
481 4
                    'action' => Env::get('ROUTER_ERROR_ACTION', 'index'),
482
                ],
483
            ],
484
            
485
            /**
486
             * Gravatar Configuration
487
             */
488
            'gravatar' => [
489 4
                'default_image' => Env::get('GRAVATAR_DEFAULT_IMAGE', 'identicon'),
490 4
                'size' => Env::get('GRAVATAR_SIZE', 24),
491 4
                'rating' => Env::get('GRAVATAR_RATING', 'pg'),
492 4
                'use_https' => Env::get('GRAVATAR_HTPPS', true),
493
            ],
494
            
495
            /**
496
             * reCaptcha Configuration
497
             */
498
            'reCaptcha' => [
499 4
                'siteKey' => Env::get('RECAPTCHA_KEY'),
500 4
                'secret' => Env::get('RECAPTCHA_SECRET'),
501
            ],
502
            
503
            /**
504
             * Locale Service Settings
505
             */
506
            'locale' => [
507 4
                'default' => Env::get('LOCALE_DEFAULT', 'en'),
508 4
                'sessionKey' => Env::get('LOCALE_SESSION_KEY', 'zemit-locale'),
509 4
                'mode' => Env::get('LOCALE_MODE', Locale::MODE_SESSION_GEOIP),
510 4
                'allowed' => explode(',', Env::get('LOCALE_ALLOWED', 'en')),
511
            ],
512
            
513
            /**
514
             * Translate Service Settings
515
             */
516
            'translate' => [
517 4
                'locale' => Env::get('TRANSLATE_LOCALE', 'en_US.utf8'),
518 4
                'defaultDomain' => Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages'),
519 4
                'category' => Env::get('TRANSLATE_CATEGORY', LC_MESSAGES),
520
                'directory' => [
521 4
                    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 4
                'driver' => Env::get('SESSION_DRIVER', 'stream'),
530
                'drivers' => [
531
                    'stream' => [
532 4
                        'adapter' => Env::get('SESSION_STREAM_ADAPTER', \Phalcon\Session\Adapter\Stream::class),
533 4
                        'savePath' => Env::get('SESSION_STREAM_SAVE_PATH', '/tmp')
534
                    ],
535
                    'memcached' => [
536 4
                        'adapter' => Env::get('SESSION_MEMCACHED_ADAPTER', \Phalcon\Session\Adapter\Libmemcached::class),
537
                        'servers' => [
538
                            [
539 4
                                'host' => Env::get('SESSION_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
540 4
                                'port' => Env::get('SESSION_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
541 4
                                '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 4
                        'adapter' => Env::get('SESSION_REDIS_ADAPTER', \Phalcon\Session\Adapter\Redis::class),
549 4
                        'host' => Env::get('SESSION_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
550 4
                        'port' => Env::get('SESSION_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
551 4
                        'index' => Env::get('SESSION_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
552 4
                        'auth' => Env::get('SESSION_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
553 4
                        'persistent' => Env::get('SESSION_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', 0)),
554 4
                        'socket' => Env::get('SESSION_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
555
                    ],
556
                    'noop' => [
557 4
                        'adapter' => Env::get('SESSION_NOOP_ADAPTER', \Phalcon\Session\Adapter\Noop::class),
558
                    ],
559
                ],
560
                'default' => [
561 4
                    'prefix' => Env::get('SESSION_PREFIX', 'zemit_session_'),
562 4
                    'uniqueId' => Env::get('SESSION_UNIQUE_ID', 'zemit_'),
563 4
                    'lifetime' => Env::get('SESSION_LIFETIME', 3600),
564
                ],
565
            ],
566
            
567
            /**
568
             * Default module/plugin structure
569
             */
570
            'module' => [
571
                'dir' => [
572
                    // default
573 4
                    'modules' => Env::get('MODULE_DIR_MODULES', 'Modules/'),
574 4
                    'controllers' => Env::get('MODULE_DIR_CONTROLLER', 'Controllers/'),
575 4
                    'tasks' => Env::get('MODULE_DIR_TASKS', 'Tasks/'),
576 4
                    'models' => Env::get('MODULE_DIR_MODELS', 'Models/'),
577 4
                    'views' => Env::get('MODULE_DIR_VIEWS', 'Views/'),
578 4
                    'bootstrap' => Env::get('MODULE_DIR_BOOTSTRAP', 'Bootstrap/'),
579 4
                    'locales' => Env::get('MODULE_DIR_LOCALES', 'Locales/'),
580 4
                    'config' => Env::get('MODULE_DIR_CONFIG', 'Config/'),
581
                    
582
                    // private
583 4
                    'migrations' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
584 4
                    'cache' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
585 4
                    'logs' => Env::get('MODULE_DIR_LOGS', 'Private/migrations/'),
586 4
                    'backups' => Env::get('MODULE_DIR_BACKUPS', 'Private/backups/'),
587 4
                    'files' => Env::get('MODULE_DIR_FILES', 'Private/files/'),
588 4
                    'trash' => Env::get('MODULE_DIR_TRASH', 'Private/trash/'),
589
                ],
590
            ],
591
            
592
            /**
593
             * Default security settings
594
             */
595
            'security' => [ // phalcon security config
596 4
                'workfactor' => Env::get('SECURITY_WORKFACTOR', 12), // workfactor for the phalcon security service
597 4
                'salt' => Env::get('SECURITY_SALT', 'ZEMIT_CORE_DEFAULT_SALT') // salt for the phalcon security service
598
            ],
599
            
600
            /**
601
             * Cache drivers configs
602
             */
603
            'cache' => [
604 4
                'driver' => Env::get('CACHE_DRIVER', 'memory'),
605
                'drivers' => [
606
                    'memory' => [
607 4
                        'adapter' => Env::get('CACHE_MEMORY_ADAPTER', \Phalcon\Cache\Adapter\Memory::class),
608
                    ],
609
                    'apcu' => [
610 4
                        'adapter' => Env::get('CACHE_APCU_ADAPTER', \Phalcon\Cache\Adapter\Apcu::class),
611
                    ],
612
                    'stream' => [
613 4
                        'adapter' => Env::get('CACHE_STREAM_ADAPTER', \Phalcon\Cache\Adapter\Stream::class),
614 4
                        'cacheDir' => Env::get('CACHE_STREAM_DIR', PRIVATE_PATH . '/cache/data/'),
615
                    ],
616
                    'memcached' => [
617 4
                        'adapter' => Env::get('CACHE_MEMCACHED_ADAPTER', \Phalcon\Cache\Adapter\Libmemcached::class),
618
                        'servers' => [
619
                            [
620 4
                                'host' => Env::get('CACHE_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
621 4
                                'port' => Env::get('CACHE_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
622 4
                                'weight' => Env::get('CACHE_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
623
                            ],
624
                        ],
625
                    ],
626
                    'redis' => [
627 4
                        'adapter' => Env::get('CACHE_REDIS_ADAPTER', \Phalcon\Cache\Adapter\Redis::class),
628 4
                        'host' => Env::get('CACHE_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
629 4
                        'port' => Env::get('CACHE_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
630 4
                        'index' => Env::get('CACHE_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
631 4
                        'auth' => Env::get('CACHE_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
632 4
                        'persistent' => Env::get('CACHE_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', null)),
633 4
                        'socket' => Env::get('CACHE_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
634
                    ],
635
                ],
636
                'default' => [
637 4
                    'prefix' => Env::get('CACHE_PREFIX', 'zemit_cache_'),
638 4
                    'lifetime' => Env::get('CACHE_LIFETIME', 86400),
639 4
                    'defaultSerializer' => Env::get('CACHE_DEFAULT_SERIALIZER', 'Php'),
640
                ],
641
            ],
642
            
643
            /**
644
             * Metadata Configuration
645
             */
646
            'metadata' => [
647 4
                'driver' => Env::get('METADATA_DRIVER', 'memory'),
648
                'drivers' => [
649
                    'apcu' => [
650 4
                        'adapter' => Env::get('METADATA_APCU_ADAPTER', \Phalcon\Mvc\Model\MetaData\Apcu::class),
651
                    ],
652
                    'memory' => [
653 4
                        'adapter' => Env::get('METADATA_MEMORY_ADAPTER', \Phalcon\Mvc\Model\MetaData\Memory::class),
654
                    ],
655
                    'stream' => [
656 4
                        'adapter' => Env::get('METADATA_STREAM_ADAPTER', \Phalcon\Mvc\Model\MetaData\Stream::class),
657 4
                        'metaDataDir' => Env::get('METADATA_STREAM_DIR', PRIVATE_PATH . '/cache/metadata/'),
658
                    ],
659
                    'memcached' => [
660 4
                        'adapter' => Env::get('METADATA_MEMCACHED_ADAPTER', \Phalcon\Mvc\Model\MetaData\Libmemcached::class),
661
                        'servers' => [
662
                            [
663 4
                                'host' => Env::get('METADATA_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
664 4
                                'port' => Env::get('METADATA_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
665 4
                                'weight' => Env::get('METADATA_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
666
                            ],
667
                        ],
668
                    ],
669
                    'redis' => [
670 4
                        'adapter' => Env::get('METADATA_REDIS_ADAPTER', \Phalcon\Mvc\Model\MetaData\Redis::class),
671 4
                        'host' => Env::get('METADATA_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
672 4
                        'port' => Env::get('METADATA_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
673 4
                        'index' => Env::get('METADATA_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
674 4
                        'auth' => Env::get('METADATA_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
675 4
                        'persistent' => Env::get('METADATA_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', null)),
676 4
                        'socket' => Env::get('METADATA_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
677
                    ],
678
                    'wincache' => [
679 4
                        'adapter' => Env::get('METADATA_WINCACHE_ADAPTER', \Phalcon\Mvc\Model\MetaData\Wincache::class),
680
                    ],
681
                ],
682
                'default' => [
683 4
                    'lifetime' => Env::get('METADATA_LIFETIME', 172800),
684 4
                    'prefix' => Env::get('METADATA_PREFIX', 'zemit_metadata_'),
685
                ],
686
            ],
687
            
688
            /**
689
             * Annotations Configuration
690
             * - Memory
691
             * - Apcu
692
             * - Stream
693
             * - Memcached
694
             * - Redis
695
             * - Aerospike
696
             */
697
            'annotations' => [
698 4
                'default' => Env::get('ANNOTATIONS_DRIVER', 'memory'),
699
                'drivers' => [
700
                    'memory' => [
701 4
                        'adapter' => Env::get('ANNOTATIONS_MEMORY_ADAPTER', \Phalcon\Annotations\Adapter\Memory::class),
702
                    ],
703
                    'apcu' => [
704 4
                        'adapter' => Env::get('ANNOTATIONS_APCU_ADAPTER', \Phalcon\Annotations\Adapter\Apcu::class),
705
                    ],
706
                    'file' => [
707 4
                        'adapter' => Env::get('ANNOTATIONS_STREAM_ADAPTER', \Phalcon\Annotations\Adapter\Stream::class),
708 4
                        'annotationsDir' => Env::get('ANNOTATIONS_STREAM_DIR', PRIVATE_PATH . '/cache/annotations'),
709
                    ],
710
                    'memcached' => [
711 4
                        'adapter' => Env::get('ANNOTATIONS_MEMCACHED_ADAPTER', \Phalcon\Annotations\Adapter\Memcached::class),
712
                        'servers' => [
713
                            [
714 4
                                'host' => Env::get('ANNOTATIONS_MEMCACHED_HOST', Env::get('MEMCACHED_HOST', '127.0.0.1')),
715 4
                                'port' => Env::get('ANNOTATIONS_MEMCACHED_PORT', Env::get('MEMCACHED_PORT', 11211)),
716 4
                                'weight' => Env::get('ANNOTATIONS_MEMCACHED_WEIGHT', Env::get('MEMCACHED_WEIGHT', 100)),
717
                            ],
718
                        ],
719
                    ],
720
                    'redis' => [
721 4
                        'adapter' => Env::get('ANNOTATIONS_REDIS_ADAPTER', \Phalcon\Annotations\Adapter\Redis::class),
722 4
                        'host' => Env::get('ANNOTATIONS_REDIS_HOST', Env::get('REDIS_HOST', '127.0.0.1')),
723 4
                        'port' => Env::get('ANNOTATIONS_REDIS_PORT', Env::get('REDIS_PORT', 6379)),
724 4
                        'index' => Env::get('ANNOTATIONS_REDIS_INDEX', Env::get('REDIS_INDEX', 0)),
725 4
                        'auth' => Env::get('ANNOTATIONS_REDIS_AUTH', Env::get('REDIS_AUTH', null)),
726 4
                        'persistent' => Env::get('ANNOTATIONS_REDIS_PERSISTENT', Env::get('REDIS_PERSISTENT', null)),
727 4
                        'socket' => Env::get('ANNOTATIONS_REDIS_SOCKET', Env::get('REDIS_SOCKET', null)),
728
                    ],
729
                    'aerospike' => [
730 4
                        'adapter' => Env::get('ANNOTATIONS_AEROSPIKE_ADAPTER', \Phalcon\Annotations\Adapter\Aerospike::class),
731
                    ],
732
                ],
733 4
                'prefix' => Env::get('ANNOTATIONS_PREFIX', 'zemit_annotations_'),
734 4
                'lifetime' => Env::get('ANNOTATIONS_LIFETIME', 86400),
735
            ],
736
            
737
            /**
738
             * Database configuration
739
             */
740
            'database' => [
741 4
                'default' => Env::get('DATABASE_ADAPTER', 'mysql'),
742
                'drivers' => [
743
                    'mysql' => [
744
                        'adapter' => 'Mysql',
745 4
                        'host' => Env::get('DATABASE_HOST', 'localhost'),
746 4
                        'port' => Env::get('DATABASE_PORT', 3306),
747 4
                        'dbname' => Env::get('DATABASE_DBNAME', ''),
748 4
                        'username' => Env::get('DATABASE_USERNAME', 'root'),
749 4
                        'password' => Env::get('DATABASE_PASSWORD', ''),
750 4
                        'charset' => Env::get('DATABASE_CHARSET', 'utf8'),
751
                        'options' => [
752 4
                            \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . Env::get('DATABASE_CHARSET', 'utf8'),
753 4
                            \PDO::ATTR_EMULATE_PREPARES => Env::get('DATABASE_PDO_EMULATE_PREPARES', false), // https://stackoverflow.com/questions/10113562/pdo-mysql-use-pdoattr-emulate-prepares-or-not
754 4
                            \PDO::ATTR_STRINGIFY_FETCHES => Env::get('DATABASE_PDO_STRINGIFY_FETCHES', false),
755 4
                            \PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => Env::get('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
756
                        ],
757
                        /**
758
                         * ReadOnly Configuration
759
                         */
760
                        'readOnly' => [
761 4
                            'enable' => Env::get('DATABASE_READONLY_ENABLE', false),
762 4
                            'host' => Env::get('DATABASE_READONLY_HOST'),
763 4
                            'port' => Env::get('DATABASE_READONLY_PORT'),
764 4
                            'dbname' => Env::get('DATABASE_READONLY_DBNAME'),
765 4
                            'username' => Env::get('DATABASE_READONLY_USERNAME'),
766 4
                            'password' => Env::get('DATABASE_READONLY_PASSWORD'),
767 4
                            'charset' => Env::get('DATABASE_READONLY_CHARSET'),
768
                        ],
769
                    ],
770
                ],
771
            ],
772
            
773
            /**
774
             * Mailer configuration
775
             */
776
            'mailer' => [
777 4
                'driver' => Env::get('MAILER_DRIVER', 'sendmail'),
778
                'drivers' => [
779
                    'mail' => [
780
                        'driver' => 'mail',
781
                    ],
782
                    'sendmail' => [
783 4
                        'driver' => 'sendmail',
784 4
                        'sendmail' => Env::get('MAILER_SENDMAIL', '/usr/sbin/sendmail -bs'),
785
                    ],
786
                    'smtp' => [
787 4
                        'driver' => 'smtp',
788 4
                        'host' => Env::get('MAILER_SMTP_HOST', 'localhost'),
789 4
                        'port' => Env::get('MAILER_SMTP_PORT', 25),
790 4
                        'encryption' => Env::get('MAILER_SMTP_ENCRYPTION', ''),
791 4
                        'username' => Env::get('MAILER_SMTP_USERNAME', ''),
792 4
                        'password' => Env::get('MAILER_SMTP_PASSWORD', ''),
793
                    ],
794
                ],
795
                'default' => [
796 4
                    'charset' => Env::get('MAILER_CHARSET', 'utf-8'),
797 4
                    'viewsDir' => Env::get('MAILER_VIEWS_DIR', APP_PATH . '/Modules/Frontend/Views/'),
798 4
                    'baseUri' => Env::get('MAILER_BASE_URI', null),
799
                ],
800
                'from' => [
801 4
                    'email' => Env::get('MAILER_FROM_EMAIL', 'zemit@localhost'),
802 4
                    'name' => Env::get('MAILER_FROM_NAME', 'Zemit'),
803
                ],
804 4
                'to' => [...explode(',', Env::get('MAILER_TO_EMAIL', ''))],
805 4
                'cc' => [...explode(',', Env::get('MAILER_CC_EMAIL', ''))],
806 4
                'bcc' => [...explode(',', Env::get('MAILER_BCC_EMAIL', ''))],
807
            ],
808
            
809
            /**
810
             * Cookies
811
             */
812
            'cookies' => [
813 4
                'useEncryption' => Env::get('COOKIES_USE_ENCRYPTION', true),
814 4
                'signKey' => Env::get('COOKIES_SIGN_KEY', ''),
815
            ],
816
            
817
            /**
818
             * Oauth2
819
             */
820
            'oauth2' => [
821
                'client' => [
822 4
                    'clientId' => Env::get('OAUTH2_CLIENT_ID'),
823 4
                    'clientSecret' => Env::get('OAUTH2_CLIENT_SECRET'),
824 4
                    'redirectUri' => Env::get('OAUTH2_CLIENT_REDIRECT_URI', '/oauth2/client/redirect'),
825 4
                    'urlAuthorize' => Env::get('OAUTH2_CLIENT_URL_AUTHORIZE', '/oauth2/client/authorize'),
826 4
                    'urlAccessToken' => Env::get('OAUTH2_CLIENT_URL_ACCESS_TOKEN', '/oauth2/client/token'),
827 4
                    'urlResourceOwnerDetails' => Env::get('OAUTH2_CLIENT_URL_RESOURCE', '/oauth2/client/resource'),
828 4
                    'proxy' => Env::get('OAUTH2_CLIENT_PROXY', null),
829 4
                    'verify' => Env::get('OAUTH2_CLIENT_VERIFY', true),
830
                ],
831
                'facebook' => [
832 4
                    'clientId' => Env::get('OAUTH2_FACEBOOK_CLIENT_ID'),
833 4
                    'clientSecret' => Env::get('OAUTH2_FACEBOOK_CLIENT_SECRET'),
834 4
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/facebook/callback'),
835 4
                    'graphApiVersion' => Env::get('OAUTH2_FACEBOOK_GRAPH_API_VERSION', 'v2.10'),
836
                ],
837
                'google' => [
838 4
                    'clientId' => Env::get('OAUTH2_GOOGLE_CLIENT_ID'),
839 4
                    'clientSecret' => Env::get('OAUTH2_GOOGLE_CLIENT_SECRET'),
840 4
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/google/callback'),
841 4
                    '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
842
                ],
843
                'instagram' => [
844
                
845
                ],
846
                'linked' => [
847
                
848
                ],
849
                'twitter' => [
850
                
851
                ],
852
                'github' => [
853
                
854
                ],
855
                'apple' => [
856
                
857
                ],
858
            ],
859
            
860
            /**
861
             * Dotenv
862
             */
863
            'dotenv' => [
864
                'filePath' => '',
865
            ],
866
            
867
            /**
868
             * Client config to pass to front-end
869
             */
870
            'client' => [],
871
            
872
            /**
873
             * Application permissions
874
             */
875
            'permissions' => [
876
                'features' => [
877
                    // This feature allow to administer users
878
                    'user' => [
879
                        'behaviors' => [
880
                        ],
881
                        'components' => [
882
                        ]
883
                    ],
884
                ],
885
                'roles' => [
886
                    // Everyone
887
                    'everyone' => [
888
                        'behaviors' => [
889
                        
890
                        ],
891
                        'features' => [
892
                            'user',
893
                        ],
894
                        'components' => [
895
                        
896
                        ],
897
                        'controllers' => [
898
                            IndexController::class => ['*'],
899
                            ErrorController::class => ['*'],
900
                            TestController::class => ['*'],
901
                            UserController::class => ['*'],
902
                            FacebookController::class => ['*'],
903
                            GoogleController::class => ['*'],
904
                        ],
905
                        'tasks' => [
906
                            CronTask::class => ['*'],
907
                            CacheTask::class => ['*'],
908
                            ErrorTask::class => ['*'],
909
                            ScaffoldTask::class => ['*'],
910
                            HelpTask::class => ['*'],
911
                            BuildTask::class => ['*'],
912
                        ],
913
                        'models' => [
914
                        
915
                        ],
916
                        'views' => [
917
                        
918
                        ],
919
                    ],
920
                    // Visitor Only
921
                    'visitor' => [
922
                    
923
                    ],
924
                    // Guest Only
925
                    'guest' => [
926
                    
927
                    ],
928
                    // User only
929
                    'user' => [
930
                    
931
                    ],
932
                    // Admin only
933
                    'admin' => [
934
                        'inherit' => [
935
                        ],
936
                        'behaviors' => [
937
                        ],
938
                    ],
939
                    // Dev only
940
                    'dev' => [
941
                        'inherit' => [
942
                            'admin'
943
                        ],
944
                    ],
945
                ]
946
            ],
947
        ]);
948 4
        if (!empty($config)) {
949
            $this->merge(new PhalconConfig($config));
950
        }
951
    }
952
    
953
    /**
954
     * Merge the specified environment config with this one
955
     * This should be used to overwrite specific values only
956
     *
957
     * @param null|string $env If null, will fetch the current environement from $this->app->env
958
     *
959
     * @return Config $this Return the merged current config
960
     */
961 4
    public function mergeEnvConfig($env = null)
962
    {
963 4
        $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...
964
        
965 4
        if (file_exists($configFile)) {
966
            $envConfig = require_once $configFile;
967
            if (!empty($envConfig)) {
968
                $envConfig = is_callable($envConfig) ? $envConfig() : $envConfig;
969
                if (is_array($envConfig)) {
970
                    $this->merge(new PhalconConfig($envConfig));
971
                }
972
            }
973
        }
974
        
975 4
        return $this;
976
    }
977
}
978
979
//if (php_sapi_name() === 'cli') {
980
//    $devtoolConfig = new Config();
981
//    return $devtoolConfig->mergeEnvConfig();
982
//}
983