You are here

protected function UpdateManager::getTasks in Lightning Core 8

Same name and namespace in other branches
  1. 8.5 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::getTasks()
  2. 8.2 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::getTasks()
  3. 8.3 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::getTasks()
  4. 8.4 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::getTasks()

Returns all available tasks for a specific update.

Parameters

object $handler: The task handler.

Return value

\Generator An iterable of UpdateTask objects.

2 calls to UpdateManager::getTasks()
TestUpdateManager::getTasks in tests/src/Unit/UpdateManagerTest.php
Returns all available tasks for a specific update.
UpdateManager::executeAllInConsole in src/UpdateManager.php
Executes all available updates in a console context.
1 method overrides UpdateManager::getTasks()
TestUpdateManager::getTasks in tests/src/Unit/UpdateManagerTest.php
Returns all available tasks for a specific update.

File

src/UpdateManager.php, line 174

Class

UpdateManager

Namespace

Drupal\lightning_core

Code

protected function getTasks($handler) {
  $methods = (new \ReflectionObject($handler))
    ->getMethods(\ReflectionMethod::IS_PUBLIC);
  foreach ($methods as $method) {
    $doc_comment = trim($method
      ->getDocComment());
    if ($doc_comment) {
      $doc_block = $this->docBlockFactory
        ->create($doc_comment);
      if ($doc_block
        ->hasTag('update')) {
        (yield new UpdateTask($handler, $method, $doc_block));
      }
    }
  }
}