src/Bridge/Symfony/Container/ContainerModifier.php
File ContainerModifier.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
namespace K911\Swoole\Bridge\Symfony\Container;
Method generateOverriddenDoInExtension
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function generateOverriddenDoInExtension(
Filesystem $fs,
string $containerDir,
string $fileToLoad,
string $class,
Method overrideGeneratedContainer
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function overrideGeneratedContainer(ReflectionClass $reflContainer, string $cacheDir, bool $isDebug): void
{
$fs = new Filesystem();
$containerFqcn = $reflContainer->getName();
$overriddenFqcn = $containerFqcn.'_Overridden';
Method generateLazyGetter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function generateLazyGetter(string $methodName, array $internals): string
{
$sharedCheck = PHP_EOL;
if (!empty($internals)) {
Method generateOverriddenDoInExtension
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Filesystem $fs,
string $containerDir,
string $fileToLoad,
string $class,
string $namespace
Method overrideCachedEntrypoint
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static function overrideCachedEntrypoint(Filesystem $fs, string $cacheDir, string $containerClass, string $overriddenFqcn, bool $isDebug): void
Function overrideGeneratedContainer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function overrideGeneratedContainer(ReflectionClass $reflContainer, string $cacheDir, bool $isDebug): void
{
$fs = new Filesystem();
$containerFqcn = $reflContainer->getName();
$overriddenFqcn = $containerFqcn.'_Overridden';
- 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 '187', column '23'). Open
Open
throw new \RuntimeException('Generated cached entry point file is missing.');
- 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
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 18 and the first side effect is on line 14. Open
Open
<?php
- Exclude checks
Possible parse error: class missing opening or closing brace Open
Open
final class ContainerModifier
- Exclude checks
Possible parse error: class missing opening or closing brace Open
Open
final class ContainerModifier
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
Open
private static function overrideGeneratedContainer(ReflectionClass $reflContainer, string $cacheDir, bool $isDebug): void
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
Open
public static function modifyContainer(BlockingContainer $container, string $cacheDir, bool $isDebug): void
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 8 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 8 Open
Open
foreach ($methods as $method) {
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 8 Open
Open
if (file_exists($overriddenFile)) {
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
Open
private static $alreadyOverridden = [];
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
if (isset(self::$alreadyOverridden[$reflContainer->getName()])) {
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 8 Open
Open
if (!$reflContainer->hasMethod('createProxy')) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 12 Open
Open
if (isset($ignoredMethods[$methodName]) || !str_starts_with($methodName, 'get')) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 12 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 8 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 8 Open
Open
}
- Exclude checks