Attachment   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 3
dl 0
loc 14
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 3 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
10
namespace Cv\Entity;
11
12
use Core\Entity\File;
13
use Core\Entity\FileTrait;
14
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
15
16
/**
17
 * An Attachment of a CV
18
 *
19
 * @author fedys
20
 * @since 0.26
21
 *
22
 * @ODM\File(bucketName="cvs.attachments")
23
 */
24
class Attachment extends File
25
{
26
    use FileTrait;
27
28
    /**
29
     * Gets the URI of an attachment
30
     *
31
     * The returned URI is NOT prepended with the base path!
32
     *
33 1
     * @return string
34
     */
35 1
    public function getUri(): string
36
    {
37
        return "/file/Cv.Attachment/" . $this->getId() . "/" .urlencode($this->getMetadata()->getName());
0 ignored issues
show
Bug introduced by
It seems like $this->getMetadata()->getName() can also be of type null; however, parameter $string of urlencode() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

37
        return "/file/Cv.Attachment/" . $this->getId() . "/" .urlencode(/** @scrutinizer ignore-type */ $this->getMetadata()->getName());
Loading history...
38
    }
39
}
40