Showing 149 of 149 total issues
The method GiveError() contains an exit expression. Open
exit();
- 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);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method Pass() contains an exit expression. Open
exit(0);
- 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);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
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
__construct accesses the super-global variable $_ENV. Open
protected function __construct()
{
$this->dsn=$_ENV['DB_TYPE'].':dbname='.$_ENV['DB_NAME'].';host='.$_ENV['DB_SERVER'].';port='.$_ENV['DB_PORT'].';charset='.$_ENV['DB_CHARSET'];
try
{
- 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
__construct accesses the super-global variable $_ENV. Open
protected function __construct()
{
$this->dsn=$_ENV['DB_TYPE'].':dbname='.$_ENV['DB_NAME'].';host='.$_ENV['DB_SERVER'].';port='.$_ENV['DB_PORT'].';charset='.$_ENV['DB_CHARSET'];
try
{
- 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
__construct accesses the super-global variable $_ENV. Open
private function __construct()
{
$this->mailEngine = $_ENV['mail']['engine'];
$this->mailHost = $_ENV['mail']['host'];
$this->mailPort = $_ENV['mail']['port'];
- 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
Crypto accesses the super-global variable $_ENV. Open
public static function Crypto($inData, $opt="D")
{
$outData="";
$iv = "r@nD0mKey#osekj%^876ghjkjb5dDdf8";
if($opt=='E')
- 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
GenerateHash accesses the super-global variable $_ENV. Open
public static function GenerateHash($plainPassword, $saltKey=null)
{
$salt = isset($_ENV['app_key'])?$_ENV['app_key']:"$#@kT!@p!7ram3w0rk";
$salt = $saltKey == null ? $salt : $saltKey;
$hash = hash_hmac('sha256', $plainPassword, $salt, false);
- 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
GenerateHash accesses the super-global variable $_ENV. Open
public static function GenerateHash($plainPassword, $saltKey=null)
{
$salt = isset($_ENV['app_key'])?$_ENV['app_key']:"$#@kT!@p!7ram3w0rk";
$salt = $saltKey == null ? $salt : $saltKey;
$hash = hash_hmac('sha256', $plainPassword, $salt, false);
- 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
has accesses the super-global variable $_REQUEST. Open
public static function has($input)
{
return isset($_REQUEST[$input])?true:false;
}
- 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
delete accesses the super-global variable $_SERVER. Open
public static function delete($cookieName = null)
{
if($cookieName == null)
{
if (isset($_SERVER['HTTP_COOKIE']))
- 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
get accesses the super-global variable $_REQUEST. Open
public static function get($input=null)
{
if($input == null)
{
return System::FilterInput($_REQUEST);
- 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
get accesses the super-global variable $_REQUEST. Open
public static function get($input=null)
{
if($input == null)
{
return System::FilterInput($_REQUEST);
- 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
verifyToken accesses the super-global variable $_SESSION. Open
public function verifyToken()
{
if(isset($_POST['csrf_token']) && !empty($_POST['csrf_token']) && isset($_SESSION['csrf_token']))
{
if(hash_equals($_SESSION['csrf_token'], $_POST['csrf_token']))
- 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
has accesses the super-global variable $_COOKIE. Open
public static function has($cookieName)
{
return isset($_COOKIE[$cookieName]);
}
- 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
__construct accesses the super-global variable $_ENV. Open
protected function __construct()
{
$this->dsn=$_ENV['DB_TYPE'].':dbname='.$_ENV['DB_NAME'].';host='.$_ENV['DB_SERVER'].';port='.$_ENV['DB_PORT'].';charset='.$_ENV['DB_CHARSET'];
try
{
- 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
__construct accesses the super-global variable $_ENV. Open
private function __construct()
{
$this->mailEngine = $_ENV['mail']['engine'];
$this->mailHost = $_ENV['mail']['host'];
$this->mailPort = $_ENV['mail']['port'];
- 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
init accesses the super-global variable $_COOKIE. Open
private static function init()
{
$session_factory = new SessionFactory;
$session = $session_factory->newInstance($_COOKIE);
$session->setCookieParams(array('lifetime' => $_ENV['session_life']));
- 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'];
}
}