StatementRepository   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findStatement() 0 4 1
A findStatements() 0 4 1
A storeStatement() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace XApi\Repository\ORM;
13
14
use Doctrine\ORM\EntityRepository;
15
use XApi\Repository\Doctrine\Mapping\Statement;
16
use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as BaseStatementRepository;
17
18
/**
19
 * @author Christian Flothmann <[email protected]>
20
 */
21
final class StatementRepository extends EntityRepository implements BaseStatementRepository
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function findStatement(array $criteria)
27
    {
28
        return parent::findOneBy($criteria);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (findOneBy() instead of findStatement()). Are you sure this is correct? If so, you might want to change this to $this->findOneBy().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function findStatements(array $criteria)
35
    {
36
        return parent::findBy($criteria);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (findBy() instead of findStatements()). Are you sure this is correct? If so, you might want to change this to $this->findBy().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function storeStatement(Statement $mappedStatement, $flush = true)
43
    {
44
        $this->_em->persist($mappedStatement);
45
46
        if ($flush) {
47
            $this->_em->flush();
48
        }
49
    }
50
}
51