Method applyFile
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function applyFile($filename, $cwd, array $config = array())
{
$applierConfig = $this->applierUtils->mergeApplierConfig($this->config, array_filter($config));
$applierConfig = $this->applierUtils->sortApplierConfig($applierConfig);
$patchers = $this->extractArrayValue($applierConfig, PluginConfig::PATCHER_APPLIERS);
Method resolveOperationOutput
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function resolveOperationOutput($applierOperations, $args, $operationFailures)
{
$variableFormats = array(
'{{%s}}' => array('escapeshellarg'),
'[[%s]]' => array()
Function resolveOperationOutput
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function resolveOperationOutput($applierOperations, $args, $operationFailures)
{
$variableFormats = array(
'{{%s}}' => array('escapeshellarg'),
'[[%s]]' => array()
- 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 validateOutput
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function validateOutput($output, $operationFailures)
{
$pathMarker = '\|\+\+\+\s(?P<match>.*?)(\t|$)';
$pathMatcher = sprintf('/^%s/', $pathMarker);
Function processOperationItems
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function processOperationItems($patcher, $operations, $args, $failures)
{
$operationResults = array_fill_keys(array_keys($operations), '');
$result = true;
- 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 validateOutput
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function validateOutput($output, $operationFailures)
{
$pathMarker = '\|\+\+\+\s(?P<match>.*?)(\t|$)';
$pathMatcher = sprintf('/^%s/', $pathMarker);
- 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 executeOperations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function executeOperations(
array $patchers,
array $operations,
array $args = array(),
array $failures = array()
- 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 applyFile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function applyFile($filename, $cwd, array $config = array())
{
$applierConfig = $this->applierUtils->mergeApplierConfig($this->config, array_filter($config));
$applierConfig = $this->applierUtils->sortApplierConfig($applierConfig);
$patchers = $this->extractArrayValue($applierConfig, PluginConfig::PATCHER_APPLIERS);
- 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
Missing class import via use statement (line '64', column '28'). Open
$this->shell = new \Vaimo\ComposerPatches\Shell($logger);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '104', column '23'). Open
throw new \Vaimo\ComposerPatches\Exceptions\RuntimeException($message);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '304', column '24'). Open
$failure = new \Vaimo\ComposerPatches\Exceptions\OperationFailure('Output analysis failed');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '203', column '28'). Open
$failure = new \Vaimo\ComposerPatches\Exceptions\OperationFailure($operationCode);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '65', column '35'). Open
$this->applierUtils = new \Vaimo\ComposerPatches\Utils\ConfigUtils();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '66', column '36'). Open
$this->templateUtils = new \Vaimo\ComposerPatches\Utils\TemplateUtils();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '67', column '37'). Open
$this->outputAnalyser = new \Vaimo\ComposerPatches\Console\OutputAnalyser();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '68', column '42'). Open
$this->applierErrorFactory = new \Vaimo\ComposerPatches\Factories\ApplierErrorFactory();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '131', column '24'). Open
$failure = new \Vaimo\ComposerPatches\Exceptions\ApplierFailure(
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Argument 2 (vars)
is array
but \sprintf()
takes float|int|string
Open
$resultKey = sprintf('%s | %s', $cwd, $command);
- Exclude checks
Argument 2 (str)
is false
but \explode()
takes string
Open
$failure->setOutput(explode(PHP_EOL, $output));
- Exclude checks
Argument 2 (cwd)
is array
but \Vaimo\ComposerPatches\Shell::execute()
takes null|string
defined at /code/src/Shell.php:37
Open
$this->resultCache[$resultKey] = $this->shell->execute($command, $cwd);
- Exclude checks