Test Failed
Push — master ( ffc597...4abc3b )
by Julien
12:58 queued 09:01
created

Config::defineConst()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 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
    }
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
                '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
                    \Zemit\Mvc\Module::NAME_BACKEND => [
91
                        'className' => \Zemit\Modules\Backend\Module::class,
92 4
                        'path' => CORE_PATH . 'Modules/Backend/Module.php',
93
                    ],
94
                    \Zemit\Mvc\Module::NAME_API => [
95
                        'className' => \Zemit\Modules\Api\Module::class,
96 4
                        'path' => CORE_PATH . 'Modules/Api/Module.php',
97
                    ],
98
                    \Zemit\Mvc\Module::NAME_CLI => [
99
                        'className' => \Zemit\Modules\Cli\Module::class,
100 4
                        'path' => CORE_PATH . 'Modules/Cli/Module.php',
101
                    ],
102
                    \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
                    '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
                Provider\Crypt\ServiceProvider::class => Provider\Crypt\ServiceProvider::class,
309
                
310
                // oauth2
311
                Provider\Identity\ServiceProvider::class => Provider\Identity\ServiceProvider::class,
312
                Provider\Oauth2Facebook\ServiceProvider::class => Provider\Oauth2Facebook\ServiceProvider::class,
313
                Provider\Oauth2Google\ServiceProvider::class => Provider\Oauth2Google\ServiceProvider::class,
314
                
315
                // lib
316
                Provider\OCR\ServiceProvider::class => Provider\OCR\ServiceProvider::class,
317
                Provider\Jwt\ServiceProvider::class => Provider\Jwt\ServiceProvider::class,
318
                Provider\V8js\ServiceProvider::class => Provider\V8js\ServiceProvider::class,
319
                Provider\Captcha\ServiceProvider::class => Provider\Captcha\ServiceProvider::class,
320
                Provider\Gravatar\ServiceProvider::class => Provider\Gravatar\ServiceProvider::class,
321
                Provider\Clamav\ServiceProvider::class => Provider\Clamav\ServiceProvider::class,
322
//                Snowair\Debugbar\ServiceProvider::class => \Snowair\Debugbar\ServiceProvider::class,
323
            ],
324
            
325
            /**
326
             * Logger Configuration
327
             */
328
            'logger' => [
329 4
                'enable' => Env::get('LOGGER_ENABLE', false),
330
                
331 4
                'error' => Env::get('LOGGER_ERROR', false),
332 4
                'database' => Env::get('LOGGER_DATABASE', false),
333 4
                'dispatcher' => Env::get('LOGGER_DISPATCHER', false),
334 4
                'profiler' => Env::get('LOGGER_PROFILER', false),
335 4
                'mailer' => Env::get('LOGGER_MAILER', false),
336 4
                'cron' => Env::get('LOGGER_CRON', false),
337 4
                'auth' => Env::get('LOGGER_AUTH', false),
338
                
339 4
                'driver' => explode(',', Env::get('LOGGER_DRIVER', 'noop')),
340
                'drivers' => [
341
                    'noop' => [
342
                        'adapter' => \Phalcon\Logger\Adapter\Noop::class,
343
                    ],
344
                    'stream' => [
345
                        'adapter' => \Phalcon\Logger\Adapter\Stream::class,
346
                    ],
347
                    'syslog' => [
348
                        'adapter' => \Phalcon\Logger\Adapter\Syslog::class,
349
                    ],
350
                ],
351
                'default' => [
352 4
                    'path' => Env::get('LOGGER_PATH', PRIVATE_PATH . '/log/'),
353 4
                    'format' => Env::get('LOGGER_FORMAT', '[%date%][%type%] %message%'),
354 4
                    'date' => Env::get('LOGGER_DATE', 'Y-m-d H:i:s'),
355 4
                    'filename' => Env::get('LOGGER_DEFAULT_FILENAME', 'zemit'),
356
                ],
357
            ],
358
            
359
            /**
360
             * Default filters
361
             */
362
            'filters' => [
363 4
                Filter::FILTER_MD5 => Filters\Md5::class,
364
                Filter::FILTER_JSON => Filters\Json::class,
365
                Filter::FILTER_IPV4 => Filters\IPv4::class,
366
                Filter::FILTER_IPV6 => Filters\IPv6::class,
367
            ],
368
            
369
            /**
370
             * Default modules
371
             * @todo change this to class => [class => '', path => '']
372
             */
373
            'modules' => [
374 4
                \Zemit\Mvc\Module::NAME_FRONTEND => [
375
                    'className' => \Zemit\Modules\Frontend\Module::class,
376 4
                    'path' => CORE_PATH . 'Modules/Frontend/Module.php',
377
                ],
378
                \Zemit\Mvc\Module::NAME_BACKEND => [
379
                    'className' => \Zemit\Modules\Backend\Module::class,
380 4
                    'path' => CORE_PATH . 'Modules/Backend/Module.php',
381
                ],
382
                \Zemit\Mvc\Module::NAME_API => [
383
                    'className' => \Zemit\Modules\Api\Module::class,
384 4
                    'path' => CORE_PATH . 'Modules/Api/Module.php',
385
                ],
386
                \Zemit\Mvc\Module::NAME_CLI => [
387
                    'className' => \Zemit\Modules\Cli\Module::class,
388 4
                    'path' => CORE_PATH . 'Modules/Cli/Module.php',
389
                ],
390
                \Zemit\Mvc\Module::NAME_OAUTH2 => [
391
                    'className' => \Zemit\Modules\Oauth2\Module::class,
392 4
                    'path' => CORE_PATH . 'Modules/Oauth2/Module.php',
393
                ],
394
                /**
395
                 * @TODO support this way too
396
                 */
397
//                \Zemit\Modules\Frontend\Module::class => \Zemit\Modules\Frontend\Module::class,
398
//                \Zemit\Modules\Backend\Module::class => \Zemit\Modules\Backend\Module::class,
399
//                \Zemit\Modules\Api\Module::class => \Zemit\Modules\Api\Module::class,
400
//                \Zemit\Modules\Cli\Module::class => \Zemit\Modules\Cli\Module::class,
401
            ],
402
            
403
            /**
404
             * Default router settings
405
             */
406
            'router' => [
407
                'defaults' => [
408 4
                    'namespace' => Env::get('ROUTER_DEFAULT_NAMESPACE', 'Zemit\\Modules\\Frontend\\Controllers'),
409 4
                    'module' => Env::get('ROUTER_DEFAULT_MODULE', 'frontend'),
410 4
                    'controller' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
411 4
                    'task' => Env::get('ROUTER_DEFAULT_CONTROLLER', 'index'),
412 4
                    'action' => Env::get('ROUTER_DEFAULT_ACTION', 'index'),
413
                ],
414
                'notFound' => [
415 4
                    'namespace' => Env::get('ROUTER_NOTFOUND_NAMESPACE', null),
416 4
                    'module' => Env::get('ROUTER_NOTFOUND_MODULE', null),
417 4
                    'controller' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
418 4
                    'task' => Env::get('ROUTER_NOTFOUND_CONTROLLER', 'error'),
419 4
                    'action' => Env::get('ROUTER_NOTFOUND_ACTION', 'notFound'),
420
                ],
421
                'fatal' => [
422 4
                    'namespace' => Env::get('ROUTER_FATAL_NAMESPACE', null),
423 4
                    'module' => Env::get('ROUTER_FATAL_MODULE', null),
424 4
                    'controller' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
425 4
                    'task' => Env::get('ROUTER_FATAL_CONTROLLER', 'error'),
426 4
                    'action' => Env::get('ROUTER_FATAL_ACTION', 'fatal'),
427
                ],
428
                'forbidden' => [
429 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
430 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
431 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
432 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
433 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'forbidden'),
434
                ],
435
                'unauthorized' => [
436 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
437 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
438 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
439 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
440 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'unauthorized'),
441
                ],
442
                'maintenance' => [
443 4
                    'namespace' => Env::get('ROUTER_MAINTENANCE_NAMESPACE', null),
444 4
                    'module' => Env::get('ROUTER_MAINTENANCE_MODULE', null),
445 4
                    'controller' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
446 4
                    'task' => Env::get('ROUTER_MAINTENANCE_CONTROLLER', 'error'),
447 4
                    'action' => Env::get('ROUTER_MAINTENANCE_ACTION', 'maintenance'),
448
                ],
449
                'error' => [
450 4
                    'namespace' => Env::get('ROUTER_ERROR_NAMESPACE', null),
451 4
                    'module' => Env::get('ROUTER_ERROR_MODULE', null),
452 4
                    'controller' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
453 4
                    'task' => Env::get('ROUTER_ERROR_CONTROLLER', 'error'),
454 4
                    'action' => Env::get('ROUTER_ERROR_ACTION', 'index'),
455
                ],
456
            ],
457
            
458
            /**
459
             * Gravatar Configuration
460
             */
461
            'gravatar' => [
462 4
                'default_image' => Env::get('GRAVATAR_DEFAULT_IMAGE', 'identicon'),
463 4
                'size' => Env::get('GRAVATAR_SIZE', 24),
464 4
                'rating' => Env::get('GRAVATAR_RATING', 'pg'),
465 4
                'use_https' => Env::get('GRAVATAR_HTPPS', true),
466
            ],
467
            
468
            /**
469
             * reCaptcha Configuration
470
             */
471
            'reCaptcha' => [
472 4
                'siteKey' => Env::get('RECAPTCHA_KEY'),
473 4
                'secret' => Env::get('RECAPTCHA_SECRET'),
474
            ],
475
            
476
            /**
477
             * Locale Service Settings
478
             */
479
            'locale' => [
480 4
                'default' => Env::get('LOCALE_DEFAULT', 'en'),
481 4
                'sessionKey' => Env::get('LOCALE_SESSION_KEY', 'zemit-locale'),
482 4
                'mode' => Env::get('LOCALE_MODE', Locale::MODE_SESSION_GEOIP),
483 4
                'allowed' => explode(',', Env::get('LOCALE_ALLOWED', 'en')),
484
            ],
485
            
486
            /**
487
             * Translate Service Settings
488
             */
489
            'translate' => [
490 4
                'locale' => Env::get('TRANSLATE_LOCALE', 'en_US.utf8'),
491 4
                'defaultDomain' => Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages'),
492 4
                'category' => Env::get('TRANSLATE_CATEGORY', LC_MESSAGES),
493
                'directory' => [
494 4
                    Env::get('TRANSLATE_DEFAULT_DOMAIN', 'messages') => Env::get('TRANSLATE_DEFAULT_PATH', CORE_PATH . 'Locales'),
495
                ],
496
            ],
497
            
498
            /**
499
             * Default Session Configuration
500
             */
501
            'session' => [
502 4
                'driver' => Env::get('SESSION_DRIVER', 'stream'),
503
                'drivers' => [
504
                    'stream' => [
505
                        'adapter' => \Phalcon\Session\Adapter\Stream::class,
506 4
                        'savePath' => Env::get('SESSION_STREAM_SAVE_PATH', '/tmp')
507
                    ],
508
                    'memcached' => [
509
                        'adapter' => \Phalcon\Session\Adapter\Libmemcached::class,
510
                        'servers' => [
511
                            [
512 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
513 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
514 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
515
                            ],
516
                        ],
517
                        // Client options must be instance of array
518
                        'client' => [],
519
                    ],
520
                    'redis' => [
521
                        'adapter' => \Phalcon\Session\Adapter\Redis::class,
522 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
523 4
                        'port' => Env::get('REDIS_PORT', 6379),
524 4
                        'index' => Env::get('REDIS_INDEX', 0),
525 4
                        'auth' => Env::get('REDIS_AUTH', null),
526 4
                        'persistent' => Env::get('REDIS_PERSISTENT', 0),
527 4
                        'socket' => Env::get('REDIS_SOCKET', null),
528
                    ],
529
                    'noop' => [
530
                        'adapter' => \Phalcon\Session\Adapter\Noop::class,
531
                    ],
532
                    'file' => [
533
                        'adapter' => 'Files',
534
                    ],
535
                ],
536
                'default' => [
537 4
                    'prefix' => Env::get('SESSION_PREFIX', 'zemit_session_'),
538 4
                    'uniqueId' => Env::get('SESSION_UNIQUE_ID', 'zemit_'),
539 4
                    'lifetime' => Env::get('SESSION_LIFETIME', 3600),
540
                ],
541
            ],
542
            
543
            /**
544
             * Default module/plugin structure
545
             */
546
            'module' => [
547
                'dir' => [
548
                    // default
549 4
                    'modules' => Env::get('MODULE_DIR_MODULES', 'Modules/'),
550 4
                    'controllers' => Env::get('MODULE_DIR_CONTROLLER', 'Controllers/'),
551 4
                    'tasks' => Env::get('MODULE_DIR_TASKS', 'Tasks/'),
552 4
                    'models' => Env::get('MODULE_DIR_MODELS', 'Models/'),
553 4
                    'views' => Env::get('MODULE_DIR_VIEWS', 'Views/'),
554 4
                    'bootstrap' => Env::get('MODULE_DIR_BOOTSTRAP', 'Bootstrap/'),
555 4
                    'locales' => Env::get('MODULE_DIR_LOCALES', 'Locales/'),
556 4
                    'config' => Env::get('MODULE_DIR_CONFIG', 'Config/'),
557
                    
558
                    // private
559 4
                    'migrations' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
560 4
                    'cache' => Env::get('MODULE_DIR_MIGRATION', 'Private/migrations/'),
561 4
                    'logs' => Env::get('MODULE_DIR_LOGS', 'Private/migrations/'),
562 4
                    'backups' => Env::get('MODULE_DIR_BACKUPS', 'Private/backups/'),
563 4
                    'files' => Env::get('MODULE_DIR_FILES', 'Private/files/'),
564 4
                    'trash' => Env::get('MODULE_DIR_TRASH', 'Private/trash/'),
565
                ],
566
            ],
567
            
568
            /**
569
             * Default security settings
570
             */
571
            'security' => [ // phalcon security config
572 4
                'workfactor' => Env::get('SECURITY_WORKFACTOR', 12), // workfactor for the phalcon security service
573 4
                'salt' => Env::get('SECURITY_SALT', 'ZEMIT_CORE_DEFAULT_SALT') // salt for the phalcon security service
574
            ],
575
            
576
            /**
577
             * Cache drivers configs
578
             */
579
            'cache' => [
580 4
                'driver' => Env::get('CACHE_DRIVER', 'memory'),
581
                'drivers' => [
582
                    'memory' => [
583
                        'adapter' => \Phalcon\Cache\Adapter\Memory::class,
584
                    ],
585
                    'apcu' => [
586
                        'adapter' => \Phalcon\Cache\Adapter\Apcu::class,
587
                    ],
588
                    'file' => [
589
                        'adapter' => \Phalcon\Cache\Adapter\Stream::class,
590 4
                        'cacheDir' => PRIVATE_PATH . '/cache/data/',
591
                    ],
592
                    'memcached' => [
593
                        'adapter' => \Phalcon\Cache\Adapter\Libmemcached::class,
594
                        'servers' => [
595
                            [
596 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
597 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
598 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
599
                            ],
600
                        ],
601
                    ],
602
                    'redis' => [
603
                        'adapter' => \Phalcon\Cache\Adapter\Redis::class,
604 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
605 4
                        'port' => Env::get('REDIS_PORT', 6379),
606 4
                        'index' => Env::get('REDIS_INDEX', 0),
607 4
                        'auth' => Env::get('REDIS_AUTH', null),
608 4
                        'persistent' => Env::get('REDIS_PERSISTENT', null),
609 4
                        'socket' => Env::get('REDIS_SOCKET', null),
610
                    ],
611
                ],
612
                'default' => [
613 4
                    'prefix' => Env::get('CACHE_PREFIX', 'zemit_cache_'),
614 4
                    'lifetime' => Env::get('CACHE_LIFETIME', 86400),
615 4
                    'defaultSerializer' => Env::get('CACHE_DEFAULT_SERIALIZER', 'Php'),
616
                ],
617
            ],
618
            
619
            /**
620
             * Metadata Configuration
621
             */
622
            'metadata' => [
623 4
                'driver' => Env::get('METADATA_DRIVER', 'memory'),
624
                'drivers' => [
625
                    'apcu' => [
626
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Apcu::class,
627
                    ],
628
                    'memory' => [
629
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Memory::class,
630
                    ],
631
                    'memcached' => [
632
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Libmemcached::class,
633
                        'servers' => [
634
                            [
635 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
636 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
637 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
638
                            ],
639
                        ],
640
                    ],
641
                    'stream' => [
642
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Stream::class,
643 4
                        'metaDataDir' => PRIVATE_PATH . '/cache/metadata/',
644
                    ],
645
                    'redis' => [
646
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Redis::class,
647 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
648 4
                        'port' => Env::get('REDIS_PORT', 6379),
649 4
                        'index' => Env::get('REDIS_INDEX', 0),
650 4
                        'auth' => Env::get('REDIS_AUTH', null),
651 4
                        'persistent' => Env::get('REDIS_PERSISTENT', null),
652 4
                        'socket' => Env::get('REDIS_SOCKET', null),
653
                    ],
654
                    'wincache' => [
655
                        'adapter' => \Phalcon\Mvc\Model\MetaData\Wincache::class,
656
                    ],
657
                ],
658
                'default' => [
659 4
                    'lifetime' => Env::get('METADATA_LIFETIME', 172800),
660 4
                    'prefix' => Env::get('METADATA_PREFIX', 'zemit_metadata_'),
661
                ],
662
            ],
663
            
664
            /**
665
             * Annotations Configuration
666
             * - Memory
667
             * - Apcu
668
             * - Stream
669
             * - Memcached
670
             * - Redis
671
             * - Aerospike
672
             */
673
            'annotations' => [
674 4
                'default' => Env::get('ANNOTATIONS_DRIVER', 'memory'),
675
                'drivers' => [
676
                    'memory' => [
677
                        'adapter' => \Phalcon\Annotations\Adapter\Memory::class,
678
                    ],
679
                    'apcu' => [
680
                        'adapter' => \Phalcon\Annotations\Adapter\Apcu::class,
681
                    ],
682
                    'file' => [
683
                        'adapter' => \Phalcon\Annotations\Adapter\Stream::class,
684 4
                        'annotationsDir' => PRIVATE_PATH . '/cache/annotations',
685
                    ],
686
                    'memcached' => [
687
                        'adapter' => \Phalcon\Annotations\Adapter\Memcached::class,
688
                        'servers' => [
689
                            [
690 4
                                'host' => Env::get('MEMCACHED_HOST', '127.0.0.1'),
691 4
                                'port' => Env::get('MEMCACHED_PORT', 11211),
692 4
                                'weight' => Env::get('MEMCACHED_WEIGHT', 100),
693
                            ],
694
                        ],
695
                    ],
696
                    'redis' => [
697
                        'adapter' => \Phalcon\Annotations\Adapter\Redis::class,
698 4
                        'host' => Env::get('REDIS_HOST', '127.0.0.1'),
699 4
                        'port' => Env::get('REDIS_PORT', 6379),
700 4
                        'index' => Env::get('REDIS_INDEX', 0),
701 4
                        'auth' => Env::get('REDIS_AUTH', null),
702 4
                        'persistent' => Env::get('REDIS_PERSISTENT', null),
703 4
                        'socket' => Env::get('REDIS_SOCKET', null),
704
                    ],
705
                    'aerospike' => [
706
                        'adapter' => \Phalcon\Annotations\Adapter\Aerospike::class,
707
                    ],
708
                ],
709 4
                'prefix' => Env::get('ANNOTATIONS_PREFIX', 'zemit_annotations_'),
710 4
                'lifetime' => Env::get('ANNOTATIONS_LIFETIME', 86400),
711
            ],
712
            
713
            /**
714
             * Database configuration
715
             */
716
            'database' => [
717 4
                'default' => Env::get('DATABASE_ADAPTER', 'mysql'),
718
                'drivers' => [
719
                    'mysql' => [
720
                        'adapter' => 'Mysql',
721 4
                        'host' => Env::get('DATABASE_HOST', 'localhost'),
722 4
                        'port' => Env::get('DATABASE_PORT', 3306),
723 4
                        'dbname' => Env::get('DATABASE_DBNAME', ''),
724 4
                        'username' => Env::get('DATABASE_USERNAME', 'root'),
725 4
                        'password' => Env::get('DATABASE_PASSWORD', ''),
726 4
                        'charset' => Env::get('DATABASE_CHARSET', 'utf8'),
727
                        'options' => [
728 4
                            \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . Env::get('DATABASE_CHARSET', 'utf8'),
729 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
730 4
                            \PDO::ATTR_STRINGIFY_FETCHES => Env::get('DATABASE_PDO_STRINGIFY_FETCHES', false),
731 4
                            \PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => Env::get('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
732
                        ],
733
                        /**
734
                         * ReadOnly Configuration
735
                         */
736
                        'readOnly' => [
737 4
                            'host' => Env::get('DATABASE_READONLY_HOST'),
738 4
                            'port' => Env::get('DATABASE_READONLY_PORT'),
739 4
                            'dbname' => Env::get('DATABASE_READONLY_DBNAME'),
740 4
                            'username' => Env::get('DATABASE_READONLY_USERNAME'),
741 4
                            'password' => Env::get('DATABASE_READONLY_PASSWORD'),
742 4
                            'charset' => Env::get('DATABASE_READONLY_CHARSET'),
743
                        ],
744
                    ],
745
                ],
746
            ],
747
            
748
            /**
749
             * Mailer configuration
750
             */
751
            'mailer' => [
752 4
                'driver' => Env::get('MAILER_DRIVER', 'sendmail'),
753
                'drivers' => [
754
                    'mail' => [
755
                        'driver' => 'mail',
756
                    ],
757
                    'sendmail' => [
758 4
                        'driver' => 'sendmail',
759 4
                        'sendmail' => Env::get('MAILER_SENDMAIL', '/usr/sbin/sendmail -bs'),
760
                    ],
761
                    'smtp' => [
762 4
                        'driver' => 'smtp',
763 4
                        'host' => Env::get('MAILER_SMTP_HOST', 'localhost'),
764 4
                        'port' => Env::get('MAILER_SMTP_PORT', 25),
765 4
                        'encryption' => Env::get('MAILER_SMTP_ENCRYPTION', ''),
766 4
                        'username' => Env::get('MAILER_SMTP_USERNAME', ''),
767 4
                        'password' => Env::get('MAILER_SMTP_PASSWORD', ''),
768
                    ],
769
                ],
770
                'default' => [
771 4
                    'charset' => Env::get('MAILER_CHARSET', 'utf-8'),
772 4
                    'viewsDir' => Env::get('MAILER_VIEWS_DIR', APP_PATH . '/Modules/Frontend/Views/'),
773 4
                    'baseUri' => Env::get('MAILER_BASE_URI', null),
774
                ],
775
                'from' => [
776 4
                    'email' => Env::get('MAILER_FROM_EMAIL', 'zemit@localhost'),
777 4
                    'name' => Env::get('MAILER_FROM_NAME', 'Zemit'),
778
                ],
779 4
                'to' => [...explode(',', Env::get('MAILER_TO_EMAIL', ''))],
780 4
                'cc' => [...explode(',', Env::get('MAILER_CC_EMAIL', ''))],
781 4
                'bcc' => [...explode(',', Env::get('MAILER_BCC_EMAIL', ''))],
782
            ],
783
            
784
            /**
785
             * Cookies
786
             */
787
            'cookies' => [
788 4
                'useEncryption' => Env::get('COOKIES_USE_ENCRYPTION', true),
789 4
                'signKey' => Env::get('COOKIES_SIGN_KEY', ''),
790
            ],
791
            
792
            /**
793
             * Oauth2
794
             */
795
            'oauth2' => [
796
                'client' => [
797 4
                    'clientId' => Env::get('OAUTH2_CLIENT_ID'),
798 4
                    'clientSecret' => Env::get('OAUTH2_CLIENT_SECRET'),
799 4
                    'redirectUri' => Env::get('OAUTH2_CLIENT_REDIRECT_URI', '/oauth2/client/redirect'),
800 4
                    'urlAuthorize' => Env::get('OAUTH2_CLIENT_URL_AUTHORIZE', '/oauth2/client/authorize'),
801 4
                    'urlAccessToken' => Env::get('OAUTH2_CLIENT_URL_ACCESS_TOKEN', '/oauth2/client/token'),
802 4
                    'urlResourceOwnerDetails' => Env::get('OAUTH2_CLIENT_URL_RESOURCE', '/oauth2/client/resource'),
803 4
                    'proxy' => Env::get('OAUTH2_CLIENT_PROXY', null),
804 4
                    'verify' => Env::get('OAUTH2_CLIENT_VERIFY', true),
805
                ],
806
                'facebook' => [
807 4
                    'clientId' => Env::get('OAUTH2_FACEBOOK_CLIENT_ID'),
808 4
                    'clientSecret' => Env::get('OAUTH2_FACEBOOK_CLIENT_SECRET'),
809 4
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/facebook/callback'),
810 4
                    'graphApiVersion' => Env::get('OAUTH2_FACEBOOK_GRAPH_API_VERSION', 'v2.10'),
811
                ],
812
                'google' => [
813 4
                    'clientId' => Env::get('OAUTH2_GOOGLE_CLIENT_ID'),
814 4
                    'clientSecret' => Env::get('OAUTH2_GOOGLE_CLIENT_SECRET'),
815 4
                    'redirectUri' => Env::get('OAUTH2_FACEBOOK_CLIENT_REDIRECT_URI', '/oauth2/google/callback'),
816 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
817
                ],
818
                'instagram' => [
819
                
820
                ],
821
                'linked' => [
822
                
823
                ],
824
                'twitter' => [
825
                
826
                ],
827
                'github' => [
828
                
829
                ],
830
                'apple' => [
831
                
832
                ],
833
            ],
834
            
835
            /**
836
             * Dotenv
837
             */
838
            'dotenv' => [
839
                'filePath' => '',
840
            ],
841
            
842
            /**
843
             * Client config to passe to front-end
844
             */
845
            'client' => [],
846
            
847
            /**
848
             * Application permissions
849
             */
850
            'permissions' => [
851
                'features' => [
852
                    // This feature allow to administer users
853
                    'user' => [
854
                        'behaviors' => [
855
                            UserController::class => [
856
                                SkipWhiteList::class,
857
                                SkipIdentityCondition::class,
858
                                Create::class,
859
                                Update::class,
860
                                Delete::class,
861
                                Restore::class,
862
                            ]
863
                        ],
864
                        'components' => [
865
                            UserController::class => ['*'],
866
                            User::class => ['*'],
867
                        ]
868
                    ],
869
                ],
870
                'roles' => [
871
                    // Everyone
872
                    'everyone' => [
873
                        'behaviors' => [
874
                        
875
                        ],
876
                        'features' => [
877
                            'user',
878
                        ],
879
                        'components' => [
880
                        
881
                        ],
882
                        'controllers' => [
883
                            IndexController::class => ['*'],
884
                            ErrorController::class => ['*'],
885
                            TestController::class => ['*'],
886
                            UserController::class => ['*'],
887
                            FacebookController::class => ['*'],
888
                            GoogleController::class => ['*'],
889
                        ],
890
                        'tasks' => [
891
                            CronTask::class => ['*'],
892
                            CacheTask::class => ['*'],
893
                        ],
894
                        'models' => [
895
                        
896
                        ],
897
                        'views' => [
898
                        
899
                        ],
900
                    ],
901
                    // Visitor Only
902
                    'visitor' => [
903
                    
904
                    ],
905
                    // Guest Only
906
                    'guest' => [
907
                    
908
                    ],
909
                    // User only
910
                    'user' => [
911
                    
912
                    ],
913
                    // Admin only
914
                    'admin' => [
915
                        'inherit' => [
916
                        
917
                        ],
918
                    ],
919
                    // Dev only
920
                    'dev' => [
921
                        'inherit' => [
922
                            'admin'
923
                        ],
924
                    ],
925
                ]
926
            ],
927
        ]);
928 4
        if (!empty($config)) {
929
            $this->merge(new PhalconConfig($config));
930
        }
931
    }
932
    
933
    /**
934
     * Merge the specified environment config with this one
935
     * This should be used to overwrite specific values only
936
     *
937
     * @param null|string $env If null, will fetch the current environement from $this->app->env
938
     *
939
     * @return Config $this Return the merged current config
940
     */
941 4
    public function mergeEnvConfig($env = null)
942
    {
943 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...
944
        
945 4
        if (file_exists($configFile)) {
946
            $envConfig = require_once $configFile;
947
            if (!empty($envConfig)) {
948
                $envConfig = is_callable($envConfig) ? $envConfig() : $envConfig;
949
                if (is_array($envConfig)) {
950
                    $this->merge(new PhalconConfig($envConfig));
951
                }
952
            }
953
        }
954
        
955 4
        return $this;
956
    }
957
}
958
959
//if (php_sapi_name() === 'cli') {
960
//    $devtoolConfig = new Config();
961
//    return $devtoolConfig->mergeEnvConfig();
962
//}
963