File Exasol.php
has 351 lines of code (exceeds 250 allowed). Consider refactoring.
<?php
declare(strict_types=1);
namespace Keboola\Datatype\Definition;
The class Exasol has an overall complexity of 92 which is very high. The configured complexity threshold is 50.
class Exasol extends Common
{
public const METADATA_BACKEND = 'exasol';
public const TYPE_DECIMAL = 'DECIMAL';
Method validateLength
has 60 lines of code (exceeds 25 allowed). Consider refactoring.
private function validateLength(string $type, $length = null): void
{
$valid = true;
switch (strtoupper($type)) {
Function validateLength
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
private function validateLength(string $type, $length = null): void
{
$valid = true;
switch (strtoupper($type)) {
Method getBasetype
has 37 lines of code (exceeds 25 allowed). Consider refactoring.
public function getBasetype(): string
{
switch (strtoupper($this->type)) {
case self::TYPE_DECIMAL:
case self::TYPE_DEC:
Method getDefaultLength
has 36 lines of code (exceeds 25 allowed). Consider refactoring.
private function getDefaultLength()
{
$out = null;
switch (strtoupper($this->type)) {
case self::TYPE_DECIMAL:
Function getTypeOnlySQLDefinition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public function getTypeOnlySQLDefinition(): string
{
$type = $this->getType();
$definition = strtoupper($type);
if (!in_array($definition, self::TYPES_WITHOUT_LENGTH)) {
Function getBasetype
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public function getBasetype(): string
{
switch (strtoupper($this->type)) {
case self::TYPE_DECIMAL:
case self::TYPE_DEC:
Function getDefaultLength
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
private function getDefaultLength()
{
$out = null;
switch (strtoupper($this->type)) {
case self::TYPE_DECIMAL:
Avoid too many return
statements within this method.
return self::TYPE_DECIMAL;
Avoid too many return
statements within this method.
return self::TYPE_TIMESTAMP;
Avoid too many return
statements within this method.
return self::TYPE_VARCHAR;
The method getBasetype() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
public function getBasetype(): string
{
switch (strtoupper($this->type)) {
case self::TYPE_DECIMAL:
case self::TYPE_DEC:
The method validateLength() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
private function validateLength(string $type, $length = null): void
{
$valid = true;
switch (strtoupper($type)) {
The method getDefaultLength() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
private function getDefaultLength()
{
$out = null;
switch (strtoupper($this->type)) {
case self::TYPE_DECIMAL:
The method validateLength uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$valid = false;
}
Avoid using static access to class 'Keboola\Datatype\Definition\BaseType' in method 'getTypeByBasetype'.
if (!BaseType::isValid($basetype)) {
Similar blocks of code found in 3 locations. Consider refactoring.
public static function getTypeByBasetype(string $basetype): string
{
$basetype = strtoupper($basetype);
if (!BaseType::isValid($basetype)) {
There are no issues that match your filters.