PrintRAction::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
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\Php\Action;
11
12
use NextFlow\Core\Action\AbstractAction;
13
14
/**
15
 * An action that var_dumps the bound value.
16
 */
17 View Code Duplication
final class PrintRAction extends AbstractAction
18
{
19
    /** The constant that defines the output socket. */
20
    const SOCKET_OUTPUT = 'out';
21
22
    /** The socket that holds the data variable. */
23
    const SOCKET_DATA = 'data';
24
25
    /**
26
     * Initializes a new instance of this class.
27
     */
28
    public function __construct()
29
    {
30
        parent::__construct();
31
32
        $this->createSocket(self::SOCKET_OUTPUT);
33
        $this->createSocket(self::SOCKET_DATA);
34
    }
35
36
    /**
37
     * Executes the node's logic.
38
     */
39
    public function execute()
40
    {
41
        $node = $this->getSocket(self::SOCKET_DATA)->getNode(0);
42
        if ($node === null || $node->getValue() === null) {
43
            throw new \InvalidArgumentException('There is not data set.');
44
        }
45
46
        print_r($node->getValue());
47
48
        $this->activate(self::SOCKET_OUTPUT);
49
    }
50
}
51