Function unPackGz
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
private function unPackGz(string $gitFolder, string $hash): array|false|null
{
$commit = false;
$gitFileName = $gitFolder . '/objects/'
- 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 Git.php
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace PhpMyAdmin;
Function checkGitRevision
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function checkGitRevision(): array|null
{
// find out if there is a .git folder
$gitFolder = '';
if (! $this->isGitRevision($gitFolder)) {
- 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 checkGitRevision
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkGitRevision(): array|null
{
// find out if there is a .git folder
$gitFolder = '';
if (! $this->isGitRevision($gitFolder)) {
Method unPackGz
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function unPackGz(string $gitFolder, string $hash): array|false|null
{
$commit = false;
$gitFileName = $gitFolder . '/objects/'
Function getHashFromHeadRef
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function getHashFromHeadRef(string $gitFolder, string $refHead): array
{
// are we on any branch?
if (! str_contains($refHead, '/')) {
return [trim($refHead), false];
- 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 getHashFromHeadRef
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getHashFromHeadRef(string $gitFolder, string $refHead): array
{
// are we on any branch?
if (! str_contains($refHead, '/')) {
return [trim($refHead), false];
Method getPackOffset
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getPackOffset(string $packFile, string $hash): int|null
{
// load index
$indexData = @file_get_contents($packFile);
if ($indexData === false) {
Method isGitRevision
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isGitRevision(string|null &$gitLocation = null): bool
{
if (! $this->showGitRevision) {
return false;
}
Function isGitRevision
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function isGitRevision(string|null &$gitLocation = null): bool
{
if (! $this->showGitRevision) {
return false;
}
- 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 readPackFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readPackFile(string $packFile, int $packOffset): string|null
{
// open pack file
$packFileRes = fopen($packFile, 'rb');
if ($packFileRes === false) {
Function getPackOffset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function getPackOffset(string $packFile, string $hash): int|null
{
// load index
$indexData = @file_get_contents($packFile);
if ($indexData === false) {
- 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 readPackFile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function readPackFile(string $packFile, int $packOffset): string|null
{
// open pack file
$packFileRes = fopen($packFile, 'rb');
if ($packFileRes === false) {
- 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 too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return [null, null];
Avoid too many return
statements within this method. Open
return [$hash, $branch];
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return [
'hash' => $hash,
'branch' => $branch,
'message' => $message,
'author' => $author,
Avoid too many return
statements within this method. Open
return $packOffsets[1];
Avoid too many return
statements within this method. Open
return $commit;
Avoid too many return
statements within this method. Open
return null;