CollectionHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A write() 0 4 1
A getRecords() 0 4 1
A clearRecords() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchBundle\Profiler\Handler;
13
14
use Monolog\Handler\AbstractProcessingHandler;
15
16
/**
17
 * Handler that saves all records to him self.
18
 */
19
class CollectionHandler extends AbstractProcessingHandler
20
{
21
    /**
22
     * @var array
23
     */
24
    private $records = [];
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function write(array $record)
30
    {
31
        $this->records[] = $record;
32
    }
33
34
    /**
35
     * Returns recorded data.
36
     *
37
     * @return array
38
     */
39
    public function getRecords()
40
    {
41
        return $this->records;
42
    }
43
44
    /**
45
     * Clears recorded data.
46
     */
47
    public function clearRecords()
48
    {
49
        $this->records = [];
50
    }
51
}
52