Passed
Push — master ( 34ef5e...ffe1e4 )
by Marcel
08:33
created

DataloadMapper::getDataloadById()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
/**
3
 * Data Analytics
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the LICENSE.md file.
7
 *
8
 * @author Marcel Scherello <[email protected]>
9
 * @copyright 2019 Marcel Scherello
10
 */
11
12
namespace OCA\Analytics\Db;
13
14
use OCP\IDbConnection;
15
use OCP\IL10N;
16
use OCP\ILogger;
17
18
class DataloadMapper
19
{
20
    private $userId;
21
    private $l10n;
22
    private $db;
23
    private $logger;
24
25
    public function __construct(
26
        $userId,
27
        IL10N $l10n,
28
        IDbConnection $db,
29
        ILogger $logger
30
    )
31
    {
32
        $this->userId = $userId;
33
        $this->l10n = $l10n;
34
        $this->db = $db;
35
        $this->logger = $logger;
36
    }
37
38
    /**
39
     * get Dataload by id
40
     * @param int $dataloadId
41
     * @return array
42
     */
43
    public function getDataloadById(int $dataloadId)
44
    {
45
        $SQL = 'SELECT * FROM `*PREFIX*analytics_dataload` WHERE `id` = ?';
46
        $stmt = $this->db->prepare($SQL);
47
        $stmt->execute(array($dataloadId));
48
        return $stmt->fetch();
49
    }
50
51
}
52