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