Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssetBuilder.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  private $area;
20 
24  private $theme;
25 
29  private $locale;
30 
34  private $module;
35 
39  private $path;
40 
44  private $repository;
45 
51  public function __construct(Repository $repository)
52  {
53  $this->repository = $repository;
54  }
55 
62  public function setArea($area)
63  {
64  $this->area = $area;
65  return $this;
66  }
67 
74  public function setTheme($theme)
75  {
76  $this->theme = $theme;
77  return $this;
78  }
79 
86  public function setLocale($locale)
87  {
88  $this->locale = $locale;
89  return $this;
90  }
91 
98  public function setModule($module)
99  {
100  $this->module = $module;
101  return $this;
102  }
103 
110  public function setPath($path)
111  {
112  $this->path = $path;
113  return $this;
114  }
115 
119  public function build()
120  {
121  $params = [
122  'area' => $this->area,
123  'theme' => $this->theme,
124  'locale' => $this->locale,
125  'module' => $this->module,
126  ];
127 
128  $asset = $this->repository->createAsset($this->path, $params);
129 
130  unset($this->path, $this->module, $this->locale, $this->theme, $this->area);
131 
132  return $asset;
133  }
134 }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18