FormattedMessage   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A get() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Scavenger\Helper;
6
7
final class FormattedMessage
8
{
9
    public const MISSING_SEARCH_KEY = self::PREFIX_ABORTED . 'Search enabled but %s (%s) is not set for target (%s).';
10
    public const EXCEPTION_THROWN_FOR_ATTRIBUTE = self::PREFIX_EXCEPTION . 'thrown for attribute (%s) on target %s: %s';
11
    public const FIRST_RESULT_PAGE_FOR_KEYWORD_ON_TARGET = '1st Result Page for \'%s\' on target \'%s\'';
12
    public const PREPROCESS_NOT_CALLABLE = 'Preprocess for attribute %s on target %s is not callable.' . self::SUFFIX_SKIPPED;
13
    public const PROCESSING_PAGE_N = 'Processing page %d:';
14
    public const NO_ITEMS_FOUND_ON_PAGE_N = 'No items found on page %d.';
15
    public const SEARCH_KEYWORD = 'Search keyword %s';
16
    public const SCRAP_CONTAINS_BAD_WORD = 'Scrap was found to contain bad words. Discarded -- %s';
17
    public const SCRAP_GATHERED = 'Scrap gathered: %s';
18
    public const SCRAP_SAVE_EXCEPTION = 'Failed to save scrap: %s. Exception: %s';
19
    public const NO_TITLE_LINK_FOUND_FOR_X = 'No title/link found for item which would be at: %d' . self::SUFFIX_SKIPPED;
20
    public const UNABLE_TO_RETRIEVE_SCRAP_FOR_X = 'Unable to retrieve scrap which would be at: %d' . self::SUFFIX_SKIPPED;
21
    public const EXAMPLE_TARGET = 'Target (%s) is for example purposes only.' . self::SUFFIX_SKIPPED;
22
    public const INVALID_SPECIAL_KEY = self::PREFIX_ERROR . 'Special key (%s) is not valid.';
23
    public const TARGET = 'Target: %s';
24
    public const TARGET_MODEL_RESOLUTION_FAILED = 'Could not resolve model for target %s. %s' . self::SUFFIX_SKIPPED;
25
    public const TARGET_NAME_MISSING = 'Missing target name. (%s)';
26
    public const TARGET_PAGER_NEXT_NOT_FOUND = self::PREFIX_ERROR . 'Pager next link could not be found for target (%s). Specified as (%s), with expected text: "%s".';
27
    public const TARGET_SOURCE_MISSING = 'Missing source for target (%s).' . self::SUFFIX_SKIPPED;
28
    public const TARGET_INVALID_SEARCH_FORM = 'Could not retrieve form for target (%s). Please check configuration.';
29
    public const TARGET_UNKNOWN = self::PREFIX_ABORTED . 'Unknown target (%s).';
30
    public const TARGET_UNEXPECTED_EXCEPTION = self::PREFIX_EXCEPTION . 'Target (%s) resulted in exception: %s';
31
    public const TARGET_MISSING_TITLE_LINK = 'Missing title link in configuration for target (%s).';
32
    public const TARGET_MISSING_ITEM_WRAPPER = 'Neither `inside` nor `item_wrapper` is specified for target (%s).';
33
34
    private const PREFIX_ABORTED = '[!] Aborted - ';
35
    private const PREFIX_ERROR = '[!] Error - ';
36
    private const PREFIX_EXCEPTION = '[!] Exception - ';
37
    private const SUFFIX_SKIPPED = ' - Skipped';
38
39
    /**
40
     * Message constructor.
41
     */
42
    private function __construct()
43
    {
44
    }
45
46
    /**
47
     * @param mixed ...$args
48
     */
49
    public static function get(string $message, ...$args): string
50
    {
51
        return sprintf($message, ...$args);
52
    }
53
}
54