MagentoLogger::stop()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 5
1
<?php
2
3
/**
4
 * @project Magento Bridge for Symfony 2.
5
 *
6
 * @author  Sébastien MALOT <[email protected]>
7
 * @license MIT
8
 * @url     <https://github.com/smalot/magento-bundle>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Smalot\MagentoBundle\Logger;
15
16
/**
17
 * Class MagentoLogger
18
 *
19
 * @package Smalot\MagentoBundle\Logger
20
 */
21
class MagentoLogger implements LoggerInterface
22
{
23
    /**
24
     * @var array
25
     */
26
    protected $calls = array();
27
28
    /**
29
     * @return int
30
     */
31
    public function start()
32
    {
33
        $currentCall               = count($this->calls);
34
        $this->calls[$currentCall] = array('time' => microtime(true));
35
36
        return $currentCall;
37
    }
38
39
    /**
40
     * @param int    $logNumber
41
     * @param string $connection
42
     * @param string $type
43
     * @param string $output
44
     * @param bool   $onError
45
     */
46
    public function stop($logNumber, $connection, $type, $output = '', $onError = false)
47
    {
48
        $time = microtime(true) - $this->calls[$logNumber]['time'];
49
50
        $this->calls[$logNumber] = array(
51
          'connection' => $connection,
52
          'type'       => $type,
53
          'error'      => $onError,
54
          'output'     => $output,
55
          'time'       => $time,
56
        );
57
    }
58
59
    /**
60
     * @return array
61
     */
62
    public function getCalls()
63
    {
64
        return $this->calls;
65
    }
66
}