Skip to content

Commit

Permalink
Rename execute to run in Tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Jan 29, 2018
1 parent 00f73ab commit 8b76df4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MyTask extends Task
// Setup eg. dependency container, load config,...
}

public function execute()
public function run()
{
// Do the real work here.
}
Expand Down Expand Up @@ -178,7 +178,7 @@ If the required extensions (`pctnl` and `posix`) are not installed in your curre

The `Pool` class has a static method `isSupported` you can call to check whether your platform is able to run asynchronous processes.

If you're using a `Task` to run processes, only the `execute` method of those tasks will be called when running in synchronous mode.
If you're using a `Task` to run processes, only the `run` method of those tasks will be called when running in synchronous mode.

## Behind the curtains

Expand Down
2 changes: 1 addition & 1 deletion src/Process/SynchronousProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function start()
$startTime = microtime(true);

$this->output = $this->task instanceof Task
? $this->task->execute()
? $this->task->run()
: call_user_func($this->task);

$this->executionTime = microtime(true) - $startTime;
Expand Down
4 changes: 2 additions & 2 deletions src/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ abstract class Task
{
abstract public function configure();

abstract public function execute();
abstract public function run();

public function __invoke()
{
$this->configure();

return $this->execute();
return $this->run();
}
}
2 changes: 1 addition & 1 deletion tests/MyTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function configure()
$this->i = 2;
}

public function execute()
public function run()
{
return $this->i;
}
Expand Down

0 comments on commit 8b76df4

Please sign in to comment.