Completed
Pull Request — master (#6)
by Tomáš
05:26
created

AbstractSimpleBundle::getContainerExtension()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 14
cp 0
rs 9.2
c 0
b 0
f 0
cc 4
eloc 9
nc 8
nop 0
crap 20
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
30
        return $extension;
31
    }
32
33
    /**
34
     * @return string|null
35
     */
36
    protected function getServicesFile()
37
    {
38
    }
39
40
    /**
41
     * @return ConfigurationInterface|null
42
     */
43
    protected function getConfiguration()
44
    {
45
    }
46
47
    /***
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...
48
     * @return string[]|null
49
     */
50
    protected function getParametersAliases()
51
    {
52
    }
53
}
54