These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | |-------------------------------------------------------------------------- |
||
4 | | PIMF core bootstrap used for unit testing |
||
5 | |-------------------------------------------------------------------------- |
||
6 | */ |
||
7 | if (!defined('DS')) { |
||
8 | define('DS', DIRECTORY_SEPARATOR); |
||
9 | } |
||
10 | if (!defined('BASE_PATH')) { |
||
11 | define('BASE_PATH', realpath(__DIR__) . DS); |
||
12 | } |
||
13 | |||
14 | require_once 'autoload.core.php'; |
||
15 | require_once 'utils.php'; |
||
16 | |||
17 | \Pimf\Config::load( |
||
18 | array( |
||
19 | |||
20 | /* |
||
21 | |------------------------------------------------------------------------ |
||
22 | | The default environment mode for your application [testing|production] |
||
23 | |------------------------------------------------------------------------ |
||
24 | */ |
||
25 | 'environment' => 'testing', |
||
26 | /* |
||
27 | |------------------------------------------------------------------------ |
||
28 | | The default timezone of your application. |
||
29 | | Supported timezones list: http://www.php.net/manual/en/timezones.php |
||
30 | |------------------------------------------------------------------------ |
||
31 | */ |
||
32 | 'timezone' => 'UTC', |
||
33 | /* |
||
34 | |-------------------------------------------------------------------------- |
||
35 | | Is it regular HTTP or secure HTTPS |
||
36 | |-------------------------------------------------------------------------- |
||
37 | */ |
||
38 | 'ssl' => false, |
||
39 | /* |
||
40 | |------------------------------------------------------------------------ |
||
41 | | Application meta |
||
42 | |------------------------------------------------------------------------ |
||
43 | */ |
||
44 | 'app' => array( |
||
45 | |||
46 | 'name' => 'MyFirstBlog', |
||
47 | // secret application key or try out http://randomkeygen.com |
||
48 | 'key' => 'some5secret5key5here', |
||
49 | // the name of the fallback controller |
||
50 | 'default_controller' => 'blog', |
||
51 | // get cleaner URLs or not |
||
52 | 'routeable' => true, |
||
53 | // do you have a representational state transfer app? |
||
54 | 'restfull' => false, |
||
55 | // URL used to access your application without a trailing slash. |
||
56 | 'url' => 'http://localhost', |
||
57 | // if using mod_rewrite to get cleaner URLs let it empty otherwise set index.php |
||
58 | 'index' => '', |
||
59 | // the base URL used for your application's asset files |
||
60 | 'asset_url' => '', |
||
61 | ), |
||
62 | /* |
||
63 | |------------------------------------------------------------------------ |
||
64 | | Production environment settings |
||
65 | |------------------------------------------------------------------------ |
||
66 | */ |
||
67 | 'production' => array( |
||
68 | 'db' => array( |
||
69 | 'driver' => 'sqlite', |
||
70 | 'database' => 'app/MyFirstBlog/_database/blog-production.db' |
||
71 | ), |
||
72 | ), |
||
73 | /* |
||
74 | |------------------------------------------------------------------------ |
||
75 | | Production environment settings |
||
76 | |------------------------------------------------------------------------ |
||
77 | */ |
||
78 | 'testing' => array( |
||
79 | 'db' => array( |
||
80 | 'driver' => 'sqlite', |
||
81 | 'database' => 'app/MyFirstBlog/_database/blog-production.db' |
||
82 | ), |
||
83 | ), |
||
84 | /* |
||
85 | |------------------------------------------------------------------------ |
||
86 | | Bootstrapping meta |
||
87 | |------------------------------------------------------------------------ |
||
88 | */ |
||
89 | 'bootstrap' => array( |
||
90 | 'local_temp_directory' => '/tmp/' |
||
91 | ), |
||
92 | /* |
||
93 | |------------------------------------------------------------------------ |
||
94 | | Settings for the error handling behavior |
||
95 | |------------------------------------------------------------------------ |
||
96 | */ |
||
97 | 'error' => array( |
||
98 | |||
99 | 'ignore_levels' => array(0), |
||
100 | 'debug_info' => true, |
||
101 | 'log' => true, |
||
102 | ), |
||
103 | /* |
||
104 | |-------------------------------------------------------------------------- |
||
105 | | Session settings |
||
106 | |-------------------------------------------------------------------------- |
||
107 | */ |
||
108 | 'session' => array( |
||
109 | |||
110 | // Session storage 'cookie', 'file', 'pdo', 'memcached', 'apc', 'redis', |
||
111 | // 'dba', 'wincache', 'memory' or '' for non |
||
112 | 'storage' => 'memory', |
||
113 | // If using file storage - default is null |
||
114 | 'storage_path' => 'app/MyFirstBlog/_session/', |
||
115 | // If using the PDO (database) session storage |
||
116 | 'database' => array( |
||
117 | 'driver' => 'sqlite', |
||
118 | 'database' => 'app/MyFirstBlog/_session/blog-session.db', |
||
119 | ), |
||
120 | // Garbage collection has a 2% chance of occurring for any given request to |
||
121 | // the application. Feel free to tune this to your requirements. |
||
122 | 'garbage_collection' => array(2, 100), |
||
123 | // Session lifetime number of minutes |
||
124 | 'lifetime' => 60, |
||
125 | // Session expiration on web browser close |
||
126 | 'expire_on_close' => false, |
||
127 | // Session cookie name |
||
128 | 'cookie' => 'pimf_session', |
||
129 | // Session cookie path |
||
130 | 'path' => '/', |
||
131 | // Domain for which the session cookie is available. |
||
132 | 'domain' => null, |
||
133 | // If the cookie should only be sent over HTTPS. |
||
134 | 'secure' => false, |
||
135 | ), |
||
136 | /* |
||
137 | |-------------------------------------------------------------------------- |
||
138 | | Cache settings |
||
139 | |-------------------------------------------------------------------------- |
||
140 | */ |
||
141 | 'cache' => array( |
||
142 | |||
143 | // Cache storage 'pdo', 'file', 'memcached', 'apc', 'redis', 'dba', |
||
144 | // 'wincache', 'memory' or '' for non |
||
145 | 'storage' => 'memory', |
||
146 | // If using file storage - default is null |
||
147 | 'storage_path' => 'app/MyFirstBlog/_cache/', |
||
148 | // If using the PDO (database) cache storage |
||
149 | 'database' => array( |
||
150 | 'driver' => 'sqlite', |
||
151 | 'database' => 'app/MyFirstBlog/_cache/blog-cache.db', |
||
152 | ), |
||
153 | // If using Memcached and APC to prevent collisions with other applications on the server. |
||
154 | 'key' => 'pimfmaster', |
||
155 | // Memcached servers - for more check out: http://memcached.org |
||
156 | 'memcached' => array( |
||
157 | 'servers' => array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), |
||
158 | ), |
||
159 | ), |
||
160 | |||
161 | ) |
||
162 | |||
163 | ); |
||
164 | |||
165 | |||
166 | $env = new \Pimf\Environment($_SERVER); |
||
167 | $envData = $env->data(); |
||
168 | |||
169 | \Pimf\Logger::setup( |
||
170 | $env->getIp(), |
||
171 | $envData->get('PHP_SELF', $envData->get('SCRIPT_NAME')) |
||
172 | ); |
||
173 | |||
174 | \Pimf\Util\Header\ResponseStatus::setup( |
||
175 | $envData->get('SERVER_PROTOCOL', 'HTTP/1.0')); |
||
176 | |||
177 | \Pimf\Util\Header::setup( |
||
178 | $env->getUserAgent(), |
||
179 | $env->HTTP_IF_MODIFIED_SINCE, |
||
0 ignored issues
–
show
|
|||
180 | $env->HTTP_IF_NONE_MATCH |
||
181 | ); |
||
182 | |||
183 | \Pimf\Url::setup($env->getUrl(), $env->isHttps()); |
||
184 | \Pimf\Uri::setup($env->PATH_INFO, $env->REQUEST_URI); |
||
185 | \Pimf\Util\Uuid::setup($env->getIp(), $env->getHost()); |
||
186 | |||
187 | unset($env, $envData); |
||
188 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.