RelationService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUsageByTag() 0 9 1
A getRelatedItemsByRelation() 0 5 1
A getDatabaseConnection() 0 4 1
1
<?php
2
/**
3
 * Relation handler
4
 *
5
 * @author  Tim Lochmüller
6
 */
7
8
namespace HDNET\Tagger\Service;
9
10
use HDNET\Autoloader\SingletonInterface;
11
use HDNET\Tagger\Domain\Model\Tag;
12
use TYPO3\CMS\Core\Database\DatabaseConnection;
13
14
/**
15
 * Relation handler
16
 */
17
class RelationService implements SingletonInterface
18
{
19
20
    /**
21
     * Get usage by Tag
22
     *
23
     * @param Tag $tag
24
     *
25
     * @return array|NULL
26
     */
27
    public function getUsageByTag(Tag $tag)
28
    {
29
        return $this->getDatabaseConnection()
30
            ->exec_SELECTgetRows(
31
                'tablenames AS tableName,uid_foreign AS foreignUid',
32
                'tx_tagger_tag_mm',
33
                'uid_local=' . $tag->getUid()
34
            );
35
    }
36
37
    /**
38
     * Get related items by relation
39
     *
40
     * @param string $tableName
41
     * @param int $id
42
     */
43
    public function getRelatedItemsByRelation($tableName, $id)
44
    {
45
        //
46
47
    }
48
49
    /**
50
     * get database abstraction object
51
     *
52
     * @return DatabaseConnection
53
     */
54
    protected function getDatabaseConnection()
55
    {
56
        return $GLOBALS['TYPO3_DB'];
57
    }
58
}
59