Passed
Pull Request — develop (#88)
by Felipe
03:48
created

HelperTrait::halt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace PHPPgAdmin;
1 ignored issue
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
trait HelperTrait
1 ignored issue
show
Coding Style introduced by
Missing class doc comment
Loading history...
5
{
6
    public function halt($msg)
1 ignored issue
show
Coding Style introduced by
Missing function doc comment
Loading history...
7
    {
8
        $body = $this->container->responseobj->getBody();
1 ignored issue
show
Bug Best Practice introduced by
The property container does not exist on PHPPgAdmin\HelperTrait. Did you maybe forget to declare it?
Loading history...
9
        $body->write($msg);
10
        throw new \Slim\Exception\SlimException($this->container->requestobj, $this->container->responseobj);
11
    }
12
13
    /**
14
     * Receives N parameters and sends them to the console adding where was it called from
15
     * @return [type] [description]
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
16
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment [type] at position 0 could not be parsed: Unknown type name '[' at position 0 in [type].
Loading history...
17
    public function prtrace()
18
    {
19
        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
20
21
        $btarray0 = ([
22
            'class0'    => $backtrace[3]['class'],
23
            'type0'     => $backtrace[3]['type'],
24
            'function0' => $backtrace[3]['function'],
25
            'spacer0'   => ' ',
26
            'line0'     => $backtrace[2]['line'],
27
28
            'spacer1'   => "\n",
29
30
            'class1'    => $backtrace[2]['class'],
31
            'type1'     => $backtrace[2]['type'],
32
            'function1' => $backtrace[2]['function'],
33
            'spacer2'   => ' ',
34
            'line1'     => $backtrace[1]['line'],
35
36
            'spacer3'   => "\n",
37
38
            'class2'    => $backtrace[1]['class'],
39
            'type2'     => $backtrace[1]['type'],
40
            'function2' => $backtrace[1]['function'],
41
            'spacer4'   => ' ',
42
            'line2'     => $backtrace[0]['line'],
43
        ]);
44
45
        $tag = implode('', $btarray0);
46
47
        \PC::debug(func_get_args(), $tag);
48
    }
49
50
    public static function statictrace()
1 ignored issue
show
Coding Style introduced by
Missing function doc comment
Loading history...
51
    {
52
        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
53
54
        $btarray0 = ([
55
            'class'    => $backtrace[1]['class'],
56
            'type'     => $backtrace[1]['type'],
57
            'function' => $backtrace[1]['function'],
58
            'spacer'   => ' ',
59
            'line'     => $backtrace[0]['line'],
60
        ]);
61
62
        $tag = implode('', $btarray0);
63
64
        \PC::debug(func_get_args(), $tag);
65
    }
66
67
    /**
68
     * Returns a string with html <br> variant replaced with a new line
69
     * @param  string $msg [description]
1 ignored issue
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
70
     * @return string      [description]
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
71
     */
72
    public static function br2ln(string $msg)
73
    {
74
        return str_replace(['<br>', '<br/>', '<br />'], "\n", $msg);
75
    }
76
}
77