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

PaymentIntentConfirm   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 89.29 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 25 25 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\PaymentIntent\PaymentIntent;
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
class PaymentIntentConfirm 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('off_session')
26
                    ->info('Set to true to indicate that the customer is not in your checkout flow during this payment attempt, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later.')
27
                ->end()
28
                ->scalarNode('payment_method')
29
                    ->info('ID of the payment method (a PaymentMethod, Card, BankAccount, or saved Source object) to attach to this PaymentIntent.')
30
                ->end()
31
                ->booleanNode('save_payment_method')
32
                    ->info('If the PaymentIntent has a payment_method and a customer or if you’re attaching a payment method to the PaymentIntent in this request, you can pass save_payment_method=true to save the payment method to the customer. Defaults to false. If the payment method is already saved to a customer, this does nothing. If this type of payment method cannot be saved to a customer, the request will error.')
33
                ->end()
34
                ->enumNode('setup_future_usage')
35
                    ->values(['on_session', 'off_session'])
36
                    ->info('Indicates that you intend to make future payments with this PaymentIntent’s payment method.')
37
                ->end()
38
            ->end()
39
        ;
40
41
        return $treeBuilder;
42
    }
43
}
44