Showing 36 of 36 total issues
Function isIgnored
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function isIgnored($name, array $ignore, array $force, $dirName)
{
$vName = substr($name, strlen($dirName));
if (in_array($vName, $force, true)) {
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
File Bowerphp.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of Bowerphp.
*
Function execute
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->setGithubToken($output);
$this->config->setSaveToBowerJsonFile($input->getOption('save'));
- 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 compile
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compile($pharFile = 'bowerphp.phar')
{
if (file_exists($pharFile)) {
unlink($pharFile);
}
Function isPackageExtraneous
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function isPackageExtraneous(PackageInterface $package, $checkInstall = false)
{
if ($checkInstall && !$this->isPackageInstalled($package)) {
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
Function installPackage
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function installPackage(PackageInterface $package, InstallerInterface $installer, $isDependency = false)
{
if (false !== strpos($package->getName(), 'github')) {
// install from a github endpoint
$name = basename($package->getName(), '.git');
- 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 isIgnored
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isIgnored($name, array $ignore, array $force, $dirName)
{
$vName = substr($name, strlen($dirName));
if (in_array($vName, $force, true)) {
return false;
Function updatePackage
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function updatePackage(PackageInterface $package, InstallerInterface $installer)
{
if (!$this->isPackageInstalled($package)) {
throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
}
- 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 installPackage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function installPackage(PackageInterface $package, InstallerInterface $installer, $isDependency = false)
{
if (false !== strpos($package->getName(), 'github')) {
// install from a github endpoint
$name = basename($package->getName(), '.git');
Method updatePackage
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updatePackage(PackageInterface $package, InstallerInterface $installer)
{
if (!$this->isPackageInstalled($package)) {
throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
}
Method execute
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->setGithubToken($output);
$this->config->setSaveToBowerJsonFile($input->getOption('save'));
Method findPackage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findPackage($rawCriteria = '*')
{
list($repoUser, $repoName) = explode('/', $this->clearGitURL($this->url));
$paginator = new ResultPager($this->githubClient);
$tags = $paginator->fetchAll($this->githubClient->api('repo'), 'tags', [$repoUser, $repoName]);
Method install
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function install(PackageInterface $package)
{
$tmpFileName = $this->config->getCacheDir() . '/tmp/' . $package->getName();
if (true !== $this->zipArchive->open($tmpFileName)) {
throw new RuntimeException(sprintf('Unable to open zip file %s.', $tmpFileName));
Method isPackageExtraneous
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isPackageExtraneous(PackageInterface $package, $checkInstall = false)
{
if ($checkInstall && !$this->isPackageInstalled($package)) {
return false;
}
Method execute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->setGithubToken($output);
$packageName = $input->getArgument('package');
Function sortTags
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function sortTags(array $tags, $excludeUnstables = true)
{
$return = [];
// Don't include invalid tags
- 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 install
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function install(PackageInterface $package)
{
$tmpFileName = $this->config->getCacheDir() . '/tmp/' . $package->getName();
if (true !== $this->zipArchive->open($tmpFileName)) {
throw new RuntimeException(sprintf('Unable to open zip file %s.', $tmpFileName));
- 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 getDepBowerJson
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getDepBowerJson($version)
{
list($repoUser, $repoName) = explode('/', $this->clearGitURL($this->url));
$contents = $this->githubClient->api('repo')->contents();
if ($contents->exists($repoUser, $repoName, 'bower.json', $version)) {
- 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 __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
$this->cacheDir = $this->getHomeDir() . '/.cache/bowerphp';
$this->installDir = getcwd() . '/bower_components';
- 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 findPackage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function findPackage($rawCriteria = '*')
{
list($repoUser, $repoName) = explode('/', $this->clearGitURL($this->url));
$paginator = new ResultPager($this->githubClient);
$tags = $paginator->fetchAll($this->githubClient->api('repo'), 'tags', [$repoUser, $repoName]);
- 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"