CheckoutConfigProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
/**
3
 * Copyright © 2021 O2TI. All rights reserved.
4
 *
5
 * @author  Bruno Elisei <[email protected]>
6
 * See LICENSE.txt for license details.
7
 */
8
9
namespace O2TI\ThemeFullCheckout\ConfigProvider;
10
11
use Magento\Checkout\Model\ConfigProviderInterface;
12
use Magento\Theme\Block\Html\Header\Logo;
13
use O2TI\ThemeFullCheckout\Helper\Config;
14
15
/**
16
 * Checkout Config Provider Full Checkout Compoments.
17
 */
18
class CheckoutConfigProvider implements ConfigProviderInterface
19
{
20
    /**
21
     * @var Config
22
     */
23
    private $config;
24
25
    /**
26
     * @var Logo
27
     */
28
    private $logo;
29
30
    /**
31
     * @param Logo   $logo
32
     * @param Config $config
33
     */
34
    public function __construct(
35
        Logo $logo,
36
        Config $config
37
    ) {
38
        $this->logo = $logo;
39
        $this->config = $config;
40
    }
41
42
    /**
43
     * Get Config to Checkout Config.
44
     *
45
     * @return array
46
     */
47
    public function getConfig(): array
48
    {
49
        return [
50
            'theme_full_checkout_enable'    => $this->config->isEnabled(),
51
            'move_address_billing'          => $this->config->isMoveAddressBilling(),
52
            'logo_src'                      => $this->logo->getLogoSrc(),
53
            'logo_width'                    => $this->logo->getLogoWidth(),
54
            'logo_height'                   => $this->logo->getLogoHeight(),
55
            'logo_alt'                      => $this->logo->getLogoAlt(),
56
        ];
57
    }
58
}
59