Showing 185 of 185 total issues
Method execute
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
if (!$this->migrator->isConfigured()) {
Method execute
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
if (!$this->debug) {
Function register
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function register(Container $container, array $configs = []): void
{
if (!$configs['enabled']) {
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 register
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function register(Container $container, array $configs = []): void
{
if (!$configs['enabled']) {
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 register
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function register(Container $container, array $configs = []): void
{
if (!$configs['enabled']) {
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
Method configureOptions
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function configureOptions(OptionsResolver $resolver): void
{
$choiceLoader = function (Options $options) {
// Unless the choices are given explicitly, load them on demand
if (null === $options['choices']) {
Method getConfigTreeBuilder
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(__CLASS__);
$treeBuilder->getRootNode()
Method addProvidersSection
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addProvidersSection(ArrayNodeDefinition $rootNode): void
{
$providerNodeBuilder = $rootNode
->fixXmlConfig('provider')
->children()
Method getConfigTreeBuilder
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(__CLASS__);
$treeBuilder->getRootNode()
Method boot
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot(Container $container): void
{
if (!$container->typed(Application::class)) {
return;
}
Method register
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $container, array $configs = []): void
{
if (!$configs['enabled']) {
return;
}
Method register
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $container, array $configs = []): void
{
if (!$configs['enabled']) {
return;
}
Method getConfigTreeBuilder
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(__CLASS__);
$treeBuilder->getRootNode()
Method register
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $container, array $configs = []): void
{
if (!\class_exists(AnnotationLoader::class)) {
throw new \LogicException('Annotations/Attributes support cannot be enabled as the Annotation component is not installed. Try running "composer require biurad/annotations".');
}
Method getConfigTreeBuilder
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(__CLASS__);
$treeBuilder->getRootNode()
Method execute
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int
{
$databases = $input->getArgument('db') ?? \array_keys($this->config->getDatabases());
if (!\is_array($databases)) {
Method runBlockingServer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function runBlockingServer(SymfonyStyle $io, InputInterface $input, OutputInterface $output): int
{
$callback = null;
$disableOutput = false;
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function addConfiguration(NodeDefinition $node): void
{
$node
->beforeNormalization()
->ifTrue(fn ($v) => null === $v || \is_string($v))
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function addConfiguration(NodeDefinition $node): void
{
$node
->beforeNormalization()
->ifTrue(fn ($v) => null === $v || \is_string($v))
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 117.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method getEntitiesByIds
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEntitiesByIds(string $identifier, array $values): array
{
if (null !== $this->queryBuilder->getMaxResults() || 0 < (int) $this->queryBuilder->getFirstResult()) {
// an offset or a limit would apply on results including the where clause with submitted id values
// that could make invalid choices valid