LoaderFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 6 1
1
<?php
2
/**
3
 * Copyright © Vaimo Group. All rights reserved.
4
 * See LICENSE_VAIMO.txt for license details.
5
 */
6
namespace Vaimo\ComposerChangelogs\Factories\Changelog;
7
8
use Vaimo\ComposerChangelogs\Factories;
9
10
class LoaderFactory
11
{
12
    /**
13
     * @var \Vaimo\ComposerChangelogs\Composer\Context
14
     */
15
    private $composerCtx;
16
17
    /**
18
     * @param \Vaimo\ComposerChangelogs\Composer\Context $composerCtx
19
     */
20
    public function __construct(
21
        \Vaimo\ComposerChangelogs\Composer\Context $composerCtx
22
    ) {
23
        $this->composerCtx = $composerCtx;
24
    }
25
26
    /**
27
     * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
28
     *
29
     * @param bool $fromSource
30
     * @return \Vaimo\ComposerChangelogs\Loaders\ChangelogLoader
31
     * @throws \Exception
32
     */
33
    public function create($fromSource = false)
34
    {
35
        $confResolverFactory = new Factories\Changelog\ConfigResolverFactory($this->composerCtx);
36
37
        return new \Vaimo\ComposerChangelogs\Loaders\ChangelogLoader(
38
            $confResolverFactory->create($fromSource)
39
        );
40
    }
41
}
42