UploadDirectory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUploadDirectory() 0 3 1
1
<?php
2
3
namespace Sfneal\Models\Traits;
4
5
trait UploadDirectory
6
{
7
    /**
8
     * Get the AWS S3 file upload directory for an Inquiry model by retrieving the table name and primary key.
9
     *
10
     * @param  string  $base_dir
11
     * @return string
12
     */
13
    public function getUploadDirectory($base_dir = 'files'): string
14
    {
15
        return $base_dir.'/'.str_replace('_', '-', $this->getTable()).'/'.$this->getKey();
0 ignored issues
show
Bug introduced by
It seems like getTable() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

15
        return $base_dir.'/'.str_replace('_', '-', $this->/** @scrutinizer ignore-call */ getTable()).'/'.$this->getKey();
Loading history...
Bug introduced by
It seems like getKey() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

15
        return $base_dir.'/'.str_replace('_', '-', $this->getTable()).'/'.$this->/** @scrutinizer ignore-call */ getKey();
Loading history...
16
    }
17
}
18