1 | <?php |
||
20 | class DatabaseLoader implements LoaderInterface, ResourceInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var TranslationManagerInterface |
||
24 | */ |
||
25 | private $translationManager; |
||
26 | |||
27 | /** |
||
28 | * default constructor |
||
29 | * |
||
30 | * @param TranslationManagerInterface $translationManager |
||
31 | */ |
||
32 | 20 | public function __construct(TranslationManagerInterface $translationManager) |
|
36 | |||
37 | /** |
||
38 | * load messages from db |
||
39 | * |
||
40 | * @param string $resource translation key |
||
41 | * @param string $locale current locale |
||
42 | * @param string $messageDomain message domain |
||
43 | * @return \Symfony\Component\Translation\MessageCatalogue |
||
44 | */ |
||
45 | 6 | public function load($resource, $locale, $messageDomain = 'messages') |
|
59 | |||
60 | /** |
||
61 | * Returns a string representation of the Resource. |
||
62 | * |
||
63 | * @return string A string representation of the Resource |
||
64 | */ |
||
65 | 1 | public function __toString() |
|
69 | |||
70 | /** |
||
71 | * Returns true if the resource has not been updated since the given timestamp. |
||
72 | * |
||
73 | * @param int $timestamp The last time the resource was loaded |
||
74 | * @return bool True if the resource has not been updated, false otherwise |
||
75 | */ |
||
76 | 2 | public function isFresh($timestamp) |
|
87 | |||
88 | /** |
||
89 | * Returns the tied resource. |
||
90 | * |
||
91 | * @return mixed The resource |
||
92 | */ |
||
93 | 1 | public function getResource() |
|
97 | } |
||
98 |