Image   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 6
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 44
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A input() 0 15 2
A show() 0 19 3
1
<?php namespace Mascame\Artificer\Fields\Types;
2
3
use Form;
4
use Str;
5
6
class Image extends File
7
{
8
9
    public function boot()
10
    {
11
//		$this->addWidget(new FocalPoint());
12
    }
13
14
    public function input()
15
    {
16
        if ($this->value != null) {
17
            ?>
18
            <div data-box class="focal_box">
19
                <?= $this->show() ?>
20
                <div data-point class="focal_point"></div>
21
            </div>
22
23
            <div data-position class="focal_position"></div>
24
        <?php
25
        }
26
27
        print Form::file($this->name);
0 ignored issues
show
Bug introduced by
The method file() does not seem to exist on object<form>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
    }
29
30
    public function show()
31
    {
32
        $value = $this->value;
33
34
        if (!$value) {
35
            return '<div class="well well-sm">No file</div>';
36
        }
37
38
        if (!Str::startsWith($value, array('https://', 'http://'))) {
39
            $value = '/uploads/' . $value;
40
        }
41
        ?>
42
43
        <div class="thumbnail">
44
            <img style="display: block; margin: auto;height:auto; width:auto; max-width:100px; max-height:100px;"
45
                 src="<?= $value ?>" height="100"/>
46
        </div>
47
    <?php
48
    }
49
}