Refactoring
This commit is contained in:
22
lib/composer/vendor/consolidation/robo/src/Contract/BuilderAwareInterface.php
vendored
Normal file
22
lib/composer/vendor/consolidation/robo/src/Contract/BuilderAwareInterface.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Contract;
|
||||
|
||||
use Robo\Collection\CollectionBuilder;
|
||||
|
||||
interface BuilderAwareInterface
|
||||
{
|
||||
/**
|
||||
* Set the builder reference
|
||||
*
|
||||
* @param \Robo\Collection\CollectionBuilder $builder
|
||||
*/
|
||||
public function setBuilder(CollectionBuilder $builder);
|
||||
|
||||
/**
|
||||
* Get the builder reference
|
||||
*
|
||||
* @return \Robo\Collection\CollectionBuilder
|
||||
*/
|
||||
public function getBuilder();
|
||||
}
|
||||
20
lib/composer/vendor/consolidation/robo/src/Contract/CommandInterface.php
vendored
Normal file
20
lib/composer/vendor/consolidation/robo/src/Contract/CommandInterface.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* Task that implements this interface can be injected as a parameter for other task.
|
||||
* This task can be represented as executable command.
|
||||
*
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface CommandInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns command that can be executed.
|
||||
* This method is used to pass generated command from one task to another.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommand();
|
||||
}
|
||||
18
lib/composer/vendor/consolidation/robo/src/Contract/CompletionInterface.php
vendored
Normal file
18
lib/composer/vendor/consolidation/robo/src/Contract/CompletionInterface.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* Any Robo tasks that implements this interface will
|
||||
* be called when the task collection it is added to
|
||||
* completes.
|
||||
*
|
||||
* Interface CompletionInterface
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface CompletionInterface extends TaskInterface
|
||||
{
|
||||
/**
|
||||
* Revert an operation that can be rolled back
|
||||
*/
|
||||
public function complete();
|
||||
}
|
||||
24
lib/composer/vendor/consolidation/robo/src/Contract/ConfigAwareInterface.php
vendored
Normal file
24
lib/composer/vendor/consolidation/robo/src/Contract/ConfigAwareInterface.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Contract;
|
||||
|
||||
use Robo\Config;
|
||||
|
||||
interface ConfigAwareInterface
|
||||
{
|
||||
/**
|
||||
* Set the config reference
|
||||
*
|
||||
* @param \Robo\Config $config
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConfig(Config $config);
|
||||
|
||||
/**
|
||||
* Get the config reference
|
||||
*
|
||||
* @return \Robo\Config
|
||||
*/
|
||||
public function getConfig();
|
||||
}
|
||||
13
lib/composer/vendor/consolidation/robo/src/Contract/IOAwareInterface.php
vendored
Normal file
13
lib/composer/vendor/consolidation/robo/src/Contract/IOAwareInterface.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Marker interface for tasks that use the IO trait
|
||||
*/
|
||||
|
||||
namespace Robo\Contract;
|
||||
|
||||
use \Symfony\Component\Console\Input\InputAwareInterface;
|
||||
|
||||
interface IOAwareInterface extends OutputAwareInterface, InputAwareInterface
|
||||
{
|
||||
}
|
||||
52
lib/composer/vendor/consolidation/robo/src/Contract/InflectionInterface.php
vendored
Normal file
52
lib/composer/vendor/consolidation/robo/src/Contract/InflectionInterface.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
interface InflectionInterface
|
||||
{
|
||||
/**
|
||||
* Based on league/container inflection: http://container.thephpleague.com/inflectors/
|
||||
*
|
||||
* This allows us to run:
|
||||
*
|
||||
* (new SomeTask($args))
|
||||
* ->inflect($this)
|
||||
* ->initializer()
|
||||
* ->...
|
||||
*
|
||||
* Instead of:
|
||||
*
|
||||
* (new SomeTask($args))
|
||||
* ->setLogger($this->logger)
|
||||
* ->initializer()
|
||||
* ->...
|
||||
*
|
||||
* The reason `inflect` is better than the more explicit alternative is
|
||||
* that subclasses of BaseTask that implement a new FooAwareInterface
|
||||
* can override injectDependencies() as explained below, and add more
|
||||
* dependencies that can be injected as needed.
|
||||
*
|
||||
* @param \Robo\Contract\InflectionInterface $parent
|
||||
*/
|
||||
public function inflect(InflectionInterface $parent);
|
||||
|
||||
/**
|
||||
* Take all dependencies availble to this task and inject any that are
|
||||
* needed into the provided task. The general pattern is that, for every
|
||||
* FooAwareInterface that this class implements, it should test to see
|
||||
* if the child also implements the same interface, and if so, should call
|
||||
* $child->setFoo($this->foo).
|
||||
*
|
||||
* The benefits of this are pretty large. Any time an object that implements
|
||||
* InflectionInterface is created, just call `$child->inflect($this)`, and
|
||||
* any available optional dependencies will be hooked up via setter injection.
|
||||
*
|
||||
* The required dependencies of an object should be provided via constructor
|
||||
* injection, not inflection.
|
||||
*
|
||||
* @param InflectionInterface $child An object created by this class that
|
||||
* should have its dependencies injected.
|
||||
*
|
||||
* @see https://mwop.net/blog/2016-04-26-on-locators.html
|
||||
*/
|
||||
public function injectDependencies(InflectionInterface $child);
|
||||
}
|
||||
19
lib/composer/vendor/consolidation/robo/src/Contract/OutputAwareInterface.php
vendored
Normal file
19
lib/composer/vendor/consolidation/robo/src/Contract/OutputAwareInterface.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Provide OutputAwareInterface, not present in Symfony Console
|
||||
*/
|
||||
|
||||
namespace Robo\Contract;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
interface OutputAwareInterface
|
||||
{
|
||||
/**
|
||||
* Sets the Console Output.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
*/
|
||||
public function setOutput(OutputInterface $output);
|
||||
}
|
||||
16
lib/composer/vendor/consolidation/robo/src/Contract/PrintedInterface.php
vendored
Normal file
16
lib/composer/vendor/consolidation/robo/src/Contract/PrintedInterface.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* If task prints anything to console
|
||||
*
|
||||
* Interface PrintedInterface
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface PrintedInterface
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getPrinted();
|
||||
}
|
||||
24
lib/composer/vendor/consolidation/robo/src/Contract/ProgressIndicatorAwareInterface.php
vendored
Normal file
24
lib/composer/vendor/consolidation/robo/src/Contract/ProgressIndicatorAwareInterface.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* Any Robo task that uses the Timer trait and
|
||||
* implements ProgressIndicatorAwareInterface will
|
||||
* display a progress bar while the timer is running.
|
||||
* Call advanceProgressIndicator to advance the indicator.
|
||||
*
|
||||
* Interface ProgressIndicatorAwareInterface
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface ProgressIndicatorAwareInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function progressIndicatorSteps();
|
||||
|
||||
/**
|
||||
* @param \Robo\Common\ProgressIndicator $progressIndicator
|
||||
*/
|
||||
public function setProgressIndicator($progressIndicator);
|
||||
}
|
||||
19
lib/composer/vendor/consolidation/robo/src/Contract/ProgressInterface.php
vendored
Normal file
19
lib/composer/vendor/consolidation/robo/src/Contract/ProgressInterface.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* Robo tasks that take multiple steps to complete should
|
||||
* implement this interface.
|
||||
*
|
||||
* Interface ProgressInterface
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface ProgressInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function progressSteps();
|
||||
}
|
||||
18
lib/composer/vendor/consolidation/robo/src/Contract/RollbackInterface.php
vendored
Normal file
18
lib/composer/vendor/consolidation/robo/src/Contract/RollbackInterface.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* Any Robo tasks that implements this interface will
|
||||
* be called when the task collection it is added to
|
||||
* fails, and runs its rollback operation.
|
||||
*
|
||||
* Interface RollbackInterface
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface RollbackInterface extends TaskInterface
|
||||
{
|
||||
/**
|
||||
* Revert an operation that can be rolled back
|
||||
*/
|
||||
public function rollback();
|
||||
}
|
||||
18
lib/composer/vendor/consolidation/robo/src/Contract/SimulatedInterface.php
vendored
Normal file
18
lib/composer/vendor/consolidation/robo/src/Contract/SimulatedInterface.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* Task that implements this interface can be injected as a parameter for other task.
|
||||
* This task can be represented as executable command.
|
||||
*
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface SimulatedInterface extends TaskInterface
|
||||
{
|
||||
/**
|
||||
* Called in place of `run()` for simulated tasks.
|
||||
*
|
||||
* @param null|array $context
|
||||
*/
|
||||
public function simulate($context);
|
||||
}
|
||||
17
lib/composer/vendor/consolidation/robo/src/Contract/TaskInterface.php
vendored
Normal file
17
lib/composer/vendor/consolidation/robo/src/Contract/TaskInterface.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
/**
|
||||
* All Robo tasks should implement this interface.
|
||||
* Task should be configured by chained methods.
|
||||
*
|
||||
* Interface TaskInterface
|
||||
* @package Robo\Contract
|
||||
*/
|
||||
interface TaskInterface
|
||||
{
|
||||
/**
|
||||
* @return \Robo\Result
|
||||
*/
|
||||
public function run();
|
||||
}
|
||||
10
lib/composer/vendor/consolidation/robo/src/Contract/WrappedTaskInterface.php
vendored
Normal file
10
lib/composer/vendor/consolidation/robo/src/Contract/WrappedTaskInterface.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Robo\Contract;
|
||||
|
||||
interface WrappedTaskInterface extends TaskInterface
|
||||
{
|
||||
/**
|
||||
* @return \Robo\Contract\TaskInterface
|
||||
*/
|
||||
public function original();
|
||||
}
|
||||
Reference in New Issue
Block a user