FileUpload   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 42
ccs 21
cts 21
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 14 1
A queueTemplate() 0 14 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\Former\Fields;
13
14
use Former\Form\Fields;
15
16
/**
17
 * FileUpload is a Former field class to generate a file field for Jquery File Upload plugin.
18
 *
19
 * @author Mohamed Alsharaf <[email protected]>
20
 */
21
class FileUpload extends Fields\File
22
{
23
    /**
24
     * Render form field.
25
     *
26
     * @return string
27
     */
28 13
    public function render()
29
    {
30 13
        $this->setType('file');
31
32 13
        $output = '';
33 13
        $output .= '<span class="btn btn-info fileinput-button">';
34 13
        $output .= '<i class="glyphicon glyphicon-plus"></i><span>' . trans('tinyissue.add_files') . '</span>';
35 13
        $output .= parent::render();
36 13
        $output .= '</span>';
37 13
        $output .= '<ul role="presentation" id="' . $this->name . '-queue" class="' . $this->name . '-queue"></ul>';
38 13
        $output .= '<ul id="' . $this->name . '-template" class="hidden">' . $this->queueTemplate() . '</ul>';
39
40 13
        return $output;
41
    }
42
43
    /**
44
     * Render the upload queue row.
45
     *
46
     * @return string
47
     */
48 13
    protected function queueTemplate()
49
    {
50 13
        $output = '<li class="queue-item">';
51 13
        $output .= '<button type="button" class="close" aria-label="' . trans('tinyissue . cancel') . '" data-message="' . trans('tinyissue . delete_upload_file') . '">';
52 13
        $output .= '<span aria-hidden="true">&times;</span>';
53 13
        $output .= '</button>';
54 13
        $output .= '<div class="name"><span></span><strong class="status text-danger"></strong></div>';
55 13
        $output .= '<div class="progress progress-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">';
56 13
        $output .= '<div class="progress-bar progress-bar-success" style="width:0;"></div>';
57 13
        $output .= '</div>';
58 13
        $output .= '</li>';
59
60 13
        return $output;
61
    }
62
}
63