Showing 20 of 24 total issues
Function getVersion
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function getVersion($version, $stable)
{
if (!is_string($version)) {
throw new \InvalidArgumentException('Unexpected value, string expected!');
}
- 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
Application
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Application extends JApplicationCli
{
protected $_messageQueue = array();
protected $_options = array();
Function retrieveVersions
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected function retrieveVersions()
{
if ($this->versions === null) {
$repository = escapeshellarg($this->joomlaRepository);
$result = `git ls-remote $repository | grep -E 'refs/(tags|heads)' | grep -v '{}'`;
- 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 configure
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
$this
->setName('core:install-db')
->setDescription('Install default joomla database')
Function install
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function install($target)
{
$client = str_replace('/', '', (string)$this->manifest['client']);
- 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 getVersion
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getVersion($version, $stable)
{
if (!is_string($version)) {
throw new \InvalidArgumentException('Unexpected value, string expected!');
}
Method installLanguage
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function installLanguage(InputInterface $input, OutputInterface $output)
{
$joomlaApp = Bootstrapper::getApplication($input->getOption('path'));
$joomlaApp->set('list_limit', 10000);
$lang = $input->getArgument('language');
Method install
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function install($target)
{
// filter name according to 'cmd' JFilterInput
$name = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', (string) $this->manifest->name));
Method createAdminUser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createAdminUser()
{
$release = array_keys($this->version)[0];
if (is_numeric(substr($release, 0, 1)) && substr($release, 0, 1) < 3) {
// joomla 2.x admin user insert query
Method install
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function install($target)
{
$client = str_replace('/', '', (string)$this->manifest['client']);
Function install
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function install($target)
{
// filter name according to 'cmd' JFilterInput
$name = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', (string) $this->manifest->name));
- 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 configure
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
$this
->setName('core:download')
->setDescription('Download joomla core')
Function install
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function install($target)
{
$group = str_replace('/', '', (string)$this->manifest['group']);
- 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 installLanguage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function installLanguage(InputInterface $input, OutputInterface $output)
{
$joomlaApp = Bootstrapper::getApplication($input->getOption('path'));
$joomlaApp->set('list_limit', 10000);
$lang = $input->getArgument('language');
- 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 installPackageFiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function installPackageFiles(\SimpleXMLElement $element, $target)
{
if ($element['folder']) {
$source = $this->path . '/' . trim((string)$element['folder'], '/');
} else {
- 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 retrieveVersionsFromCache
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function retrieveVersionsFromCache()
{
// check if file exists and is new enough
if ($this->cachePath && file_exists($this->cachePath)) {
if (filemtime($this->cachePath) < (time() - $this->cacheExpire)) {
- 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 installLanguageFiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function installLanguageFiles(\SimpleXMLElement $element, $target)
{
$folderPrefix = '';
if ($element['folder']) {
$folderPrefix = (string)$element['folder'];
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function install($target)
{
// filter name according to 'cmd' JFilterInput
$name = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', (string) $this->manifest->name));
$name = str_replace(' ', '_', $name); // this is done in joomla, probably will never have spaces, becuase of regexp
- 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;
Function installMediaFiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function installMediaFiles(\SimpleXMLElement $element, $target)
{
if ($element['folder']) {
$mediaFolder = (string)$element['destination'];
if (strpos($mediaFolder, '/../') !== 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"