Completed
Pull Request — develop (#236)
by ANTHONIUS
09:12
created

Cv::getPaginatorCursor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Cv\Repository;
4
5
use Zend\ServiceManager\ServiceLocatorInterface;
6
use Core\Repository\AbstractRepository;
7
use Auth\Entity\UserInterface;
8
9
/**
10
 * class for accessing CVs
11
 */
12
class Cv extends AbstractRepository
13
{
14
    /**
15
     * Look for an drafted Document of a given user
16
     *
17
     * @param $user
18
     * @return \Cv\Entity\Cv|null
0 ignored issues
show
Documentation introduced by
Should the return type not be object|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
19
     */
20 View Code Duplication
    public function findDraft($user)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    {
22
        if ($user instanceof UserInterface) {
23
            $user = $user->getId();
24
        }
25
26
        $document = $this->findOneBy(
27
            array(
28
                'isDraft' => true,
29
                'user' => $user
30
            )
31
        );
32
33
        if (!empty($document)) {
34
            return $document;
35
        }
36
37
        return null;
38
    }
39
}
40