BaseTwitterButtonBlockService::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\SeoBundle\Block\Social;
15
16
use Sonata\BlockBundle\Block\BlockContextInterface;
17
use Sonata\BlockBundle\Block\Service\AbstractBlockService;
18
use Symfony\Component\HttpFoundation\Response;
19
20
/**
21
 * Abstract class for Twitter Buttons blocks services.
22
 *
23
 * @author Sylvain Deloux <[email protected]>
24
 */
25
abstract class BaseTwitterButtonBlockService extends AbstractBlockService
26
{
27
    /**
28
     * @var string[]
29
     */
30
    protected $languageList = [
31
        'fr' => 'fr',
32
        'en' => 'en',
33
        'ar' => 'ar',
34
        'ja' => 'ja',
35
        'es' => 'es',
36
        'de' => 'de',
37
        'it' => 'it',
38
        'id' => 'id',
39
        'pt' => 'pt',
40
        'ko' => 'ko',
41
        'tr' => 'tr',
42
        'ru' => 'ru',
43
        'nl' => 'nl',
44
        'fil' => 'fil',
45
        'msa' => 'msa',
46
        'zh-tw' => 'zh-tw',
47
        'zh-cn' => 'zh-cn',
48
        'hi' => 'hi',
49
        'no' => 'no',
50
        'sv' => 'sv',
51
        'fi' => 'fi',
52
        'da' => 'da',
53
        'pl' => 'pl',
54
        'hu' => 'hu',
55
        'fa' => 'fa',
56
        'he' => 'he',
57
        'ur' => 'ur',
58
        'th' => 'th',
59
        'uk' => 'uk',
60
        'ca' => 'ca',
61
        'el' => 'el',
62
        'eu' => 'eu',
63
        'cs' => 'cs',
64
        'af' => 'af',
65
        'xx-lc' => 'xx-lc',
66
        'gl' => 'gl',
67
        'ro' => 'ro',
68
        'hr' => 'hr',
69
        'ckb' => 'ckb',
70
        'en-gb' => 'en-gb',
71
    ];
72
73
    public function execute(BlockContextInterface $blockContext, ?Response $response = null): Response
74
    {
75
        $settings = $blockContext->getSettings();
76
77
        return $this->renderResponse($blockContext->getTemplate(), [
78
            'block' => $blockContext->getBlock(),
79
            'settings' => $settings,
80
        ], $response);
81
    }
82
}
83