view accesses the super-global variable $_ENV. Open
public static function view($view, $arrayParams = [], $exit = false)
{
$loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
$cache = __DIR__.'/../../Storage/Cache/Views';
if(!$_ENV['cache_template'])
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
view accesses the super-global variable $_SERVER. Open
public static function view($view, $arrayParams = [], $exit = false)
{
$loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
$cache = __DIR__.'/../../Storage/Cache/Views';
if(!$_ENV['cache_template'])
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
back accesses the super-global variable $_SERVER. Open
public static function back()
{
$ref = "location: ".$_SERVER['HTTP_REFERER'];
header($ref);
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
view accesses the super-global variable $_ENV. Open
public static function view($view, $arrayParams = [], $exit = false)
{
$loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
$cache = __DIR__.'/../../Storage/Cache/Views';
if(!$_ENV['cache_template'])
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Method view
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function view($view, $arrayParams = [], $exit = false)
{
$loader = new Twig_Loader_Filesystem(__DIR__.'/../../Views');
$cache = __DIR__.'/../../Storage/Cache/Views';
if(!$_ENV['cache_template'])
The method view has a boolean flag argument $exit, which is a certain sign of a Single Responsibility Principle violation. Open
public static function view($view, $arrayParams = [], $exit = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method view() contains an exit expression. Open
exit(1);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}