PopBackAction   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A executePop() 0 10 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 back of an array.
16
 */
17
final class PopBackAction 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_pop($arrayValue);
30
31
        $node->setValue($arrayValue);
32
33
        return $poppedValue;
34
    }
35
}
36