Service   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 21
c 1
b 0
f 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fire() 0 8 1
1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link https://github.com/bluzphp/skeleton
6
 */
7
8
declare(strict_types=1);
9
10
namespace Application\Events;
11
12
/**
13
 * Class Service
14
 *
15
 * @package Application\Events
16
 */
17
class Service
18
{
19
    /**
20
     * Set option value for use it from any application place
21
     *
22
     * @param string $event
23
     * @param string $target
24
     * @param array $data
25
     * @return mixed
26
     * @throws \Bluz\Db\Exception\DbException
27
     * @throws \Bluz\Db\Exception\InvalidPrimaryKeyException
28
     * @throws \Bluz\Db\Exception\TableNotFoundException
29
     */
30
    public static function fire(string $event, string $target, array $data = [])
31
    {
32
        /** @var Row $row */
33
        $row = Table::create();
34
        $row->event = $event;
35
        $row->target = $target;
36
        $row->data = json_encode($data);
37
        return $row->save();
38
    }
39
}
40