GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 1be80f...2cb972 )
by Christian
06:56
created

Core23LastFmExtension::configureApi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\LastFmBundle\DependencyInjection;
13
14
use Symfony\Component\Config\FileLocator;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Loader;
17
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
18
19
final class Core23LastFmExtension extends Extension
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getAlias()
25
    {
26
        return 'core23_lastfm';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function load(array $configs, ContainerBuilder $container): void
33
    {
34
        $configuration = new Configuration();
35
        $config        = $this->processConfiguration($configuration, $configs);
36
37
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
38
        $loader->load('action.xml');
39
        $loader->load('services.xml');
40
41
        $this->configureApi($container, $config);
42
        $this->configureHttpClient($container, $config);
43
    }
44
45
    /**
46
     * @param ContainerBuilder $container
47
     * @param array            $config
48
     */
49
    private function configureApi(ContainerBuilder $container, array $config): void
50
    {
51
        $container->setParameter('core23_lastfm.api.app_id', $config['api']['app_id']);
52
        $container->setParameter('core23_lastfm.api.shared_secret', $config['api']['shared_secret']);
53
        $container->setParameter('core23_lastfm.api.endpoint', $config['api']['endpoint']);
54
        $container->setParameter('core23_lastfm.api.auth_url', $config['api']['auth_url']);
55
    }
56
57
    /**
58
     * @param ContainerBuilder $container
59
     * @param array            $config
60
     */
61
    private function configureHttpClient(ContainerBuilder $container, array $config): void
62
    {
63
        $container->setAlias('core23_lastfm.http.client', $config['http']['client']);
64
        $container->setAlias('core23_lastfm.http.message_factory', $config['http']['message_factory']);
65
    }
66
}
67