Create an Actor class and generate actions for it.
Requires a suite config as array in 3rd parameter.

@param $name
@param $directory
@param $suiteConfig
426601
protected function createActor($name, $directory, $suiteConfig)
    {
        $file = $this->createDirectoryFor(
            $directory,
            $name
        ) . $this->getShortClassName($name);
        $file .= '.php';

        $suiteConfig['namespace'] = $this->namespace;
        $config = Configuration::mergeConfigs(Configuration::$defaultSuiteSettings, $suiteConfig);

        $actorGenerator = new Lib\Generator\Actor($config);

        $content = $actorGenerator->produce();

        $this->createFile($file, $content);
        $this->sayInfo("$name actor has been created in $directory");

        $actionsGenerator = new Lib\Generator\Actions($config);
        $content = $actionsGenerator->produce();

        $generatedDir = $directory . DIRECTORY_SEPARATOR . '_generated';
        $this->createDirectoryFor($generatedDir, 'Actions.php');
        $this->createFile($generatedDir . DIRECTORY_SEPARATOR . $actorGenerator->getActorName() . 'Actions.php', $content);
        $this->sayInfo("Actions have been loaded");
    }
76704
public static function createFromConfiguration ($role, array $configuration)
    {
        return new Role(
            $role,
            isset($configuration["title"]) ? $configuration["title"] : null,
            isset($configuration["description"]) ? $configuration["description"] : null,
            isset($configuration["hidden"]) ? $configuration["hidden"] : false,
            isset($configuration["tags"]) ? $configuration["tags"] : [],
            isset($configuration["actions"]) ? $configuration["actions"] : []
        );
    }
631868
protected static function modifyConfig($name, array $config, $override = false)
    {
        self::validateAgentName($name);
        if (!isset(self::$agentsConfig[$name])) {
            self::$agentsConfig[$name] = [];
        }
        $target = &self::$agentsConfig[$name];
        if ($override) {
            $target = $config;
        } else {
            $target = array_merge($target, $config);
        }
        if (self::hasAgent($name)) {
            self::getAgent($name)->config($target);
        }
    }
647090
public function move($directory, $name = null)
    {
        $target = $this->getTargetFile($directory, $name);

        if (!@rename($this->getPathname(), $target)) {
            $error = error_get_last();
            throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
        }

        @chmod($target, 0666 & ~umask());

        return $target;
    }
1306386
public function make($name, array $options)
    {
        //check the permission on this item
        $options = $this->parseDefaults($name, $options);

        //now we can instantiate the object
        return $this->getActionObject($options);
    }
928047
def create_action_for_code(cls, action_code, name, configuration, managed_input):
        
        Global.LOGGER.debug(f"creating action {name} for code {action_code}")
        Global.LOGGER.debug(f"configuration length: {len(configuration)}")
        Global.LOGGER.debug(f"input: {managed_input}")

        # get the actions catalog
        my_actions_file = Action.search_actions()

        # load custom actions to find the right one
        for filename in my_actions_file:
            module_name = os.path.basename(os.path.normpath(filename))[:-3]

            # garbage collect all the modules you load if they are not necessary
            context = {}
            Action.load_module(module_name, filename)
            for subclass in Action.__subclasses__():
                if subclass.type == action_code:
                    action_class = subclass
                    action = action_class(name, configuration, managed_input)
                    return action
            subclass = None
            gc.collect()
642340
private function _createFile($dir, $name, $ext)
    {
        if (!empty($this->rootDir)) {
            if (!file_exists($this->_getFileDir($dir))) {
                mkdir($this->_getFileDir($dir), 0777, true);
            }
            if (!file_exists($this->_getFilePath($dir, $name, $ext))) {
                if (file_put_contents($this->_getFilePath($dir, $name, $ext), '') === false) {
                    throw new \Exception("Could not create $ext for {$this->username}.");
                }
            }
        }
    }
601005
public function createCommand($name)
    {
        $startTimestamp = time();

        #######################
        #     Build Paths     #
        #######################

        $basePath = $this->getStashEntryPath($name);

        $databaseDestination = $basePath . '/database.sql';
        $persistentDestination = $basePath . '/persistent/';

        FileUtils::createDirectoryRecursively($basePath);

        #######################
        # Check Configuration #
        #######################

        $this->checkConfiguration();

        ##################
        # Define Secrets #
        ##################

        $this->addSecret($this->databaseConfiguration['user']);
        $this->addSecret($this->databaseConfiguration['password']);

        ######################
        #  Write Manifest    #
        ######################
        $this->renderHeadLine('Write Manifest');
        $presetName = $this->configurationService->getCurrentPreset();
        $presetConfiguration = $this->configurationService->getCurrentConfiguration();
        $cloneTimestamp = $this->configurationService->getMostRecentCloneTimeStamp();
        $stashTimestamp = time();

        $this->writeStashEntryManifest($name, [
            'preset' => [
                'name' => $presetName,
                'configuration' => $presetConfiguration
            ],
            'cloned_at' => $cloneTimestamp,
            'stashed_at' => $stashTimestamp
        ]);

        ######################
        #  Backup Database   #
        ######################

        $this->renderHeadLine('Backup Database');
        $this->executeLocalShellCommand(
            'mysqldump --single-transaction --add-drop-table --host="%s" --user="%s" --password="%s" %s > %s',
            [
                $this->databaseConfiguration['host'],
                $this->databaseConfiguration['user'],
                $this->databaseConfiguration['password'],
                $this->databaseConfiguration['dbname'],
                $databaseDestination
            ]
        );

        ###############################
        # Backup Persistent Resources #
        ###############################

        $this->renderHeadLine('Backup Persistent Resources');
        $this->executeLocalShellCommand(
            'cp -al %s %s',
            [
                FLOW_PATH_ROOT . 'Data/Persistent',
                $persistentDestination
            ]
        );

        #################
        # Final Message #
        #################

        $endTimestamp = time();
        $duration = $endTimestamp - $startTimestamp;

        $this->renderHeadLine('Done');
        $this->renderLine('Successfuly stashed %s in %s seconds', [$name, $duration]);
    }
780558
public function create($actionName, $adminName, AdminConfiguration $adminConfiguration): ActionInterface
    {
        $event = new ConfigurationEvent(
            $actionName,
            $adminConfiguration->getParameter('actions'),
            $adminName,
            $adminConfiguration->getParameter('entity')
        );
        $this->eventDispatcher->dispatch(Events::CONFIGURATION_ACTION, $event);

        if (!array_key_exists($actionName, $event->getConfiguration())) {
            throw new Exception(
                'The action "'.$actionName.'" was not found  in the configuration of the admin "'.$adminName.'"'
            );
        }
        $actionConfiguration = $event->getConfiguration()[$actionName];
        $configuration = $this
            ->configurationFactory
            ->createActionConfiguration($actionName, $actionConfiguration, $adminName, $adminConfiguration)
        ;
        $class = $configuration->getParameter('class');
        $action = new $class($actionName, $configuration);

        if (!$action instanceof ActionInterface) {
            throw new Exception('The action class "'.$class.'" should implements '.ActionInterface::class);
        }

        return $action;
    }
506053
public static function run($name, array $config = array())
    {
        $generator = self::create($name, $config);

        if (!$generator->validate()) {
            $generator->renderErrors();
        }

        return $generator->generate();
    }
1020908
private function addDefaultActions(array &$configuration)
    {
        if (!key_exists('actions', $configuration) || !is_array($configuration['actions'])) {
            $configuration['actions'] = [];
        }

        if (0 !== count($configuration['actions'])) {
            return;
        }
        $configuration['actions'] = [
            'create' => [],
            'list' => [],
            'edit' => [],
            'delete' => [],
        ];
    }
210475
public function addActionCallback($key, $name, $callback = null)
	{
		$this->addActionCheck($key);

		$params = ['__id' => $this->primary_key];

		$this->actions[$key] = $action = new Column\ActionCallback($this, $key, $name, $params);

		if ($callback) {
			if (!is_callable($callback)) {
				throw new DataGridException('ActionCallback callback has to be callable.');
			}

			$action->onClick[] = $callback;
		}

		return $action;
	}
760018
protected function createRuntimeDriver(string $name): ProviderContract
    {
        $config = $this->config['runtime'][$name] ?? [];

        return $this->createProvider(new Runtime($name, $config));
    }
1140707
protected function buildTask($name, $config)
    {
        $container = $this->container;
        $command   = new Command($name);
        $command->setApplication($container->get('application'));
        $command->setDescription($config['description']);
        $command->setCode(function (InputInterface $input, OutputInterface $output) use ($name, $config, $container) {
            $formatter = $container->get('application')->getHelperSet()->get('formatter');
            $output->writeln(
                $formatter->formatBlock(array(sprintf('Running Task "%s"', $name)), 'info')
            );
            $successful = 0;
            foreach ($config['requires'] as $task) {
                $output->writeln(
                    $formatter->formatBlock(array(sprintf('Running Required Task "%s"', $task)), 'info')
                );
                $service = $container->get(sprintf('task.'.$task));
                $code = $service->run($input, $output);
                if (0 !== $code) {
                    $successful = -1;
                }
            }

            foreach ($config['commands'] as $cmd => $cmdConfig) {
                $output->writeln(
                    $formatter->formatBlock(array(sprintf('Running Command "%s"', $cmd)), 'info')
                );
                $serviceId = sprintf('command.%s', $cmdConfig['command']);
                if (!$container->has($serviceId)) {
                    $output->writeln(
                        $formatter->formatSection(
                            '<error>ERROR</error>',
                            sprintf('Command "%s" does not exist', $cmdConfig['command'])
                        )
                    );
                    $successful = -1;
                    continue;
                }

                $serviceConfig = array('command' => $cmdConfig['command']);
                $service       = $container->get($serviceId);
                $service->setApplication($container->get('application'));

                foreach ($cmdConfig['arguments'] as $arg => $value) {
                    $serviceConfig[$arg] = $value;
                }

                foreach ($cmdConfig['options'] as $opt => $value) {
                    $serviceConfig['--'.$opt] = $value;
                }

                $code = $service->run(new ArrayInput($serviceConfig), $output);

                if (0 !== $code) {
                    $successful = -1;
                    $output->writeln(
                        $formatter->formatBlock(array(sprintf('Command "%s" failure', $cmd)), 'error')
                    );
                } else {
                    $output->writeln(
                        $formatter->formatBlock(array(sprintf('Command "%s" success', $cmd)), 'info')
                    );
                }
            }

            return $successful;
        });

        return $command;
    }
451935
public function setCustomActions($name, $data = null)
    {
        $actions = is_array($name) ? $name : [$name => $data];

        foreach ($actions as $key => $value) {
            $this->customActions[$key] = $value;
        }

        return $this;
    }
1147420
public function createAction($name, $type = null, array $options = [])
    {
        $this->preventIfLocked();

        if (null !== $type) {
            return $this->getFactory()->createActionBuilder($name, $type, $options);
        }

        throw new \InvalidArgumentException('Action type guessing is not yet supported.');
        // TODO return $this->getFormFactory()->createActionBuilderForProperty($this->getDataClass(), $name, $options);
    }
1094204
private function createSuite($suite_name, $project, $suite_data)
    {
        $this->showProgress("  -- suite '{$suite_name}'");

        if (!$this->dataRepository->createOrUpdateSuite($suite_name, $project->id, $suite_data)) {
            $this->displayMessages($this->dataRepository->getMessages());
            die;
        }
    }