Test Failed
Push — master ( 2f15b8...6e5f5c )
by Julien
04:42
created

Config::defineConst()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 12
ccs 9
cts 9
cp 1
rs 8.8333
cc 7
nc 64
nop 0
crap 7
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\CacheTask;
20
use Zemit\Modules\Cli\Tasks\CronTask;
21
use Zemit\Modules\Frontend\Controllers\ErrorController;
22
use Zemit\Modules\Frontend\Controllers\IndexController;
23
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...
24
use Zemit\Modules\Oauth2\Controllers\FacebookController;
25
use Zemit\Modules\Oauth2\Controllers\GoogleController;
26
use Zemit\Mvc\Controller\Behavior\Model\Create;
27
use Zemit\Mvc\Controller\Behavior\Model\Delete;
28
use Zemit\Mvc\Controller\Behavior\Model\Restore;
29
use Zemit\Mvc\Controller\Behavior\Model\Update;
30
use Zemit\Mvc\Controller\Behavior\Skip\SkipIdentityCondition;
31
use Zemit\Mvc\Controller\Behavior\Skip\SkipWhiteList;
32
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...
33
use Zemit\Utils\Env;
34
use Zemit\Version;
35
use Zemit\Provider;
36
use Phalcon\Config as PhalconConfig;
37
38
/**
39
 * Class Config
40
 * {@inheritDoc}
41
 *
42
 * @author Julien Turbide <[email protected]>
43
 * @copyright Zemit Team <[email protected]>
44
 *
45
 * @since 1.0
46
 * @version 1.0
47
 *
48
 * @package Zemit\Bootstrap
49
 */
50
class Config extends PhalconConfig
51
{
52 4
    public function defineConst()
53
    {
54
        // @todo remove this
55 4
        ini_set('error_reporting', E_ALL);
56 4
        ini_set('display_errors', 1);
57
        
58 4
        defined('VENDOR_PATH') || define('VENDOR_PATH', Env::get('ROOT_PATH', 'vendor/'));
59 4
        defined('ROOT_PATH') || define('ROOT_PATH', Env::get('ROOT_PATH', null));
60 4
        defined('APP_PATH') || define('APP_PATH', Env::get('APP_PATH', null));
61 4
        defined('APPLICATION_ENV') || define('APPLICATION_ENV', Env::get('APPLICATION_ENV', 'development'));
62 4
        defined('CORE_PATH') || define('CORE_PATH', Env::get('CORE_PATH', mb_substr(__DIR__, 0, mb_strlen(basename(__DIR__)) * -1)));
63 4
        defined('PRIVATE_PATH') || define('PRIVATE_PATH', Env::get('APP_PRIVATE_PATH', constant('APP_PATH') . '/private/'));
64 4
    }
65
    
66
    /**
67
     * Config constructor.
68
     * {@inheritDoc}
69
     *
70
     * @param array $config
71
     */
72 4
    public function __construct($config = [])
73
    {
74 4
        $this->defineConst();
75
        
76 4
        parent::__construct([
77
            
78
            /**
79
             * Core only settings
80
             */
81
            'core' => [
82 4
                'name' => 'Zemit Core',
83 4
                'version' => Version::get(),
84 4
                'package' => 'zemit-cms',
85
                'modules' => [
86 4
                    \Zemit\Mvc\Module::NAME_FRONTEND => [
87
                        'className' => \Zemit\Modules\Frontend\Module::class,
88 4
                        'path' => CORE_PATH . 'Modules/Frontend/Module.php',
89
                    ],
90 4
                    \Zemit\Mvc\Module::NAME_BACKEND => [
91
                        'className' => \Zemit\Modules\Backend\Module::class,
92 4
                        'path' => CORE_PATH . 'Modules/Backend/Module.php',
93
                    ],
94 4
                    \Zemit\Mvc\Module::NAME_API => [
95
                        'className' => \Zemit\Modules\Api\Module::class,
96 4
                        'path' => CORE_PATH . 'Modules/Api/Module.php',
97
                    ],
98 4
                    \Zemit\Mvc\Module::NAME_CLI => [
99
                        'className' => \Zemit\Modules\Cli\Module::class,
100 4
                        'path' => CORE_PATH . 'Modules/Cli/Module.php',
101
                    ],
102 4
                    \Zemit\Mvc\Module::NAME_OAUTH2 => [
103
                        'className' => \Zemit\Modules\Oauth2\Module::class,
104 4
                        'path' => CORE_PATH . 'Modules/Oauth2/Module.php',
105
                    ],
106
                ],
107
                'dir' => [
108 4
                    'base' => CORE_PATH,
109 4
                    'locales' => CORE_PATH . 'Locales',
110 4
                    'modules' => CORE_PATH . 'Modules',
111
                ],
112
            ],
113
            
114
            /**
115
             * Application configuration
116
             */
117
            'app' => [
118 4
                'namespace' => Env::get('APP_NAMESPACE', 'Zemit'), // Namespace of your application
119 4
                'version' => Env::get('APP_VERSION', date('Ymd')), // allow to set and force a specific version
120 4
                'maintenance' => Env::get('APP_MAINTENANCE', false), // Set true to force the maintenance page
121 4
                'env' => Env::get('APP_ENV', Env::get('APPLICATION_ENV', null)), // Set the current environnement
122 4
                'debug' => Env::get('APP_DEBUG', false), // Set true to display debug
123 4
                'cache' => Env::get('APP_CACHE', false), // Set true to activate the cache
124 4
                'minify' => Env::get('APP_MINIFY', false), // Set true to activate minifying
125 4
                'copyright' => Env::get('APP_COPYRIGHT', false), // Set true to activate the cache
126 4
                'profiler' => Env::get('APP_PROFILER', false), // Set true to return the profiler
127 4
                'logger' => Env::get('APP_LOGGER', false), // Set true to enable logging
128 4
                'uri' => Env::get('APP_URI', '/'), // Base URI of your application
129 4
                'staticUri' => Env::get('APP_STATIC_URI', '/'), // Base URI of your application
130 4
                'encoding' => Env::get('APP_ENCODING', 'UTF-8'), // allow to set encoding to use with the application
131 4
                'timezone' => Env::get('APP_TIMEZONE', 'America/Montreal'), // allow to set timezone to use with the application
132 4
                'timeoutLimit' => Env::get('APP_TIMEOUT_LIMIT', 60), // allow to set timeout limit to use with the application
133 4
                'memoryLimit' => Env::get('APP_MEMORY_LIMIT', '256M'), // allow to set timeout limit to use with the application
134 4
                'postLimit' => Env::get('APP_POST_LIMIT', '20M'), // allow to set timeout limit to use with the application
135 4
                'sendEmail' => Env::get('APP_SEND_EMAIL', false), // allow to send real email or not
136
                
137
                'dir' => [
138
                    // project
139 4
                    'root' => Env::get('APP_ROOT_PATH', defined('ROOT_PATH') ? ROOT_PATH ?: getcwd() : getcwd()),
140 4
                    'vendor' => Env::get('APP_VENDOR_PATH', VENDOR_PATH),
141 4
                    'app' => Env::get('APP_PATH', APP_PATH . '/'),
142 4
                    'public' => Env::get('APP_PUBLIC_PATH', getcwd()),
143
                    
144
                    // app
145 4
                    'bootstrap' => Env::get('APP_BOOTSTRAP_PATH', APP_PATH . '/Bootstrap/'),
146 4
                    'common' => Env::get('APP_COMMON_PATH', APP_PATH . '/Common/'),
147 4
                    'config' => Env::get('APP_CONFIG_PATH', APP_PATH . '/Config/'),
148 4
                    'modules' => Env::get('APP_MODULES_PATH', APP_PATH . '/Modules/'),
149 4
                    'plugins' => Env::get('APP_PLUGINS_PATH', APP_PATH . '/Plugins/'),
150 4
                    'private' => PRIVATE_PATH,
151
                    
152
                    // private
153 4
                    'cache' => Env::get('APP_CACHE_PATH', PRIVATE_PATH . '/cache/'),
154 4
                    'log' => Env::get('APP_LOG_PATH', PRIVATE_PATH . '/log/'),
155 4
                    'files' => Env::get('APP_FILE_PATH', PRIVATE_PATH . '/files/'),
156 4
                    'trash' => Env::get('APP_TRASH_PATH', PRIVATE_PATH . '/trash/'),
157 4
                    'tmp' => Env::get('APP_TMP_PATH', PRIVATE_PATH . '/tmp/'),
158 4
                    'migrations' => Env::get('APP_MIGRATION_PATH', PRIVATE_PATH . '/migrations/'),
159
                ],
160
            ],
161
            
162
            /**
163
             * Debug Configuration
164
             */
165
            'debug' => [
166 4
                'enable' => Env::get('DEBUG_ENABLE', false),
167 4
                'exception' => Env::get('DEBUG_EXCEPTION', true),
168 4
                'lowSeverity' => Env::get('DEBUG_LOW_SEVERITY', true),
169 4
                'showFiles' => Env::get('DEBUG_SHOW_FILES', true),
170 4
                'showBackTrace' => Env::get('DEBUG_SHOW_BACKTRACE', true),
171 4
                'showFileFragment' => Env::get('DEBUG_SHOW_FRAGMENT', true),
172 4
                'uri' => Env::get('DEBUG_URI'),
173
                'blacklist' => [
174
                    'server' => [
175
                        'PASS',
176
                        'PASSWD',
177
                        'PASSWORD',
178
                        'TOKEN',
179
                        'HASH',
180
                        'DB_PASS',
181
                        'DB_PASSWD',
182
                        'DB_PASSWORD',
183
                        'DATABASE_PASS',
184
                        'DATABASE_PASSWD',
185
                        'DATABASE_PASSWORD',
186
                        'SECURITY_WORKFACTOR',
187
                        'SECURITY_SALT',
188
                        'PASSPHRASE',
189
                        'SECRET',
190
                        'API_SECRET',
191
                        'API_KEY',
192
                    ],
193
                ],
194
            ],
195
            
196
            /**
197
             * Identity Provider Configuration
198
             */
199
            'identity' => [
200 4
                'userClass' => Env::get('IDENTITY_USER_CLASS', \Zemit\Models\User::class),
201 4
                'emailClass' => Env::get('IDENTITY_EMAIL_CLASS', \Zemit\Models\Email::class),
202 4
                'sessionClass' => Env::get('IDENTITY_SESSION_CLASS', \Zemit\Models\Session::class),
203 4
                'sessionKey' => Env::get('IDENTITY_SESSION_KEY', 'zemit-identity'),
204
            ],
205
            
206
            /**
207
             *
208
             */
209
            'models' => [
210
                
211
                // System
212
                \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...
213
                \Zemit\Models\Audit::class => \Zemit\Models\Audit::class,
214
                \Zemit\Models\AuditDetail::class => \Zemit\Models\AuditDetail::class,
215
                \Zemit\Models\Log::class => \Zemit\Models\Log::class,
216
                \Zemit\Models\Email::class => \Zemit\Models\Email::class,
217
                \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...
218
                \Zemit\Models\File::class => \Zemit\Models\File::class,
219
                \Zemit\Models\Session::class => \Zemit\Models\Session::class,
220
                
221
                # system misc
222
                \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...
223
                \Zemit\Models\Translation::class => \Zemit\Models\Translation::class,
224
                \Zemit\Models\Setting::class => \Zemit\Models\Setting::class,
225
                \Zemit\Models\Template::class => \Zemit\Models\Template::class,
226
                
227
                // Workspace
228
                \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...
229
                \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...
230
                \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...
231
                
232
                // Project
233
                \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...
234
                \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...
235
                \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...
236
                \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...
237
                \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...
238
                
239
                // User
240
                \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...
241
                \Zemit\Models\User::class => \Zemit\Models\User::class,
242
                \Zemit\Models\UserType::class => \Zemit\Models\UserType::class,
243
                \Zemit\Models\UserGroup::class => \Zemit\Models\UserGroup::class,
244
                \Zemit\Models\UserRole::class => \Zemit\Models\UserRole::class,
245
                \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...
246
                
247
                // Role
248
                \Zemit\Models\Role::class => \Zemit\Models\Role::class,
249
                \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...
250
                \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...
251
                
252
                // Group
253
                \Zemit\Models\Group::class => \Zemit\Models\Group::class,
254
                \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...
255
                \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...
256
                \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...
257
                
258
                // Type
259
                \Zemit\Models\Type::class => \Zemit\Models\Type::class,
260
                
261
                // Feature
262
                \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...
263
                
264
                // Zemit
265
                \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...
266
                \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...
267
                \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...
268
                \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...
269
            ],
270
            
271
            /**
272
             * Service Provider Configuration
273
             */
274
            'providers' => [
275
                // abstract => concrete
276
                Provider\Environment\ServiceProvider::class => Provider\Environment\ServiceProvider::class,
277
                Provider\Security\ServiceProvider::class => Provider\Security\ServiceProvider::class,
278
                Provider\Session\ServiceProvider::class => Provider\Session\ServiceProvider::class,
279
                Provider\Cookies\ServiceProvider::class => Provider\Cookies\ServiceProvider::class,
280
                
281
                Provider\Locale\ServiceProvider::class => Provider\Locale\ServiceProvider::class,
282
                Provider\Translate\ServiceProvider::class => Provider\Translate\ServiceProvider::class,
283
                Provider\Url\ServiceProvider::class => Provider\Url\ServiceProvider::class,
284
                Provider\Request\ServiceProvider::class => Provider\Request\ServiceProvider::class,
285
                Provider\Router\ServiceProvider::class => Provider\Router\ServiceProvider::class,
286
                Provider\Dispatcher\ServiceProvider::class => Provider\Dispatcher\ServiceProvider::class,
287
                Provider\VoltTemplate\ServiceProvider::class => Provider\VoltTemplate\ServiceProvider::class,
288
                Provider\View\ServiceProvider::class => Provider\View\ServiceProvider::class,
289
                
290
                Provider\Profiler\ServiceProvider::class => Provider\Profiler\ServiceProvider::class,
291
                Provider\Database\ServiceProvider::class => Provider\Database\ServiceProvider::class,
292
                Provider\DatabaseReadOnly\ServiceProvider::class => Provider\DatabaseReadOnly\ServiceProvider::class,
293
                Provider\Annotations\ServiceProvider::class => Provider\Annotations\ServiceProvider::class,
294
                Provider\ModelsManager\ServiceProvider::class => Provider\ModelsManager\ServiceProvider::class,
295
                Provider\ModelsMetadata\ServiceProvider::class => Provider\ModelsMetadata\ServiceProvider::class,
296
                Provider\ModelsCache\ServiceProvider::class => Provider\ModelsCache\ServiceProvider::class,
297
                Provider\Mailer\ServiceProvider::class => Provider\Mailer\ServiceProvider::class,
298
                Provider\Logger\ServiceProvider::class => Provider\Logger\ServiceProvider::class,
299
                Provider\FileSystem\ServiceProvider::class => Provider\FileSystem\ServiceProvider::class,
300
                
301
                Provider\Assets\ServiceProvider::class => Provider\Assets\ServiceProvider::class,
302
                Provider\Tag\ServiceProvider::class => Provider\Tag\ServiceProvider::class,
303
                Provider\Filter\ServiceProvider::class => Provider\Filter\ServiceProvider::class,
304
                Provider\Flash\ServiceProvider::class => Provider\Flash\ServiceProvider::class,
305
                Provider\Escaper\ServiceProvider::class => Provider\Escaper\ServiceProvider::class,
306
                Provider\Markdown\ServiceProvider::class => Provider\Markdown\ServiceProvider::class,
307
                Provider\Utils\ServiceProvider::class => Provider\Utils\ServiceProvider::class,
308
                
309
                // oauth2
310
                Provider\Identity\ServiceProvider::class => Provider\Identity\ServiceProvider::class,
311
                Provider\Oauth2Facebook\ServiceProvider::class => Provider\Oauth2Facebook\ServiceProvider::class,
312
                Provider\Oauth2Google\ServiceProvider::class => Provider\Oauth2Google\ServiceProvider::class,
313
                
314
                // lib
315
                Provider\OCR\ServiceProvider::class => Provider\OCR\ServiceProvider::class,
316
                Provider\Jwt\ServiceProvider::class => Provider\Jwt\ServiceProvider::class,
317
                Provider\V8js\ServiceProvider::class => Provider\V8js\ServiceProvider::class,
318
                Provider\Captcha\ServiceProvider::class => Provider\Captcha\ServiceProvider::class,
319
                Provider\Gravatar\ServiceProvider::class => Provider\Gravatar\ServiceProvider::class,
320
                Provider\Clamav\ServiceProvider::class => Provider\Clamav\ServiceProvider::class,
321
//                Snowair\Debugbar\ServiceProvider::class => \Snowair\Debugbar\ServiceProvider::class,
322
            ],
323
            
324
            /**
325
             * Logger Configuration
326
             */
327
            'logger' => [
328 4
                'enable' => Env::get('LOGGER_ENABLE', false),
329
                
330 4
                'error' => Env::get('LOGGER_ERROR', false),
331 4
                'database' => Env::get('LOGGER_DATABASE', false),
332 4
                'dispatcher' => Env::get('LOGGER_DISPATCHER', false),
333 4
                'profiler' => Env::get('LOGGER_PROFILER', false),
334 4
                'mailer' => Env::get('LOGGER_MAILER', false),
335 4
                'cron' => Env::get('LOGGER_CRON', false),
336 4
                'auth' => Env::get('LOGGER_AUTH', false),
337
                
338 4
                'driver' => explode(',', Env::get('LOGGER_DRIVER', 'noop')),
339
                'drivers' => [
340
                    'noop' => [
341
                        'adapter' => \Phalcon\Logger\Adapter\Noop::class,
342
                    ],
343
                    'stream' => [
344
                        'adapter' => \Phalcon\Logger\Adapter\Stream::class,
345
                    ],
346
                    'syslog' => [
347
                        'adapter' => \Phalcon\Logger\Adapter\Syslog::class,
348
                    ],
349
                ],
350
                'default' => [
351 4
                    'path' => Env::get('LOGGER_PATH', PRIVATE_PATH . '/log/'),
352 4
                    'format' => Env::get('LOGGER_FORMAT', '[%date%][%type%] %message%'),
353 4
                    'date' => Env::get('LOGGER_DATE', 'Y-m-d H:i:s'),
354 4
                    'filename' => Env::get('LOGGER_DEFAULT_FILENAME', 'zemit'),
355
                ],
356
            ],
357
            
358
            /**
359
             * Default filters
360
             */
361
            'filters' => [
362 4
                Filter::FILTER_MD5 => Filters\Md5::class,
363 4
                Filter::FILTER_JSON => Filters\Json::class,
364 4
                Filter::FILTER_IPV4 => Filters\IPv4::class,
365 4
                Filter::FILTER_IPV6 => Filters\IPv6::class,
366
            ],
367
            
368
            /**
369
             * Default modules
370
             * @todo change this to class => [class => '', path => '']
371
             */
372
            'modules' => [
373 4
                \Zemit\Mvc\Module::NAME_FRONTEND => [
374
                    'className' => \Zemit\Modules\Frontend\Module::class,
375 4
                    'path' => CORE_PATH . 'Modules/Frontend/Module.php',
376
                ],
377 4
                \Zemit\Mvc\Module::NAME_BACKEND => [
378
                    'className' => \Zemit\Modules\Backend\Module::class,
379 4
                    'path' => CORE_PATH . 'Modules/Backend/Module.php',
380
                ],
381 4
                \Zemit\Mvc\Module::NAME_API => [
382
                    'className' => \Zemit\Modules\Api\Module::class,
383 4
                    'path' => CORE_PATH . 'Modules/Api/Module.php',
384
                ],
385 4
                \Zemit\Mvc\Module::NAME_CLI => [
386
                    'className' => \Zemit\Modules\Cli\Module::class,
387 4
                    'path' => CORE_PATH . 'Modules/Cli/Module.php',
388
                ],
389 4
                \Zemit\Mvc\Module::NAME_OAUTH2 => [
390
                    'className' => \Zemit\Modules\Oauth2\Module::class,
391 4
                    'path' => CORE_PATH . 'Modules/Oauth2/Module.php',
392
                ],
393
                /**
394
                 * @TODO support this way too
395
                 */
396
//                \Zemit\Modules\Frontend\Module::class => \Zemit\Modules\Frontend\Module::class,
397
//                \Zemit\Modules\Backend\Module::class => \Zemit\Modules\Backend\Module::class,
398
//                \Zemit\Modules\Api\Module::class => \Zemit\Modules\Api\Module::class,
399
//                \Zemit\Modules\Cli\Module::class => \Zemit\Modules\Cli\Module::class,
400
            ],
401
            
402
            /**
403
             * Default router settings
404
             */
405
            'router' => [
406
                'defaults' => [
407 4
                    'namespace' => Env::get('ROUTER_DEFAULT_NAMESPACE', 'Zemit\\Modules\\Frontend\\Controllers'),
408 4
                    'module' => Env::get('ROUTER_DEFAULT_MODULE', 'frontend'),
409 4
                    'controller' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
410 4
                    'task' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
411 4
                    'action' => Env::get('ROUTER_DEFAULT_ACTION', 'index'),
412
                ],
413
                'notFound' => [
414 4
                    'namespace' => Env::get('ROUTER_NOTFOUND_NAMESPACE', null),
415 4
                    'module' => Env::get('ROUTER_NOTFOUND_MODULE', null),
416 4
                    'controller' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
417 4
                    'task' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
418 4
                    'action' => Env::get('ROUTER_NOTFOUND_ACTION', 'notFound'),
419
                ],
420
                'fatal' => [
421 4
                    'namespace' => Env::get('ROUTER_FATAL_NAMESPACE', null),
422 4
                    'module' => Env::get('ROUTER_FATAL_MODULE', null),
423 4
                    'controller' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
424 4
                    'task' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
425 4
                    'action' => Env::get('ROUTER_FATAL_ACTION', 'fatal'),
426
                ],
427
                'forbidden' => [
428 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
429 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
430 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
431 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
432 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'forbidden'),
433
                ],
434
                'unauthorized' => [
435 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
436 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
437 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
438 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
439 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'unauthorized'),
440
                ],
441
                'maintenance' => [
442 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
443 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
444 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
445 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
446 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'maintenance'),
447
                ],
448
                'error' => [
449 4
                    'namespace' => Env::get('ROUTER_ERROR_NAMESPACE', null),
450 4
                    'module' => Env::get('ROUTER_ERROR_MODULE', null),
451 4
                    'controller' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
452 4
                    'task' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
453 4
                    'action' => Env::get('ROUTER_ERROR_ACTION', 'index'),
454
                ],
455
            ],
456
            
457
            /**
458
             * Gravatar Configuration
459
             */
460
            'gravatar' => [
461 4
                'default_image' => Env::get('GRAVATAR_DEFAULT_IMAGE', 'identicon'),
462 4
                'size' => Env::get('GRAVATAR_SIZE', 24),
463 4
                'rating' => Env::get('GRAVATAR_RATING', 'pg'),
464 4
                'use_https' => Env::get('GRAVATAR_HTPPS', true),
465
            ],
466
            
467
            /**
468
             * reCaptcha Configuration
469
             */
470
            'reCaptcha' => [
471 4
                'siteKey' => Env::get('RECAPTCHA_KEY'),
472 4
                'secret' => Env::get('RECAPTCHA_SECRET'),
473
            ],
474
            
475
            /**
476
             * Locale Service Settings
477
             */
478
            'locale' => [
479 4
                'default' => Env::get('LOCALE_DEFAULT', 'en'),
480 4
                'sessionKey' => Env::get('LOCALE_SESSION_KEY', 'zemit-locale'),
481 4
                'mode' => Env::get('LOCALE_MODE', Locale::MODE_SESSION_GEOIP),
482 4
                'allowed' => explode(',', Env::get('LOCALE_ALLOWED', 'en')),
483
            ],
484
            
485
            /**
486
             * Translate Service Settings
487
             */
488
            'translate' => [
489 4
                'locale' => Env::get('TRANSLATE_LOCALE', 'en_US.utf8'),
490 4
                'defaultDomain' => Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages'),
491 4
                'category' => Env::get('TRANSLATE_CATEGORY', LC_MESSAGES),
492
                'directory' => [
493 4
                    Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages') => Env::get('TRANSLATE_DEFAULT_PATH', CORE_PATH . 'Locales'),
494
                ],
495
            ],
496
            
497
            /**
498
             * Default Session Configuration
499
             */
500
            'session' => [
501 4
                'driver' => Env::get('SESSION_DRIVER', 'stream'),
502
                'drivers' => [
503
                    'stream' => [
504
                        'adapter' => \Phalcon\Session\Adapter\Stream::class,
505 4
                        'savePath' => Env::get('SESSION_STREAM_SAVE_PATH', '/tmp')
506
                    ],
507
                    'memcached' => [
508
                        'adapter' => \Phalcon\Session\Adapter\Libmemcached::class,
509
                        'servers' => [
510
                            [
511 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
512 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
513 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
514
                            ],
515
                        ],
516
                        // Client options must be instance of array
517
                        'client' => [],
518
                    ],
519
                    'redis' => [
520
                        'adapter' => \Phalcon\Session\Adapter\Redis::class,
521 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
522 4
                        'port' => Env::get('REDIS_PORT', 6379),
523 4
                        'index' => Env::get('REDIS_INDEX', 0),
524 4
                        'auth' => Env::get('REDIS_AUTH', null),
525 4
                        'persistent' => Env::get('REDIS_PERSISTENT', 0),
526 4
                        'socket' => Env::get('REDIS_SOCKET', null),
527
                    ],
528
                    'noop' => [
529
                        'adapter' => \Phalcon\Session\Adapter\Noop::class,
530
                    ],
531
                    'file' => [
532
                        'adapter' => 'Files',
533
                    ],
534
                ],
535
                'default' => [
536 4
                    'prefix' => Env::get('SESSION_PREFIX', 'zemit_session_'),
537 4
                    'uniqueId' => Env::get('SESSION_UNIQUE_ID', 'zemit_'),
538 4
                    'lifetime' => Env::get('SESSION_LIFETIME', 3600),
539
                ],
540
            ],
541
            
542
            /**
543
             * Default module/plugin structure
544
             */
545
            'module' => [
546
                'dir' => [
547
                    // default
548 4
                    'modules' => Env::get('MODULE_DIR_MODULES', 'Modules/'),
549 4
                    'controllers' => Env::get('MODULE_DIR_CONTROLLER', 'Controllers/'),
550 4
                    'tasks' => Env::get('MODULE_DIR_TASKS', 'Tasks/'),
551 4
                    'models' => Env::get('MODULE_DIR_MODELS', 'Models/'),
552 4
                    'views' => Env::get('MODULE_DIR_VIEWS', 'Views/'),
553 4
                    'bootstrap' => Env::get('MODULE_DIR_BOOTSTRAP', 'Bootstrap/'),
554 4
                    'locales' => Env::get('MODULE_DIR_LOCALES', 'Locales/'),
555 4
                    'config' => Env::get('MODULE_DIR_CONFIG', 'Config/'),
556
                    
557
                    // private
558 4
                    'migrations' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
559 4
                    'cache' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
560 4
                    'logs' => Env::get('MODULE_DIR_LOGS', 'Private/migrations/'),
561 4
                    'backups' => Env::get('MODULE_DIR_BACKUPS', 'Private/backups/'),
562 4
                    'files' => Env::get('MODULE_DIR_FILES', 'Private/files/'),
563 4
                    'trash' => Env::get('MODULE_DIR_TRASH', 'Private/trash/'),
564
                ],
565
            ],
566
            
567
            /**
568
             * Default security settings
569
             */
570
            'security' => [ // phalcon security config
571 4
                'workfactor' => Env::get('SECURITY_WORKFACTOR', 12), // workfactor for the phalcon security service
572 4
                'salt' => Env::get('SECURITY_SALT', 'ZEMIT_CORE_DEFAULT_SALT') // salt for the phalcon security service
573
            ],
574
            
575
            /**
576
             * Cache drivers configs
577
             */
578
            'cache' => [
579 4
                'driver' => Env::get('CACHE_DRIVER', 'memory'),
580
                'drivers' => [
581
                    'memory' => [
582
                        'adapter' => \Phalcon\Cache\Adapter\Memory::class,
583
                    ],
584
                    'apcu' => [
585
                        'adapter' => \Phalcon\Cache\Adapter\Apcu::class,
586
                    ],
587
                    'file' => [
588
                        'adapter' => \Phalcon\Cache\Adapter\Stream::class,
589 4
                        'cacheDir' => PRIVATE_PATH . '/cache/data/',
590
                    ],
591
                    'memcached' => [
592
                        'adapter' => \Phalcon\Cache\Adapter\Libmemcached::class,
593
                        'servers' => [
594
                            [
595 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
596 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
597 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
598
                            ],
599
                        ],
600
                    ],
601
                    'redis' => [
602
                        'adapter' => \Phalcon\Cache\Adapter\Redis::class,
603 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
604 4
                        'port' => Env::get('REDIS_PORT', 6379),
605 4
                        'index' => Env::get('REDIS_INDEX', 0),
606 4
                        'auth' => Env::get('REDIS_AUTH', null),
607 4
                        'persistent' => Env::get('REDIS_PERSISTENT', null),
608 4
                        'socket' => Env::get('REDIS_SOCKET', null),
609
                    ],
610
                ],
611
                'default' => [
612 4
                    'prefix' => Env::get('CACHE_PREFIX', 'zemit_cache_'),
613 4
                    'lifetime' => Env::get('CACHE_LIFETIME', 86400),
614 4
                    'defaultSerializer' => Env::get('CACHE_DEFAULT_SERIALIZER', 'Php'),
615
                ],
616
            ],
617
            
618
            /**
619
             * Metadata Configuration
620
             */
621
            'metadata' => [
622 4
                'driver' => Env::get('METADATA_DRIVER', 'memory'),
623
                'drivers' => [
624
                    'apcu' => [
625
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Apcu::class,
626
                    ],
627
                    'memory' => [
628
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Memory::class,
629
                    ],
630
                    'memcached' => [
631
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Libmemcached::class,
632
                        'servers' => [
633
                            [
634 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
635 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
636 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
637
                            ],
638
                        ],
639
                    ],
640
                    'stream' => [
641
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Stream::class,
642 4
                        'metaDataDir' => PRIVATE_PATH . '/cache/metadata/',
643
                    ],
644
                    'redis' => [
645
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Redis::class,
646 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
647 4
                        'port' => Env::get('REDIS_PORT', 6379),
648 4
                        'index' => Env::get('REDIS_INDEX', 0),
649 4
                        'auth' => Env::get('REDIS_AUTH', null),
650 4
                        'persistent' => Env::get('REDIS_PERSISTENT', null),
651 4
                        'socket' => Env::get('REDIS_SOCKET', null),
652
                    ],
653
                    'wincache' => [
654
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Wincache::class,
655
                    ],
656
                ],
657
                'default' => [
658 4
                    'lifetime' => Env::get('METADATA_LIFETIME', 172800),
659 4
                    'prefix' => Env::get('METADATA_PREFIX', 'zemit_metadata_'),
660
                ],
661
            ],
662
            
663
            /**
664
             * Annotations Configuration
665
             * - Memory
666
             * - Apcu
667
             * - Stream
668
             * - Memcached
669
             * - Redis
670
             * - Aerospike
671
             */
672
            'annotations' => [
673 4
                'default' => Env::get('ANNOTATIONS_DRIVER', 'memory'),
674
                'drivers' => [
675
                    'memory' => [
676
                        'adapter' => \Phalcon\Annotations\Adapter\Memory::class,
677
                    ],
678
                    'apcu' => [
679
                        'adapter' => \Phalcon\Annotations\Adapter\Apcu::class,
680
                    ],
681
                    'file' => [
682
                        'adapter' => \Phalcon\Annotations\Adapter\Stream::class,
683 4
                        'annotationsDir' => PRIVATE_PATH . '/cache/annotations',
684
                    ],
685
                    'memcached' => [
686
                        'adapter' => \Phalcon\Annotations\Adapter\Memcached::class,
687
                        'servers' => [
688
                            [
689 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
690 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
691 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
692
                            ],
693
                        ],
694
                    ],
695
                    'redis' => [
696
                        'adapter' => \Phalcon\Annotations\Adapter\Redis::class,
697 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
698 4
                        'port' => Env::get('REDIS_PORT', 6379),
699 4
                        'index' => Env::get('REDIS_INDEX', 0),
700 4
                        'auth' => Env::get('REDIS_AUTH', null),
701 4
                        'persistent' => Env::get('REDIS_PERSISTENT', null),
702 4
                        'socket' => Env::get('REDIS_SOCKET', null),
703
                    ],
704
                    'aerospike' => [
705
                        'adapter' => \Phalcon\Annotations\Adapter\Aerospike::class,
706
                    ],
707
                ],
708 4
                'prefix' => Env::get('ANNOTATIONS_PREFIX', 'zemit_annotations_'),
709 4
                'lifetime' => Env::get('ANNOTATIONS_LIFETIME', 86400),
710
            ],
711
            
712
            /**
713
             * Database configuration
714
             */
715
            'database' => [
716 4
                'default' => Env::get('DATABASE_ADAPTER', 'mysql'),
717
                'drivers' => [
718
                    'mysql' => [
719 4
                        'adapter' => 'Mysql',
720 4
                        'host' => Env::get('DATABASE_HOST', 'localhost'),
721 4
                        'port' => Env::get('DATABASE_PORT', 3306),
722 4
                        'dbname' => Env::get('DATABASE_DBNAME', ''),
723 4
                        'username' => Env::get('DATABASE_USERNAME', 'root'),
724 4
                        'password' => Env::get('DATABASE_PASSWORD', ''),
725 4
                        'charset' => Env::get('DATABASE_CHARSET', 'utf8'),
726
                        'options' => [
727 4
                            \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . Env::get('DATABASE_CHARSET', 'utf8'),
728 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
729 4
                            \PDO::ATTR_STRINGIFY_FETCHES => Env::get('DATABASE_PDO_STRINGIFY_FETCHES', false),
730 4
                            \PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => Env::get('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
731
                        ],
732
                        /**
733
                         * ReadOnly Configuration
734
                         */
735
                        'readOnly' => [
736 4
                            'host' => Env::get('DATABASE_READONLY_HOST'),
737 4
                            'port' => Env::get('DATABASE_READONLY_PORT'),
738 4
                            'dbname' => Env::get('DATABASE_READONLY_DBNAME'),
739 4
                            'username' => Env::get('DATABASE_READONLY_USERNAME'),
740 4
                            'password' => Env::get('DATABASE_READONLY_PASSWORD'),
741 4
                            'charset' => Env::get('DATABASE_READONLY_CHARSET'),
742
                        ],
743
                    ],
744
                ],
745
            ],
746
            
747
            /**
748
             * Mailer configuration
749
             */
750
            'mailer' => [
751 4
                'driver' => Env::get('MAILER_DRIVER', 'sendmail'),
752
                'drivers' => [
753
                    'mail' => [
754
                        'driver' => 'mail',
755
                    ],
756
                    'sendmail' => [
757 4
                        'driver' => 'sendmail',
758 4
                        'sendmail' => Env::get('MAILER_SENDMAIL', '/usr/sbin/sendmail -bs'),
759
                    ],
760
                    'smtp' => [
761 4
                        'driver' => 'smtp',
762 4
                        'host' => Env::get('MAILER_SMTP_HOST', 'localhost'),
763 4
                        'port' => Env::get('MAILER_SMTP_PORT', 25),
764 4
                        'encryption' => Env::get('MAILER_SMTP_ENCRYPTION', ''),
765 4
                        'username' => Env::get('MAILER_SMTP_USERNAME', ''),
766 4
                        'password' => Env::get('MAILER_SMTP_PASSWORD', ''),
767
                    ],
768
                ],
769
                'default' => [
770 4
                    'charset' => Env::get('MAILER_CHARSET', 'utf-8'),
771 4
                    'viewsDir' => Env::get('MAILER_VIEWS_DIR', APP_PATH . '/Modules/Frontend/Views/'),
772 4
                    'baseUri' => Env::get('MAILER_BASE_URI', null),
773
                ],
774
                'from' => [
775 4
                    'email' => Env::get('MAILER_FROM_EMAIL', 'zemit@localhost'),
776 4
                    'name' => Env::get('MAILER_FROM_NAME', 'Zemit'),
777
                ],
778 4
                'to' => [...explode(',', Env::get('MAILER_TO_EMAIL', ''))],
779 4
                'cc' => [...explode(',', Env::get('MAILER_CC_EMAIL', ''))],
780 4
                'bcc' => [...explode(',', Env::get('MAILER_BCC_EMAIL', ''))],
781
            ],
782
            
783
            /**
784
             * Cookies
785
             */
786
            'cookies' => [
787 4
                'useEncryption' => Env::get('COOKIES_USE_ENCRYPTION', true),
788 4
                'signKey' => Env::get('COOKIES_SIGN_KEY', ''),
789
            ],
790
            
791
            /**
792
             * Oauth2
793
             */
794
            'oauth2' => [
795
                'client' => [
796 4
                    'clientId' => Env::get('OAUTH2_CLIENT_ID'),
797 4
                    'clientSecret' => Env::get('OAUTH2_CLIENT_SECRET'),
798 4
                    'redirectUri' => Env::get('OAUTH2_CLIENT_REDIRECT_URI', '/oauth2/client/redirect'),
799 4
                    'urlAuthorize' => Env::get('OAUTH2_CLIENT_URL_AUTHORIZE', '/oauth2/client/authorize'),
800 4
                    'urlAccessToken' => Env::get('OAUTH2_CLIENT_URL_ACCESS_TOKEN', '/oauth2/client/token'),
801 4
                    'urlResourceOwnerDetails' => Env::get('OAUTH2_CLIENT_URL_RESOURCE', '/oauth2/client/resource'),
802 4
                    'proxy' => Env::get('OAUTH2_CLIENT_PROXY', null),
803 4
                    'verify' => Env::get('OAUTH2_CLIENT_VERIFY', true),
804
                ],
805
                'facebook' => [
806 4
                    'clientId' => Env::get('OAUTH2_FACEBOOK_CLIENT_ID'),
807 4
                    'clientSecret' => Env::get('OAUTH2_FACEBOOK_CLIENT_SECRET'),
808 4
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/facebook/callback'),
809 4
                    'graphApiVersion' => Env::get('OAUTH2_FACEBOOK_GRAPH_API_VERSION', 'v2.10'),
810
                ],
811
                'google' => [
812 4
                    'clientId' => Env::get('OAUTH2_GOOGLE_CLIENT_ID'),
813 4
                    'clientSecret' => Env::get('OAUTH2_GOOGLE_CLIENT_SECRET'),
814 4
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/google/callback'),
815 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
816
                ],
817
                'instagram' => [
818
                
819
                ],
820
                'linked' => [
821
                
822
                ],
823
                'twitter' => [
824
                
825
                ],
826
                'github' => [
827
                
828
                ],
829
                'apple' => [
830
                
831
                ],
832
            ],
833
            
834
            /**
835
             * Dotenv
836
             */
837
            'dotenv' => [
838
                'filePath' => '',
839
            ],
840
            
841
            /**
842
             * Client config to passe to front-end
843
             */
844
            'client' => [],
845
            
846
            /**
847
             * Application permissions
848
             */
849
            'permissions' => [
850
                'features' => [
851
                    // This feature allow to administer users
852
                    'user' => [
853
                        'behaviors' => [
854
                            UserController::class => [
855
                                SkipWhiteList::class,
856
                                SkipIdentityCondition::class,
857
                                Create::class,
858
                                Update::class,
859
                                Delete::class,
860
                                Restore::class,
861
                            ]
862
                        ],
863
                        'components' => [
864
                            UserController::class => ['*'],
865
                            User::class => ['*'],
866
                        ]
867
                    ],
868
                ],
869
                'roles' => [
870
                    // Everyone
871
                    'everyone' => [
872
                        'behaviors' => [
873
                        
874
                        ],
875
                        'features' => [
876
                            'user',
877
                        ],
878
                        'components' => [
879
                        
880
                        ],
881
                        'controllers' => [
882
                            IndexController::class => ['*'],
883
                            ErrorController::class => ['*'],
884
                            TestController::class => ['*'],
885
                            UserController::class => ['*'],
886
                            FacebookController::class => ['*'],
887
                            GoogleController::class => ['*'],
888
                        ],
889
                        'tasks' => [
890
                            CronTask::class => ['*'],
891
                            CacheTask::class => ['*'],
892
                        ],
893
                        'models' => [
894
                        
895
                        ],
896
                        'views' => [
897
                        
898
                        ],
899
                    ],
900
                    // Visitor Only
901
                    'visitor' => [
902
                    
903
                    ],
904
                    // Guest Only
905
                    'guest' => [
906
                    
907
                    ],
908
                    // User only
909
                    'user' => [
910
                    
911
                    ],
912
                    // Admin only
913
                    'admin' => [
914
                        'inherit' => [
915
                        
916
                        ],
917
                    ],
918
                    // Dev only
919
                    'dev' => [
920
                        'inherit' => [
921
                            'admin'
922
                        ],
923
                    ],
924
                ]
925
            ],
926
        ]);
927 4
        if (!empty($config)) {
928
            $this->merge(new PhalconConfig($config));
929
        }
930 4
    }
931
    
932
    /**
933
     * Merge the specified environment config with this one
934
     * This should be used to overwrite specific values only
935
     *
936
     * @param null|string $env If null, will fetch the current environement from $this->app->env
937
     *
938
     * @return Config $this Return the merged current config
939
     */
940 4
    public function mergeEnvConfig($env = null)
941
    {
942 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...
943
        
944 4
        if (file_exists($configFile)) {
945
            $envConfig = require_once $configFile;
946
            if (!empty($envConfig)) {
947
                $envConfig = is_callable($envConfig) ? $envConfig() : $envConfig;
948
                if (is_array($envConfig)) {
949
                    $this->merge(new PhalconConfig($envConfig));
950
                }
951
            }
952
        }
953
        
954 4
        return $this;
955
    }
956
}
957
958
//if (php_sapi_name() === 'cli') {
959
//    $devtoolConfig = new Config();
960
//    return $devtoolConfig->mergeEnvConfig();
961
//}
962