Passed
Push — master ( 3ccf9f...992767 )
by Anton
08:04 queued 06:49
created

Row::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 0
dl 0
loc 3
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link      https://github.com/bluzphp/skeleton
6
 */
7
8
namespace Application\Transactions;
9
10
use Bluz\Db\Exception\RelationNotFoundException;
0 ignored issues
show
Bug introduced by
The type Bluz\Db\Exception\RelationNotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Bluz\Db\Exception\TableNotFoundException;
0 ignored issues
show
Bug introduced by
The type Bluz\Db\Exception\TableNotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
/**
14
 * Class Row for `transactions`
15
 *
16
 * @package  Application\Transactions
17
 *
18
 * @property integer $id
19
 * @property integer $userId
20
 * @property integer $chainUserId
21
 * @property integer $amount
22
 * @property string $type
23
 * @property string $created
24
 * @property string $updated
25
 *
26
 * @author   Anton Shevchuk
27
 * @created  2017-10-19 15:21:59
28
 */
29
class Row extends \Bluz\Db\Row
0 ignored issues
show
Bug introduced by
The type Bluz\Db\Row was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
{
31
    /**
32
     * @return void
33
     */
34
    public function beforeInsert(): void
35
    {
36
    }
37
38
    /**
39
     * @return void
40
     */
41
    public function beforeUpdate(): void
42
    {
43
    }
44
45
    /**
46
     * getUser
47
     *
48
     * @return \Application\Users\Row|null
49
     * @throws RelationNotFoundException
50
     * @throws TableNotFoundException
51
     */
52
    public function getUser(): ?\Application\Users\Row
0 ignored issues
show
Bug introduced by
The type Application\Users\Row was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
53
    {
54
        return $this->getRelation('Users');
55
    }
56
57
    /**
58
     * Get amount as string
59
     *
60
     * @return string
61
     */
62
    public function getAmountString(): string
63
    {
64
        // switch statement for $transaction->type
65
        switch ($this->type) {
66
            case Table::TYPE_CREDIT:
67
                $prefix = '-';
68
                break;
69
            case Table::TYPE_DEBIT:
70
                $prefix = '+';
71
                break;
72
            case Table::TYPE_BLOCK:
73
                $prefix = '<<';
74
                break;
75
            case Table::TYPE_UNBLOCK:
76
                $prefix = '>>';
77
                break;
78
            default:
79
                $prefix = '';
80
                break;
81
        }
82
83
        return $prefix . $this->amount;
84
    }
85
}
86