-
Notifications
You must be signed in to change notification settings - Fork 0
Create your own command (Transformer)
Julien Gidel edited this page Mar 11, 2021
·
3 revisions
To register your own transformer your class MUST extends Automate\Transformer\AbstractTransformer
<?php
namespace MyNamespace;
use Automate\Transformer\AbstractTransformer;
class MyTransformer extends AbstractTransformer {
/**
* Get pattern validation for lezhnev74/pasvl library
*
* @link https://github.com/lezhnev74/pasvl
* @return array
*/
protected function getPattern() : array;
/**
* Transform $this->step into $this->driver actions.
*
*/
protected function transform() : void ;
/**
* You can also define a toString method
*/
public function toString() : string;
}
and then register it when creating your Automate runner on AutoMateEvents::STEP_TRANSFORM :
<?php
require __DIR__.'/../vendor/autoload.php';
use Automate\AutoMate;
use Automate\AutoMateEvents;
use MyNamespace\MyTransformer;
$configFile = __DIR__.'/config/config-test.yaml';
$autoMate = new AutoMate($configFile);
$autoMate->registerPlugin(new MyTransformer());
$autoMate->run('simple');
You could now use your own transformer as defined in the getPattern() method.
AbstractTransformer already implements AutoMateListener interface. If you want to create your own listerner this is the class you must implements. See Automate\AutoMateListener
AutoMate Wiki - v0.8.0 - This wiki can change at any moment