Passed
Pull Request — master (#631)
by ANTHONIUS
08:16
created

ContactImage::setContact()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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\Image;
13
use Core\Entity\ImageMetadata;
14
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
15
16
/**
17
 * @ODM\File(bucketName="cvs.contact.images")
18
 */
19
class ContactImage extends Image
20
{
21
    /**
22
     * @ODM\File\Metadata(targetDocument="Cv\Entity\ContactImageMetadata")
23
     */
24
    protected ?ImageMetadata $metadata = null;
25
26
    /**
27
     * Gets the URI of an image
28
     *
29
     * The returned URI is NOT prepended with the base path!
30
     *
31
     * @return string
32
     */
33
    public function getUri(): string
34 1
    {
35
        return "/file/Cv.ContactImage/" . $this->id . "/" .urlencode($this->name);
0 ignored issues
show
Bug introduced by
It seems like $this->name 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

35
        return "/file/Cv.ContactImage/" . $this->id . "/" .urlencode(/** @scrutinizer ignore-type */ $this->name);
Loading history...
36 1
    }
37
}
38