Showing 22 of 24 total issues
File Repository.php
has 458 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
/*
* This file is part of Biurad opensource projects.
*
Repository
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class Repository
{
private float $timeout = 600.0;
private string $command = 'git';
private int $exitCode = 0;
Function getData
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private function getData(string $name): mixed
{
if (!isset($this->data[$name])) {
$o = $this->content ?? $this->repository->run('cat-file', ['commit', $this->__toString()]);
- 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 runConcurrent
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function runConcurrent(array $commands, callable $callback = null, bool $exitOnFailure = true, string $cwd = null): array
{
$outputs = [];
$this->concurrency = 0;
- 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 getBranch
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function getBranch(string $revision = 'HEAD'): Branch|array|null
{
$o = $this->run('branch', ['--points-at', $revision, '--format=%(refname:short) %(objectname)']);
if (empty($o) || 0 !== $this->exitCode) {
- 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 runConcurrent
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runConcurrent(array $commands, callable $callback = null, bool $exitOnFailure = true, string $cwd = null): array
{
$outputs = [];
$this->concurrency = 0;
Function getConfig
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getConfig(string $key = null, string|int|float|bool $default = null): mixed
{
$resolve = fn (string $v) => 'true' === $v ? true : ('false' === $v ? false : (\is_numeric($v) ? (int) $v : $v));
if (null === $key) {
- 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 getReferences
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getReferences(): array
{
$o = $this->run('show-ref');
if (empty($o) || 0 !== $this->exitCode) {
- 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 getBranches
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getBranches(): array
{
$o = $this->run('branch', ['-a', '--format=%(refname:short) %(objectname)']);
if (empty($o) || 0 !== $this->exitCode) {
- 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 getReferences
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getReferences(): array
{
$o = $this->repository->run('for-each-ref', ['--contains', $this->__toString(), '--format=%(refname) %(objectname)']);
if (empty($o) || 0 !== $this->repository->getExitCode()) {
- 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 getData
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getData(string $name): mixed
{
if (!isset($this->data[$name])) {
$o = $this->content ?? $this->repository->run('cat-file', ['commit', $this->__toString()]);
Method commit
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function commit(CommitNew|Commit\Message $commit, array $args = [], string $cwd = null): self
{
if ($commit instanceof Commit\Message) {
$msg = $commit->__toString();
$msg = !empty($msg) ? ['-m', $msg] : ['--allow-empty-message'];
Function commit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function commit(CommitNew|Commit\Message $commit, array $args = [], string $cwd = null): self
{
if ($commit instanceof Commit\Message) {
$msg = $commit->__toString();
$msg = !empty($msg) ? ['-m', $msg] : ['--allow-empty-message'];
- 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 doInitialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function doInitialize(): void
{
if ($this->initialized) {
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 getTag
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getTag(string $revision = 'HEAD'): Tag|array|null
{
$o = $this->run('tag', ['--points-at', $revision, '--format=%(refname:short) %(objectname)']);
if (empty($o) || 0 !== $this->exitCode) {
- 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 getUntrackedFiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getUntrackedFiles(bool $staged = false): array
{
$o = $this->run('status', ['--porcelain', '-uall', $staged ? '-s' : '--untracked-files=all']);
if (empty($o) || 0 !== $this->exitCode) {
- 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 getTags
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getTags(): array
{
$o = $this->run('tag', ['--sort=-creatordate', '--format=%(refname:short) %(objectname)']);
if (empty($o) || 0 !== $this->exitCode) {
- 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 getSize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getSize(bool $real = false): int
{
if ($real) {
if (0 === ($totalBytes = &$this->cache['size'] ?? 0)) {
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getGitPath(), \FilesystemIterator::SKIP_DOTS));
- 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 fromRemote
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $remoteRepo,
string $path,
array $envVars = [],
array $args = [],
bool $debug = true,
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Commit\Message $message,
array $paths = [],
Commit\Identity $author = null,
Commit\Identity $committer = null,
array $coAuthors = []