NamedEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A execute() 0 4 1
A getName() 0 4 1
1
<?php
2
/**
3
 * NextFlow (http://github.com/nextflow)
4
 *
5
 * @link http://github.com/nextflow/nextflow-php for the canonical source repository
6
 * @copyright Copyright (c) 2014-2016 NextFlow (http://github.com/nextflow)
7
 * @license https://raw.github.com/nextflow/nextflow-php/master/LICENSE MIT
8
 */
9
10
namespace NextFlow\Core\Event;
11
12
/**
13
 * A simple implementation of an event with a name.
14
 */
15
final class NamedEvent extends AbstractEvent
16
{
17
    /** The output socket. */
18
    const SOCKET_OUT = 'out';
19
20
    /**
21
     * Initializes a new instance of this class.
22
     */
23
    public function __construct($name)
24
    {
25
        parent::__construct();
26
27
        $this->createSocket(self::SOCKET_OUT);
28
29
        $this->setParam('name', $name);
30
    }
31
32
    /**
33
     * Executes the node's logic.
34
     *
35
     * @return NodeInterface
36
     */
37
    public function execute()
38
    {
39
        $this->activate(self::SOCKET_OUT);
40
    }
41
42
    /**
43
     * Gets the name of the event.
44
     *
45
     * @return string
46
     */
47
    public function getName()
48
    {
49
        return $this->getParam('name');
50
    }
51
}
52