for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* NextFlow (http://github.com/nextflow)
*
* @link http://github.com/nextflow/nextflow-php for the canonical source repository
* @copyright Copyright (c) 2014-2016 NextFlow (http://github.com/nextflow)
* @license https://raw.github.com/nextflow/nextflow-php/master/LICENSE MIT
*/
namespace NextFlow\Arrays\Action;
use NextFlow\Core\Action\AbstractAction;
* Clears an array.
final class ClearAction extends AbstractAction
{
/** The output action socket. */
const SOCKET_OUTPUT = 'out';
/** The array variable socket. */
const SOCKET_ARRAY = 'array';
* Initializes a new instance of this class.
public function __construct()
parent::__construct();
$this->createSocket(self::SOCKET_OUTPUT);
$this->createSocket(self::SOCKET_ARRAY);
}
* Executes the node's logic.
public function execute()
$array = $this->getSocket(self::SOCKET_ARRAY)->getNode(0);
if ($array === null) {
throw new \InvalidArgumentException('No array variable provided.');
$array->setValue(array());
$this->activate(self::SOCKET_OUTPUT);