Completed
Pull Request — master (#6)
by Tomáš
08:03
created

AbstractSimpleBundle   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 38
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 14 4
A getServicesFile() 0 3 1
A getConfiguration() 0 3 1
A getParametersAliases() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Symplify
5
 * Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
6
 */
7
8
namespace Symplify\SimpleBundle;
9
10
use Symfony\Component\Config\Definition\ConfigurationInterface;
11
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
12
use Symfony\Component\HttpKernel\Bundle\Bundle;
13
use Symplify\SimpleBundle\DependencyInjection\Extension\ServicesAndConfigurationAwareExtension;
14
15
abstract class AbstractSimpleBundle extends Bundle
16
{
17
    public function getContainerExtension() : ExtensionInterface
18
    {
19
        $extension = new ServicesAndConfigurationAwareExtension();
20
        if ($this->getServicesFile()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->getServicesFile() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
21
            $extension->setServicesFilePath($this->getServicesFile());
22
        }
23
        if ($this->getConfiguration()) {
24
            $extension->setConfiguration($this->getConfiguration());
25
        }
26
        if ($this->getParametersAliases()) {
27
            $extension->setParametersAliases($this->getParametersAliases());
28
        }
29
        return $extension;
30
    }
31
32
    /**
33
     * @return string|null
34
     */
35
    protected function getServicesFile()
36
    {
37
    }
38
39
    /**
40
     * @return ConfigurationInterface|null
41
     */
42
    protected function getConfiguration()
43
    {
44
    }
45
46
    /***
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
47
     * @return string[]|null
48
     */
49
    protected function getParametersAliases()
50
    {
51
    }
52
}
53