Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 13 |
| PrivateStream | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 13 |
| getType | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getName | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getDescription | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getDirectoryPath | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getExternalUrl | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
| basePath | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Core\StreamWrapper\PrivateStream. | |
| */ | |
| namespace Drupal\Core\StreamWrapper; | |
| use Drupal\Core\Routing\UrlGeneratorTrait; | |
| use Drupal\Core\Site\Settings; | |
| /** | |
| * Drupal private (private://) stream wrapper class. | |
| * | |
| * Provides support for storing privately accessible files with the Drupal file | |
| * interface. | |
| */ | |
| class PrivateStream extends LocalStream { | |
| use UrlGeneratorTrait; | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public static function getType() { | |
| return StreamWrapperInterface::LOCAL_NORMAL; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getName() { | |
| return t('Private files'); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getDescription() { | |
| return t('Private local files served by Drupal.'); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getDirectoryPath() { | |
| return static::basePath(); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getExternalUrl() { | |
| $path = str_replace('\\', '/', $this->getTarget()); | |
| return $this->url('system.private_file_download', ['filepath' => $path], ['absolute' => TRUE]); | |
| } | |
| /** | |
| * Returns the base path for private://. | |
| * | |
| * Note that this static method is used by \Drupal\system\Form\FileSystemForm | |
| * so you should alter that form or substitute a different form if you change | |
| * the class providing the stream_wrapper.private service. | |
| * | |
| * @return string | |
| * The base path for private://. | |
| */ | |
| public static function basePath() { | |
| return Settings::get('file_private_path'); | |
| } | |
| } |