UploadDirectory::getUploadDirectory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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