PopFrontAction::executePop()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 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\Arrays\Action;
11
12
use NextFlow\Core\Node\NodeInterface;
13
14
/**
15
 * Pops an element from the front of an array.
16
 */
17
final class PopFrontAction extends AbstractPopAction
18
{
19
    /**
20
     * Executes the pop logic.
21
     *
22
     * @param NodeInterface $node The node to pop data from.
23
     * @return mixed
24
     */
25
    protected function executePop(NodeInterface $node)
26
    {
27
        $arrayValue = $node->getValue();
28
29
        $poppedValue = array_shift($arrayValue);
30
31
        $node->setValue($arrayValue);
32
33
        return $poppedValue;
34
    }
35
}
36