Merge pull request #4085 from lucasmichot/feat/match
Use match when possible.
This commit is contained in:
@@ -62,32 +62,21 @@ class Danger extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($this->resource->type()) {
|
||||
case 'application':
|
||||
$this->resourceName = $this->resource->name ?? 'Application';
|
||||
break;
|
||||
case 'standalone-postgresql':
|
||||
case 'standalone-redis':
|
||||
case 'standalone-mongodb':
|
||||
case 'standalone-mysql':
|
||||
case 'standalone-mariadb':
|
||||
case 'standalone-keydb':
|
||||
case 'standalone-dragonfly':
|
||||
case 'standalone-clickhouse':
|
||||
$this->resourceName = $this->resource->name ?? 'Database';
|
||||
break;
|
||||
case 'service':
|
||||
$this->resourceName = $this->resource->name ?? 'Service';
|
||||
break;
|
||||
case 'service-application':
|
||||
$this->resourceName = $this->resource->name ?? 'Service Application';
|
||||
break;
|
||||
case 'service-database':
|
||||
$this->resourceName = $this->resource->name ?? 'Service Database';
|
||||
break;
|
||||
default:
|
||||
$this->resourceName = 'Unknown Resource';
|
||||
}
|
||||
$this->resourceName = match ($this->resource->type()) {
|
||||
'application' => $this->resource->name ?? 'Application',
|
||||
'standalone-postgresql',
|
||||
'standalone-redis',
|
||||
'standalone-mongodb',
|
||||
'standalone-mysql',
|
||||
'standalone-mariadb',
|
||||
'standalone-keydb',
|
||||
'standalone-dragonfly',
|
||||
'standalone-clickhouse' => $this->resource->name ?? 'Database',
|
||||
'service' => $this->resource->name ?? 'Service',
|
||||
'service-application' => $this->resource->name ?? 'Service Application',
|
||||
'service-database' => $this->resource->name ?? 'Service Database',
|
||||
default => 'Unknown Resource',
|
||||
};
|
||||
}
|
||||
|
||||
public function delete($password)
|
||||
|
||||
Reference in New Issue
Block a user