Completed
Push — develop ( e13576...00026f )
by
unknown
08:31
created

UpdateFilesPermissionsSubscriber::getFiles()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 10
rs 9.4285
c 1
b 0
f 1
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
/**  */
11
namespace Cv\Repository\Event;
12
13
14
use Core\Repository\DoctrineMongoODM\Event\AbstractUpdateFilesPermissionsSubscriber;
15
use Cv\Entity\Cv;
16
17
/**
18
 * class for updating file permissions
19
 *
20
 * @author Mathias Gelhausen <[email protected]>
21
 * @since 0.26
22
 */
23
class UpdateFilesPermissionsSubscriber extends AbstractUpdateFilesPermissionsSubscriber
24
{
25
    protected $targetDocument = Cv::class;
26
27
    protected $filesProperties = [ 'attachments' ];
28
29
    /**
30
     *
31
     *
32
     * @param \Cv\Entity\Cv $document
33
     *
34
     * @return array|\Core\Entity\PermissionsAwareInterface[]
35
     */
36
    protected function getFiles($document)
37
    {
38
        $files = parent::getFiles($document);
39
40
        if ($document->notEmpty('contact') && ($image = $document->getContact()->getImage())) {
41
            $files[] = $image;
42
        }
43
44
        return $files;
45
    }
46
}
47