Completed
Push — master ( 67250f...887f5e )
by WEBEWEB
01:44
created

IconParser   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseFontAwesomeIcon() 0 18 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
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 WBW\Bundle\CoreBundle\Icon;
13
14
use WBW\Library\Core\Argument\ArrayHelper;
15
16
/**
17
 * Icon parser.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\CoreBundle\Icon
21
 */
22
class IconParser {
23
24
    /**
25
     * Parse a Font Awesome icon.
26
     *
27
     * @param array $args The arguments.
28
     * @return FontAwesomeIconInterface Returns a Fon Awesome icon.
29
     */
30
    public static function parseFontAwesomeIcon(array $args) {
31
32
        // Initialize the icon.
33
        $icon = IconFactory::newFontAwesomeIcon();
34
35
        $icon->setName(ArrayHelper::get($args, "name", "home"));
36
        $icon->setStyle(ArrayHelper::get($args, "style"));
37
38
        $icon->setAnimation(ArrayHelper::get($args, "animation"));
39
        $icon->setBordered(ArrayHelper::get($args, "bordered", false));
40
        $icon->setFixedWidth(ArrayHelper::get($args, "fixedWidth", false));
41
        $icon->setFont(ArrayHelper::get($args, "font"));
42
        $icon->setPull(ArrayHelper::get($args, "pull"));
43
        $icon->setSize(ArrayHelper::get($args, "size"));
44
45
        // Return the icon.
46
        return $icon;
47
    }
48
49
}
50