You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright © 2024 ExacTI Technology Solutions. All rights reserved.
|
|
|
|
* GPLv3 General License.
|
|
|
|
* https://exacti.com.br
|
|
|
|
* Phacil PHP Framework - https://github.com/exacti/phacil-framework
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Phacil\Framework;
|
|
|
|
|
|
|
|
class PreActions implements \Phacil\Framework\Api\PreActions {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var \Phacil\Framework\Action[]
|
|
|
|
*/
|
|
|
|
protected $handlers = array();
|
|
|
|
|
|
|
|
private $preActions = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var \Phacil\Framework\Registry
|
|
|
|
*/
|
|
|
|
private $registry;
|
|
|
|
|
|
|
|
public function __construct(array $preActions, \Phacil\Framework\Registry $registry){
|
|
|
|
$this->preActions = $preActions;
|
|
|
|
$this->registry = $registry;
|
|
|
|
|
|
|
|
$this->createPreActions();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function createPreActions() {
|
|
|
|
foreach ($this->preActions as $preAction){
|
|
|
|
$this->handlers[] = $this->registry->create(\Phacil\Framework\Action::class, $preAction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** {@inheritdoc} */
|
|
|
|
public function getHandlers() {
|
|
|
|
return $this->handlers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param int $actionKey
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function executedActionHandler($actionKey){
|
|
|
|
unset($this->handlers[$actionKey]);
|
|
|
|
}
|
|
|
|
}
|