FileAccessLog   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 18
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 12 1
1
<?php
2
3
namespace Epesi\FileStorage\Models;
4
5
use atk4\data\Model;
6
use Epesi\Core\Data\HasEpesiConnection;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\Data\HasEpesiConnection 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...
7
use Epesi\Core\System\User\Database\Models\atk4\User;
8
9
class FileAccessLog extends Model
10
{
11
    use HasEpesiConnection;
12
    
13
    public $table = 'filestorage_access_log';
14
15
    function init() {
16
    	parent::init();
17
    	
18
    	$this->addFields([
19
    			'file_id',
20
    			'accessed_at' => ['caption' => __('Accessed At'), 'type' => 'datetime'],
21
    			'action' => ['caption' => __('Action'), 'type' => 'enum', 'values' => ['download' => __('Download'), 'preview' => __('Preview'), 'inline' => __('Inline')]],
22
    			'ip_address' => ['caption' => __('IP Address')],
23
    			'host_name' => ['caption' => __('Host Name')]
24
    	]);
25
    	
26
    	$this->hasOne('accessed_by', [User::class, 'our_field' => 'accessed_by'])->addTitle(['field' => 'accessed_by_user', 'caption' => __('Accessed By')]);
0 ignored issues
show
Bug introduced by
The method addTitle() does not exist on atk4\data\Reference. It seems like you code against a sub-type of atk4\data\Reference such as atk4\data\Reference\HasOne_SQL. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
    	$this->hasOne('accessed_by', [User::class, 'our_field' => 'accessed_by'])->/** @scrutinizer ignore-call */ addTitle(['field' => 'accessed_by_user', 'caption' => __('Accessed By')]);
Loading history...
27
    }
28
}