Passed
Push — master ( 61f3a0...6b4c98 )
by Alexander
01:39
created

ArrayTarget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
namespace Yiisoft\Log\Tests;
4
5
use Yiisoft\Log\Target;
6
7
/**
8
 * ArrayTarget logs messages into an array, useful for tracking data in tests.
9
 */
10
class ArrayTarget extends Target
11
{
12
    public function __construct()
13
    {
14
        $this->setExportInterval(1000000);
15
    }
16
17
    /**
18
     * Exports log [[messages]] to a specific destination.
19
     */
20
    public function export(): void
21
    {
22
        // throw exception if message limit is reached
23
        throw new \Exception('More than 1000000 messages logged.');
24
    }
25
}
26