for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Koriym\AppStateDiagram;
use function sprintf;
/** @psalm-immutable */
final class LabelNameTitle implements LabelNameInterface
{
public function getNodeLabel(SemanticDescriptor $descriptor): string
return $descriptor->title ? $descriptor->title : $descriptor->id;
}
public function getLinkLabel(TransDescriptor $trans): string
$title = $trans->title ? $trans->title : $trans->id;
if ($trans->type === 'idempotent') {
return sprintf('<u>%s</u>', $title);
if ($trans->type === 'unsafe') {
return sprintf('<b><u>%s</u></b>', $title);
return $title;