Completed
Push — master ( abb491...352f9f )
by Olivier
01:38
created

InvoicePay   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 90 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 27
loc 30
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 27 27 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\Invoice\Invoice;
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
class InvoicePay implements ConfigurationInterface
17
{
18 View Code Duplication
    public function getConfigTreeBuilder()
0 ignored issues
show
Duplication introduced by
This method 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...
19
    {
20
        $treeBuilder = new TreeBuilder('shapin_stripe');
21
        $rootNode = $treeBuilder->getRootNode();
22
23
        $rootNode
24
            ->children()
25
                ->booleanNode('forgive')
26
                    ->info('In cases where the source used to pay the invoice has insufficient funds, passing forgive=true controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. This effectively forgives the difference between the amount available on the source and the amount due. Passing forgive=false will fail the charge if the source hasn’t been pre-funded with the right amount. An example for this case is with ACH Credit Transfers and wires: if the amount wired is less than the amount due by a small amount, you might want to forgive the difference.')
27
                ->end()
28
                ->booleanNode('off_session')
29
                    ->info('Indicates if a customer is on or off-session while an invoice payment is attempted.')
30
                ->end()
31
                ->booleanNode('paid_out_of_band')
32
                    ->info('Boolean representing whether an invoice is paid outside of Stripe. This will result in no charge being made.')
33
                ->end()
34
                ->scalarNode('payment_method')
35
                    ->info('A PaymentMethod to be charged. The PaymentMethod must be the ID of a PaymentMethod belonging to the customer associated with the invoice being paid.')
36
                ->end()
37
                ->scalarNode('source')
38
                    ->info('A payment source to be charged. The source must be the ID of a source belonging to the customer associated with the invoice being paid.')
39
                ->end()
40
            ->end()
41
        ;
42
43
        return $treeBuilder;
44
    }
45
}
46