Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FixtureManager.php
Go to the documentation of this file.
1 <?php
7 
11 
13 {
17  private $componentRegistrar;
18 
24  protected $_modulesDirectory;
25 
29  protected $_string;
30 
35  public function __construct(ComponentRegistrar $componentRegistrar, \Magento\Framework\Stdlib\StringUtils $string)
36  {
37  $this->componentRegistrar = $componentRegistrar;
38  $this->_string = $string;
39  }
40 
46  public function getFixture($fileId)
47  {
48  list($moduleName, $filePath) = \Magento\Framework\View\Asset\Repository::extractModule(
49  $this->normalizePath($fileId)
50  );
51  return $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName) . '/' . $filePath;
52  }
53 
62  public static function normalizePath($path)
63  {
64  $parts = explode('/', $path);
65  $result = [];
66 
67  foreach ($parts as $part) {
68  if ('..' === $part) {
69  if (!count($result) || ($result[count($result) - 1] == '..')) {
70  $result[] = $part;
71  } else {
72  array_pop($result);
73  }
74  } elseif ('.' !== $part) {
75  $result[] = $part;
76  }
77  }
78  return implode('/', $result);
79  }
80 }
$componentRegistrar
Definition: bootstrap.php:23
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__construct(ComponentRegistrar $componentRegistrar, \Magento\Framework\Stdlib\StringUtils $string)