Test Failed
Push — master ( 4d9b91...c71310 )
by Julien
06:31
created

Profiler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 47.06%

Importance

Changes 0
Metric Value
eloc 16
c 0
b 0
f 0
dl 0
loc 23
ccs 8
cts 17
cp 0.4706
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 21 3
1
<?php
2
3
/**
4
 * This file is part of the Zemit Framework.
5
 *
6
 * (c) Zemit Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zemit\Db;
13
14
/**
15
 * {@inheritdoc}
16
 */
17
class Profiler extends \Phalcon\Db\Profiler
18
{
19 2
    public function toArray(): array
20
    {
21 2
        $profiles = [];
22 2
        $profilerProfiles = $this->getProfiles();
23 2
        if (!empty($profilerProfiles)) {
24
            foreach ($profilerProfiles as $profile) {
25
                $profiles [] = [
26
                    'sqlStatement' => $profile->getSqlStatement(),
27
                    'sqlVariables' => $profile->getSqlVariables(),
28
                    'sqlBindTypes' => $profile->getSqlBindTypes(),
29
                    'initialTime' => $profile->getInitialTime(),
30
                    'finalTime' => $profile->getFinalTime(),
31
                    'elapsedSeconds' => $profile->getTotalElapsedSeconds() / 1000000000,
32
                ];
33
            }
34
        }
35
36 2
        return [
37 2
            'profiles' => $profiles,
38 2
            'numberTotalStatements' => $this->getNumberTotalStatements(),
39 2
            'totalElapsedSeconds' => $this->getTotalElapsedSeconds() / 1000000000,
40 2
        ];
41
    }
42
}
43