MagentoLogger   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 46
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A start() 0 7 1
A stop() 0 12 1
A getCalls() 0 4 1
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
}