Showing 25 of 29 total issues
TableReader
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class TableReader
{
use TableAwareTrait;
/** @var int Current record position. */
AbstractRecord
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractRecord implements RecordInterface
{
public const FLAG_NOT_DELETED = 0x20;
public const FLAG_DELETED = 0x2a;
Function open
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function open(): void
{
switch ($this->table->options['editMode']) {
case self::EDIT_MODE_CLONE:
$this->clone();
- 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 TableReader.php
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace XBase;
use XBase\Column\ColumnInterface;
Function pack
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function pack(): self
{
$newRecordCount = 0;
for ($i = 0; $i < $this->getRecordCount(); $i++) {
$r = $this->moveTo($i);
- 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 open
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function open(): void
{
switch ($this->table->options['editMode']) {
case self::EDIT_MODE_CLONE:
$this->clone();
Method get
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get(int $pointer): ?MemoObject
{
if (!$this->isOpen()) {
$this->open();
}
Method createFile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createFile(string $filepath, int $columnsCount): void
{
$header = HeaderFactory::create(TableType::DBASE_III_PLUS_MEMO);
$tableCreator = new TableCreator($filepath, $header);
Function get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function get(int $pointer): ?MemoObject
{
if (!$this->isOpen()) {
$this->open();
}
- 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 collectPerformanceInfo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function collectPerformanceInfo(string $filepath, int $iterations = 100, array $columns = [])
{
$timetable = [];
printf('Reading all data'.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 previousRecord
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function previousRecord(): ?RecordInterface
{
if (!$this->isOpen()) {
$this->open();
}
Method guessDataType
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function guessDataType(string $string): array
{
if (strlen($string) > 4) {
$bytes = unpack('n*', substr($string, 0, 4));
switch ($bytes[1]) {
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $data, ?int $type = null, ?int $pointer = null, ?int $length = null, ?array $info = [])
Avoid too many return
statements within this method. Open
return $this->setVarchar($column, $value);
Avoid too many return
statements within this method. Open
return new DBaseDataConverter($table, $encoder);
Avoid too many return
statements within this method. Open
return $this->setNum($column, $value);
Avoid too many return
statements within this method. Open
return $this->setMemo($column, $value);
Avoid too many return
statements within this method. Open
return $this->setFloat($column, $value);
Avoid too many return
statements within this method. Open
return parent::set($columnName, $value);
Avoid too many return
statements within this method. Open
return $this->setGeneral($column, $value);