File Component.php
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace BootPress\SQLite;
use BootPress\Database\Component as Database;
Function info
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function info($master) // only made public so that $this->fts can call it
{
if ($master == 'settings') {
if (!isset($this->info['settings'])) {
if ($this->create('config', array('settings' => 'TEXT NOT NULL DEFAULT ""'))) {
- 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 recreate
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function recreate($file)
{
if (is_file($file)) {
return;
}
- 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 alter
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function alter($table, array $fields, array $changes, $columns)
{
$map = array();
if ($compare = $this->row('SELECT * FROM '.$table.' LIMIT 1', array(), 'assoc')) {
foreach ($changes as $old => $new) {
- 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 index
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function index($table, $columns)
{
$queries = array();
$outdated = $this->info('indexes', $table);
if (empty($outdated)) {
- 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 __construct
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($file = null)
{
if (is_null($file)) {
$file = ':memory:';
$this->created = true;
- 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 recreate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function recreate($file)
{
if (is_file($file)) {
return;
}
Method info
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function info($master) // only made public so that $this->fts can call it
{
if ($master == 'settings') {
if (!isset($this->info['settings'])) {
if ($this->create('config', array('settings' => 'TEXT NOT NULL DEFAULT ""'))) {
Method alter
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function alter($table, array $fields, array $changes, $columns)
{
$map = array();
if ($compare = $this->row('SELECT * FROM '.$table.' LIMIT 1', array(), 'assoc')) {
foreach ($changes as $old => $new) {
Method dbExecute
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function dbExecute($stmt, array $values, $reference)
{
if (isset($this->prepared[$reference]['result'])) {
$this->prepared[$reference]['result']->finalize();
unset($this->prepared[$reference]['result']);
Method __construct
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($file = null)
{
if (is_null($file)) {
$file = ':memory:';
$this->created = true;
Method index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function index($table, $columns)
{
$queries = array();
$outdated = $this->info('indexes', $table);
if (empty($outdated)) {
Function settings
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function settings($name = null, $value = null)
{
switch (func_num_args()) {
case 0: // they want it all
return $this->info('settings');
- 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 dbExecute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function dbExecute($stmt, array $values, $reference)
{
if (isset($this->prepared[$reference]['result'])) {
$this->prepared[$reference]['result']->finalize();
unset($this->prepared[$reference]['result']);
- 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
Avoid deeply nested control flow statements. Open
if (!empty($sql)) {
$this->info['indexes'][$table][$name] = $sql;
}