123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Framework\View\Design\Theme;
- use Magento\Framework\Config\Theme;
- /**
- * Value-object for a theme package
- */
- class ThemePackage
- {
- /**
- * Area
- *
- * @var string
- */
- private $area;
- /**
- * Vendor name
- *
- * @var string
- */
- private $vendor;
- /**
- * Theme name
- *
- * @var string
- */
- private $name;
- /**
- * Theme path key
- *
- * @var string
- */
- private $key;
- /**
- * Full path to the theme
- *
- * @var string
- */
- private $path;
- /**
- * Constructor
- *
- * @param string $key
- * @param string $path
- */
- public function __construct($key, $path)
- {
- $keyParts = explode(Theme::THEME_PATH_SEPARATOR, $key);
- if (count($keyParts) != 3) {
- throw new \UnexpectedValueException(
- "Theme's key does not correspond to required format: '<area>/<vendor>/<name>'"
- );
- }
- $this->key = $key;
- $this->path = $path;
- $this->area = $keyParts[0];
- $this->vendor = $keyParts[1];
- $this->name = $keyParts[2];
- }
- /**
- * Get area
- *
- * @return string
- */
- public function getArea()
- {
- return $this->area;
- }
- /**
- * Get vendor name
- *
- * @return string
- */
- public function getVendor()
- {
- return $this->vendor;
- }
- /**
- * Get theme name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Get path key
- *
- * @return string
- */
- public function getKey()
- {
- return $this->key;
- }
- /**
- * Get full path
- *
- * @return string
- */
- public function getPath()
- {
- return $this->path;
- }
- }
|