Page MenuHomeWickedGov Phorge

BoxedExecutor.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

BoxedExecutor.php

<?php
namespace Shellbox\Command;
/**
* Base class for things that execute BoxedCommands
*/
abstract class BoxedExecutor {
/** @var Validator|null */
protected $validator;
/**
* Execute a boxed command.
*
* @param BoxedCommand $command
* @return BoxedResult
*/
final public function execute( BoxedCommand $command ) {
$this->assertIsValid( $command );
return $this->executeValid( $command );
}
/**
* Execute a BoxedCommand that has already been validated.
*
* @param BoxedCommand $command
* @return BoxedResult
*/
abstract public function executeValid( BoxedCommand $command );
/**
* Create an empty command linked to this executor
*
* @return BoxedCommand
*/
public function createCommand() {
return new BoxedCommand( $this );
}
/**
* Set validation configuration
*
* @param array $config
*/
public function setValidationConfig( $config ) {
$this->validator = new Validator( $config );
}
/**
* Validate the command. If it is not valid, throw an exception
*
* @param BoxedCommand $command
* @throws ValidationError
*/
protected function assertIsValid( BoxedCommand $command ) {
if ( !$this->validator ) {
return;
}
$this->validator->validate( $command );
}
/**
* Whether the executor can download input files and upload output files
* specified with BoxedCommand::inputFileFromUrl and the like.
*
* @since 4.1.0
* @return bool
*/
abstract public function areUrlFilesAllowed();
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 19:03 (1 d, 17 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
34/5c/5f1fd2511cb58285860970fc348c
Default Alt Text
BoxedExecutor.php (1 KB)

Event Timeline