Showing 13 of 13 total issues
Function __construct
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($dsn, $username = null, $password = null, array $options = array(), array $exec = array())
{
if ($dsn instanceof \PDO) {
$this->connection = $dsn;
$this->driver('PDO');
- 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 __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($dsn, $username = null, $password = null, array $options = array(), array $exec = array())
{
if ($dsn instanceof \PDO) {
$this->connection = $dsn;
$this->driver('PDO');
Function errors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function errors()
{
$errors = self::logs();
foreach ($errors as $id => $db) {
foreach ($db['queries'] as $num => $log) {
- 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 logs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function logs($id = null)
{
$logs = array();
$ids = (is_null($id)) ? array_keys(static::$logs) : array($id);
foreach ($ids as $key) {
- 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 execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function execute($stmt, $values = null)
{
if (isset($this->prepared[$stmt])) {
if (!is_array($values)) {
$values = ($this->prepared[$stmt]['params'] == 1) ? array($values) : array();
- 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 upsert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function upsert($table, $id, array $data)
{
if (isset($this->prepared[$table]['ref']) && $this->execute($table, $id)) {
$data[] = $id;
if ($row = $this->fetch($table)) {
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($dsn, $username = null, $password = null, array $options = array(), array $exec = array())
Avoid too many return
statements within this method. Open
return \PDO::FETCH_NUM;
Function close
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function close($stmt)
{
if (isset($this->prepared[$stmt])) {
if (isset($this->prepared[$stmt]['ref'])) {
foreach ($this->prepared[$stmt]['ref'] as $value) {
- 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 dbStyle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function dbStyle($fetch)
{
switch ($fetch) {
case 'obj':
return \PDO::FETCH_OBJ;
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function update($table, $id, array $data, $and = '')
{
if (isset($this->prepared[$table])) {
$data[] = $id;
- 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 connection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function connection()
{
if (is_null($this->connection) && !is_null($this->construct)) {
list($dsn, $username, $password, $options, $exec) = $this->construct;
try {
- 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 insert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function insert($table, array $data, $and = '')
{
if (isset($this->prepared[$table])) {
return $this->execute($table, $data);
}
- 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"