TrelloManagement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Publisher;
4
5
/**
6
 * Class TrelloManagement
7
 */
8
class TrelloManagement
9
{
10
    private $xoopsDb;
11
12
    /**
13
     * TrelloManagement constructor.
14
     * @param $xoopsDb
15
     */
16
    public function __construct($xoopsDb)
17
    {
18
        $this->xoopsDb = $xoopsDb;
19
    }
20
21
    /**
22
     * @param $statusId
23
     * @param $itemId
24
     * @return mixed
25
     */
26
    public function getProjectTaskByStatus($statusId, $itemId)
27
    {
28
        $helper   = Helper::getInstance();
29
        $dbHandle = new TrelloDBController($this->xoopsDb);
30
        $query    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . 'WHERE status= ? AND itemid = ?';
31
        $result   = $dbHandle->runQuery($query, 'ii', [$statusId, $itemId]);
32
33
        return $result;
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39
    public function getAllStatus()
40
    {
41
        $helper   = Helper::getInstance();
42
        $dbHandle = new TrelloDBController($this->xoopsDb);
43
        $query    = 'SELECT itemid, title, status FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items');
44
        $result   = $dbHandle->runBaseQuery($query);
45
46
        return $result;
47
    }
48
49
    /**
50
     * @param $statusId
51
     * @param $itemId
52
     */
53
    public function editTaskStatus($statusId, $itemId)
54
    {
55
        $helper   = Helper::getInstance();
56
        $dbHandle = new TrelloDBController($this->xoopsDb);
57
        $query    = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . ' SET status = ? WHERE itemid = ?';
58
        $result   = $dbHandle->update($query, 'ii', [$statusId, $itemId]);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $dbHandle->update($query...ay($statusId, $itemId)) targeting XoopsModules\Publisher\T...oDBController::update() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
59
60
        return $result;
61
    }
62
}
63