Showing 47 of 50 total issues
Method handle
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): int
{
$width = (int) $this->option('width');
$value = Str::lower($this->argument('value'));
Method handle
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): int
{
$key = $this->argument('key');
$force = $this->option('force');
Method parse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse(bool $skipEmpty = true): array
{
$languages = [];
$header = $this->reader->getHeader();
$rows = $this->reader->getRows()->collect();
Method handle
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): int
{
/** @var string $from */
$from = $this->argument('from');
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handle(CsvReader $reader): void
{
//get keys position
$count = [];
$reader->getRows()->each(function ($columns, $line) use (&$count) {
- 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 msToHuman
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function msToHuman($inputMs): string
{
$msInASecond = 1000;
$msInAMinute = 60 * $msInASecond;
$msInAnHour = 60 * $msInAMinute;
Method translate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function translate(): int
{
$this->warn(sprintf("Processing the '%s' file...", csv_path(true)));
//check if csv file exists
Method validateRaw
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateRaw(): void
{
//read raw csv
/** @var Collection<int,Collection<int,string>> $output */
$output = collect([]);
Method handle
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(CsvReader $reader): void
{
$errors = collect([]);
//get headers
Method handle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(LarexExportCommand $command, CsvReader $reader): int
{
$parser = CsvParser::create($reader);
$languages = $parser->setHandleSubKey(false)->parse();
Method handle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(LarexExportCommand $command, CsvReader $reader): int
{
$parser = CsvParser::create($reader);
$languages = $parser->setHandleSubKey(false)->parse();
Method validateCollection
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function validateCollection(Collection $rows): void
{
$compare = null;
foreach ($rows as $i => $columns) {
if (!is_array($columns)) {
Function handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function handle(CsvReader $reader): void
{
$count = [];
$reader->getRows()->each(function ($columns, $line) use (&$count) {
$line += 2;
- 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 handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): int
{
if (!File::exists(csv_path())) {
$this->error(sprintf("The '%s' does not exists.", csv_path(true)));
$this->line('Please create it with: php artisan larex: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
Function fputcsv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function fputcsv(
$handle,
array $array,
string $delimiter = ',',
string $enclosure = '"',
- 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 fputcsv
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$handle,
array $array,
string $delimiter = ',',
string $enclosure = '"',
string $escape = '\\',
Method writeKeyValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected static function writeKeyValue($key, $value, &$file, int $level = 1, $eol = PHP_EOL): void
Function writeKeyValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function writeKeyValue($key, $value, &$file, int $level = 1, $eol = PHP_EOL): void
{
$enclosure = '"';
if (is_array($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 translate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function translate(): int
{
$this->warn(sprintf("Processing the '%s' file...", csv_path(true)));
//check if csv file exists
- 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 parseErrors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function parseErrors(string $group, array $keys, &$errors): void
{
foreach ($keys as $key) {
if (count($key['children']) === 0) {
continue;
- 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"