Completed
Push — develop ( e13576...00026f )
by
unknown
16:30 queued 08:33
created

UpdateFilesPermissionsSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 24
rs 10
c 1
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFiles() 0 10 3
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