Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Temporary.php
Go to the documentation of this file.
1 <?php
7 
11 
12 class Temporary
13 {
17  private $config;
18 
22  private $tmpDirectory;
23 
28  public function __construct(
30  Config $config
31  ) {
32  $this->tmpDirectory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
33  $this->config = $config;
34  }
35 
44  {
45  $filePath = $this->config->getMaterializationRelativePath() . '/' . $relativePath;
46 
47  if (!$this->tmpDirectory->isExist($filePath)) {
48  $this->tmpDirectory->writeFile($filePath, $contents);
49  }
50  return $this->tmpDirectory->getAbsolutePath($filePath);
51  }
52 }
$contents
Definition: website.php:14
$config
Definition: fraud_order.php:17
__construct(Filesystem $filesystem, Config $config)
Definition: Temporary.php:28
$relativePath
Definition: get.php:35
$filesystem