Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ResourceModifyResourceButtonLabel
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
0.00% covered (danger)
0.00%
0 / 1
 getFallbackText
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
1<?php
2namespace Apie\Core\Translator\ValueObjects;
3
4use Apie\Core\Attributes\Description;
5use Apie\Core\Attributes\ExampleValue;
6
7#[Description('Text shown on edit resource button')]
8#[ExampleValue('apie.bounded.test.example.user.action.edit.:id.label.authenticated')]
9class ResourceModifyResourceButtonLabel extends AbstractTranslation
10{
11    protected const MIDDLE_REGEX = 'action\.edit\.:id\.label';
12
13    public function getFallbackText(): string
14    {
15        $id = $this->prefix->getResourceIdentifier();
16        if ($id) {
17            return 'Edit ' . $id->humanize();
18        }
19        return 'Edit';
20    }
21}