Showing 82 of 291 total issues
Function ip_address
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
public static function ip_address($proxy_ips = [])
{
if (self::$ip_address) {
return self::$ip_address;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function seekRouteByTreeForKeychain
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
protected function seekRouteByTreeForKeychain($tree, $keychain, $method, &$params = [])
{
if ($this->debug) {
echo __METHOD__ .
' tree nodes: ' . json_encode(array_keys($tree)) .
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method buildHTML
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildHTML($content, $components)
{
$autoURLBase = $this->getURLRootString();
$title = $this->wikiTitle;
$navigator = "";
Function executeCurl
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static function executeCurl($method, $url, $data = null, $headers = [], $cookies = [], $bodyAsJson = false, $logger = null)
{
//$logger = $this->getFileLogger();
$ch = curl_init();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File LibPDO.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Created by PhpStorm.
* User: Sinri
* Date: 2017/7/14
File LibRequest.php
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Created by PhpStorm.
* User: Sinri
* Date: 2017/5/9
Function loadController
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function loadController($basePath, $controllerClass, $middleware = null)
{
$method_list = get_class_methods($controllerClass);
$reflector = new \ReflectionClass($controllerClass);
foreach ($method_list as $method) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
LibPDO
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class LibPDO
{
/**
* @var \PDO
*/
LibRequest
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class LibRequest
{
const METHOD_ANY = "ANY";//since v2.1.3 for TreeRouter
const METHOD_HEAD = "HEAD";//since v1.3.0
Function loadAllControllersInDirectoryAsCI
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function loadAllControllersInDirectoryAsCI($directory, $urlBase = '', $controllerNamespaceBase = '', $middleware = '')
{
if (!file_exists($directory) || !is_dir($directory)) {
if ($this->debug) {
echo __METHOD__ . " warning: this is not a direcoty: " . $directory . PHP_EOL;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method seekRouteByTreeForKeychain
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function seekRouteByTreeForKeychain($tree, $keychain, $method, &$params = [])
{
if ($this->debug) {
echo __METHOD__ .
' tree nodes: ' . json_encode(array_keys($tree)) .
Function buildCondition
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected final function buildCondition($conditions, $glue = 'AND')
{
$condition_sql = "";
if (is_string($conditions)) {
$condition_sql = $conditions;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function loadAllControllersInDirectoryAsCI
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function loadAllControllersInDirectoryAsCI($directory, $urlBase = '', $controllerNamespaceBase = '', $middleware = '')
{
if ($handle = opendir($directory)) {
if (
$this->default_controller_name
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ip_address
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function ip_address($proxy_ips = [])
{
if (self::$ip_address) {
return self::$ip_address;
}
File Zillah.php
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Created by PhpStorm.
* User: Sinri
* Date: 2017/7/24
Method safeBuildSQL
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function safeBuildSQL($template, $parameters = [])
{
$this->debug($template, $parameters);
$count = preg_match_all('/\?|`\?`|\(\?\)|\[\?\]|\{\?\}/', $template, $matches, PREG_OFFSET_CAPTURE);
$this->debug("preg_match_all count=" . json_encode($count), $matches);
Function seekRoute
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function seekRoute($path, $method)
{
// a possible fix in 2.1.4
if (strlen($path) > 1 && substr($path, strlen($path) - 1, 1) == '/') {
$path = substr($path, 0, strlen($path) - 1);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function safeBuildSQL
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function safeBuildSQL($template, $parameters = [])
{
$this->debug($template, $parameters);
$count = preg_match_all('/\?|`\?`|\(\?\)|\[\?\]|\{\?\}/', $template, $matches, PREG_OFFSET_CAPTURE);
$this->debug("preg_match_all count=" . json_encode($count), $matches);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function loadController
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function loadController($basePath, $controllerClass, $middleware = null)
{
$method_list = get_class_methods($controllerClass);
$reflector = new \ReflectionClass($controllerClass);
foreach ($method_list as $method) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function sendMail
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function sendMail($params)
{
$this->prepareSMTP();
$this->phpMailerInstance->isSMTP();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"