Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MagentoComponent.php
Go to the documentation of this file.
1 <?php
7 
9 {
18  public static function matchMagentoComponent($key)
19  {
20  $typePattern = 'module|theme|language|framework';
21  $areaPattern = 'frontend|adminhtml';
22  $namePattern = '[a-z0-9_-]+';
23  $regex = '/^magento\/(?P<type>' . $typePattern . ')(?:-(?P<area>' . $areaPattern . '))?(?:-(?P<name>'
24  . $namePattern . '))?$/';
25  if (preg_match($regex, $key, $matches)) {
26  return $matches;
27  }
28  return [];
29  }
30 }