Code Duplication    Length = 26-26 lines in 2 locations

Model/Ui/ConfigProviderCc.php 1 location

@@ 118-143 (lines=26) @@
115
     *
116
     * @return array
117
     */
118
    public function getIcons()
119
    {
120
        if (!empty($this->icons)) {
121
            return $this->icons;
122
        }
123
        $storeId = $this->cart->getStoreId();
124
        $ccTypes = $this->config->getCcAvailableTypes($storeId);
125
        $types = explode(',', $ccTypes);
126
        foreach ($types as $code => $label) {
127
            if (!array_key_exists($code, $this->icons)) {
128
                $asset = $this->ccConfig->createAsset('Moip_Magento2::images/cc/'.strtolower($label).'.svg');
129
                $placeholder = $this->assetSource->findSource($asset);
130
                if ($placeholder) {
131
                    list($width, $height) = getimagesizefromstring($asset->getSourceFile());
132
                    $this->icons[$label] = [
133
                        'url'    => $asset->getUrl(),
134
                        'width'  => $width,
135
                        'height' => $height,
136
                        'title'  => __($label),
137
                    ];
138
                }
139
            }
140
        }
141
142
        return $this->icons;
143
    }
144
145
    /**
146
     * Get Cvv.

Model/Ui/Vault/ConfigProvider.php 1 location

@@ 99-124 (lines=26) @@
96
     *
97
     * @return array
98
     */
99
    public function getIcons()
100
    {
101
        if (!empty($this->icons)) {
102
            return $this->icons;
103
        }
104
        $storeId = $this->cart->getStoreId();
105
        $ccTypes = $this->configCc->getCcAvailableTypes($storeId);
106
        $types = explode(',', $ccTypes);
107
        foreach ($types as $code => $label) {
108
            if (!array_key_exists($code, $this->icons)) {
109
                $asset = $this->ccConfig->createAsset('Moip_Magento2::images/cc/'.strtolower($label).'.svg');
110
                $placeholder = $this->assetSource->findSource($asset);
111
                if ($placeholder) {
112
                    list($width, $height) = getimagesizefromstring($asset->getSourceFile());
113
                    $this->icons[$label] = [
114
                        'url'    => $asset->getUrl(),
115
                        'width'  => $width,
116
                        'height' => $height,
117
                        'title'  => __($label),
118
                    ];
119
                }
120
            }
121
        }
122
123
        return $this->icons;
124
    }
125
}
126