TagFormFields::fields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Services;
4
5
class TagFormFields
6
{
7
    /**
8
     * List of fields and default value for each field.
9
     *
10
     * @var array
11
     */
12
    private static $_fieldList = [
13
        'tag'               => '',
14
        'title'             => '',
15
        'subtitle'          => '',
16
        'meta_description'  => '',
17
        'post_image'        => '',
18
        'layout'            => 'blog.roll-layouts.home',
19
        'reverse_direction' => 0,
20
    ];
21
22
    /**
23
     * Get the tag form fields data.
24
     *
25
     * @return array
26
     */
27
    public static function fields()
28
    {
29
        return self::$_fieldList;
30
    }
31
32
    /**
33
     * Get data needed for tag forms.
34
     *
35
     * @param App/Models/Tag $tag
0 ignored issues
show
Documentation Bug introduced by
The doc comment App/Models/Tag at position 0 could not be parsed: Unknown type name 'App/Models/Tag' at position 0 in App/Models/Tag.
Loading history...
36
     *
37
     * @return array
38
     */
39
    public static function formData($tag = null)
40
    {
41
        $data = self::fields();
42
        if ($tag) {
43
            $data = $tag->toArray();
44
        }
45
        $postTemplates = PostTemplates::list('roll');
46
        $data['postTemplates'] = $postTemplates;
47
48
        return $data;
49
    }
50
}
51