Completed
Push — master ( 91f8d9...64265e )
by Mohamed
09:45 queued 06:57
created

ExportIssues   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 3 Features 1
Metric Value
wmc 3
c 6
b 3
f 1
lcom 0
cbo 1
dl 0
loc 55
ccs 18
cts 18
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A openType() 0 4 1
A actions() 0 10 1
B fields() 0 27 1
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[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 Tinyissue\Form;
13
14
use Tinyissue\Services\Exporter;
15
16
/**
17
 * ExportIssues is a class to defines fields & rules for project issues export form.
18
 *
19
 * @author Mohamed Alsharaf <[email protected]>
20
 */
21
class ExportIssues extends FilterIssue
22
{
23
    /**
24
     * @return array
25
     */
26 29
    public function actions()
27
    {
28
        return [
29
            'export-issue' => [
30
                'name'  => 'export-issue',
31
                'label' => 'export',
32
                'type'  => 'info_submit',
33 29
            ],
34
        ];
35
    }
36
37
    /**
38
     * @return array
39
     */
40 29
    public function fields()
41
    {
42 29
        $fields = parent::fields();
43
44
        // Remove sort fields
45 29
        unset($fields['sort']);
46
47
        // Remove extra group class
48 29
        $fields = array_map(function ($field) {
49 29
            unset($field['onGroupAddClass']);
50
51 29
            return $field;
52 29
        }, $fields);
53
54
        // Add extra fields
55 29
        $fields['format'] = [
56 29
            'type'        => 'select',
57 29
            'placeholder' => trans('tinyissue.export_format'),
58
            'options'     => [
59 29
                Exporter::TYPE_XLS  => trans('tinyissue.xls'),
60 29
                Exporter::TYPE_XLSX => trans('tinyissue.xlsx'),
61 29
                Exporter::TYPE_CSV  => trans('tinyissue.csv'),
62
            ],
63
        ];
64
65 29
        return $fields;
66
    }
67
68
    /**
69
     * @return string
70
     */
71 29
    public function openType()
72
    {
73 29
        return 'open';
74
    }
75
}
76