for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of CaptainHook.
*
* (c) Sebastian Feldmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CaptainHook\Config;
* Class Action
* @package CaptainHook
* @author Sebastian Feldmann <[email protected]>
* @link https://github.com/sebastianfeldmann/captainhook
* @since Class available since Release 0.9.0
class Action
{
* Action type
* @var string
private $type;
* Action phpc lass or cli script
private $action;
* Map of options name => value
* @var array
private $options;
* List of valid action types
protected static $validTypes = ['php' => true, 'cli' => true];
* Action constructor.
* @param string $type
* @param string $action
* @param array $options
* @throws \Exception
public function __construct($type, $action, $options = [])
if (!isset(self::$validTypes[$type])) {
throw new \Exception(sprintf('Invalid action type: %s', $type));
}
$this->type = $type;
$this->action = $action;
$this->options = $options;
* Type getter.
* @return string
public function getType()
return $this->type;
* Action getter.
public function getAction()
return $this->action;
* Return option map.
* @return array
public function getOptions()
return $this->options;
* Return config data.
public function getJsonData()
return [
'action' => $this->action,
'options' => $this->options,
];