Version 1
[yaffs-website] / web / core / modules / locale / src / StreamWrapper / TranslationsStream.php
1 <?php
2
3 namespace Drupal\locale\StreamWrapper;
4
5 use Drupal\Core\StreamWrapper\LocalStream;
6 use Drupal\Core\StreamWrapper\StreamWrapperInterface;
7
8 /**
9  * Defines a Drupal translations (translations://) stream wrapper class.
10  *
11  * Provides support for storing translation files.
12  */
13 class TranslationsStream extends LocalStream {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static function getType() {
19     return StreamWrapperInterface::LOCAL_HIDDEN;
20   }
21
22   /**
23    * {@inheritdoc}
24    */
25   public function getName() {
26     return t('Translation files');
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   public function getDescription() {
33     return t('Translation files');
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function getDirectoryPath() {
40     return \Drupal::config('locale.settings')->get('translation.path');
41   }
42
43   /**
44    * Implements Drupal\Core\StreamWrapper\StreamWrapperInterface::getExternalUrl().
45    * @throws \LogicException
46    *   PO files URL should not be public.
47    */
48   public function getExternalUrl() {
49     throw new \LogicException('PO files URL should not be public.');
50   }
51
52 }