Completed
Push — master ( 7cff7c...eface1 )
by Olivier
04:30
created

TaxRateCreate   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 40
loc 40
ccs 0
cts 31
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 37 37 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Configuration;
11
12
use Shapin\Stripe\Model\TaxRate\TaxRate;
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16 View Code Duplication
class TaxRateCreate implements ConfigurationInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    public function getConfigTreeBuilder()
19
    {
20
        $treeBuilder = new TreeBuilder('shapin_stripe');
21
        $rootNode = $treeBuilder->getRootNode();
22
23
        $rootNode
24
            ->children()
25
                ->scalarNode('display_name')
26
                    ->isRequired()
27
                    ->info('The display name of the tax rate, which will be shown to users.')
28
                ->end()
29
                ->booleanNode('inclusive')
30
                    ->isRequired()
31
                    ->info('This specifies if the tax rate is inclusive or exclusive.')
32
                ->end()
33
                ->floatNode('percentage')
34
                    ->isRequired()
35
                    ->info('This represents the tax rate percent out of 100.')
36
                ->end()
37
                ->booleanNode('active')
38
                    ->info('Flag determining whether the tax rate is active or inactive. Inactive tax rates continue to work where they are currently applied however they cannot be used for new applications.')
39
                ->end()
40
                ->scalarNode('description')
41
                    ->info('An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.')
42
                ->end()
43
                ->scalarNode('jurisdiction')
44
                    ->info('The jurisdiction for the tax rate.')
45
                ->end()
46
                ->arrayNode('metadata')
47
                    ->scalarPrototype()->end()
48
                    ->info('Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.')
49
                ->end()
50
            ->end()
51
        ;
52
53
        return $treeBuilder;
54
    }
55
}
56