bootstrap.php ➔ _()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 18 and the first side effect is on line 3.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
// Error Reporting Level
3
error_reporting(E_ALL | E_STRICT);
4
5
// add framework and tests to include path
6
$framework = realpath(__DIR__ . '/../framework');
7
$tests     = realpath(__DIR__ . '/../tests');
8
9
$paths = [
10
    $framework,
11
    $tests,
12
    get_include_path(), // attach original include paths
13
];
14
set_include_path(implode(PATH_SEPARATOR, $paths));
15
16
// gettext fall through
17
if (!function_exists('_')) {
18
    function _($msgid)
0 ignored issues
show
Coding Style introduced by
function _() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
Coding Style introduced by
This method's name is shorter than the configured minimum length of 3 characters.

Even though PHP does not care about the name of your methods, it is generally a good practice to choose method names which can be easily understood by other human readers.

Loading history...
19
    {
20
        return $msgid;
21
    }
22
}
23
24
// Composer Autoloader
25
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
26
    include_once __DIR__ . '/../vendor/autoload.php';
27
} else {
28
    echo '[Error] Koch Framework > Tests > Bootstrap: Could not find "vendor/autoload.php".' . PHP_EOL;
29
    echo 'Did you forget to run "composer install --dev"?' . PHP_EOL;
30
    exit(1);
31
}
32
33
// Koch Framework Autoloader
34
// Note: We are on top of the autoloader stack and not Composer's ClassLoader.
35
require_once __DIR__ . '/../framework/Koch/Autoload/Loader.php';
36
$autoloader = new \Koch\Autoload\Loader();
37
$autoloader->setClassMapFile(__DIR__ . '/autoloader.classmap.php'); // KF/tests/autoloader.classmap.php
38
39
\Koch\Localization\Utf8::initialize();
40
41
require_once __DIR__ . '/constants.php';
42