SummaryFields::placeholder()   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 Uccello\Core\Widgets;
4
5
use Arrilot\Widgets\AbstractWidget;
0 ignored issues
show
Bug introduced by
The type Arrilot\Widgets\AbstractWidget was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class SummaryFields extends AbstractWidget
8
{
9
    /**
10
     * The configuration array.
11
     *
12
     * @var array
13
     */
14
    protected $config = [ ];
15
16
    /**
17
     * The number of seconds before each reload.
18
     *
19
     * @var int|float
20
     */
21
    // public $reloadTimeout = 10;
22
23
    public function placeholder()
24
    {
25
        return 'Loading...';
26
    }
27
28
    /**
29
     * Treat this method as a controller action.
30
     * Return view() or other content to display.
31
     */
32
    public function run()
33
    {
34
        // Get module
35
        $module = ucmodule($this->config['module']);
36
37
        // Get record
38
        $modelClass = $module->model_class;
0 ignored issues
show
Bug introduced by
The property model_class does not seem to exist on Uccello\Core\Models\Module. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
39
        $record = $modelClass::find($this->config['record_id']);
40
41
        return view('uccello::widgets.summary_fields', [
42
            'config' => $this->config,
43
            'domain' => ucdomain($this->config['domain']),
44
            'module' => $module,
45
            'data' => (object) $this->config['data'],
46
            'record' => $record,
47
            'label' => $this->config['data']->label ?? $this->config['labelForTranslation'],
48
        ]);
49
    }
50
}
51