Changeset View
Changeset View
Standalone View
Standalone View
src/Runner/TasksMap.php
<?php | <?php | ||||
namespace Nasqueron\SAAS\PhpBB\Runner; | namespace Nasqueron\SAAS\PhpBB\Runner; | ||||
use InvalidArgumentException; | use InvalidArgumentException; | ||||
use Nasqueron\SAAS\PhpBB\Tasks\BootstrapSqliteRepository; | use Nasqueron\SAAS\PhpBB\Tasks\BootstrapSqliteRepository; | ||||
use Nasqueron\SAAS\PhpBB\Tasks\CreateDatabase; | |||||
class TasksMap { | class TasksMap { | ||||
public static function getMap () : array { | public static function getMap () : array { | ||||
return [ | return [ | ||||
'sites:createdb' => CreateDatabase::class, | |||||
'sites:bootstrap' => BootstrapSqliteRepository::class, | 'sites:bootstrap' => BootstrapSqliteRepository::class, | ||||
]; | ]; | ||||
} | } | ||||
public static function getTaskClassName (string $command) { | public static function getTaskClassName (string $command) { | ||||
foreach (self::getMap() as $taskCommand => $taskClassName) { | foreach (self::getMap() as $taskCommand => $taskClassName) { | ||||
if ($command === $taskCommand) { | if ($command === $taskCommand) { | ||||
return $taskClassName; | return $taskClassName; | ||||
} | } | ||||
} | } | ||||
throw new InvalidArgumentException; | throw new InvalidArgumentException; | ||||
} | } | ||||
} | } |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator