Debian Codegraph @

lib/3rdParty/composer/nesbot/carbon/src/Carbon/Traits/StaticLocalization.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 /**
6 * This file is part of the Carbon package.
7 *
8 * (c) Brian Nesbitt <[email protected]>
9 *
10 * For the full copyright and license information, please view the LICENSE
11 * file that was distributed with this source code.
12 */
13
14 namespace Carbon\Traits;
15
16 use Carbon\FactoryImmutable;
17 use Symfony\Contracts\Translation\TranslatorInterface;
18
19 /**
20 * Static config for localization.
21 */
22 trait StaticLocalization
23 {
24 /**
25 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
26 * You should rather use the ->settings() method.
27 * @see settings
28 */
29 public static function setHumanDiffOptions(int $humanDiffOptions): void
30 {
31 FactoryImmutable::getDefaultInstance()->setHumanDiffOptions($humanDiffOptions);
32 }
33
34 /**
35 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
36 * You should rather use the ->settings() method.
37 * @see settings
38 */
39 public static function enableHumanDiffOption(int $humanDiffOption): void
40 {
41 FactoryImmutable::getDefaultInstance()->enableHumanDiffOption($humanDiffOption);
42 }
43
44 /**
45 * @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
46 * You should rather use the ->settings() method.
47 * @see settings
48 */
49 public static function disableHumanDiffOption(int $humanDiffOption): void
50 {
51 FactoryImmutable::getDefaultInstance()->disableHumanDiffOption($humanDiffOption);
52 }
53
54 /**
55 * Return default humanDiff() options (merged flags as integer).
56 */
57 public static function getHumanDiffOptions(): int
58 {
59 return FactoryImmutable::getInstance()->getHumanDiffOptions();
60 }
61
62 /**
63 * Set the default translator instance to use.
64 *
65 * @param TranslatorInterface $translator
66 *
67 * @return void
68 */
69 public static function setTranslator(TranslatorInterface $translator): void
70 {
71 FactoryImmutable::getDefaultInstance()->setTranslator($translator);
72 }
73
74 /**
75 * Initialize the default translator instance if necessary.
76 */
77 public static function getTranslator(): TranslatorInterface
78 {
79 return FactoryImmutable::getInstance()->getTranslator();
80 }
81 }