123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
-
- namespace SCF\Core;
-
- class Breadcrumb {
-
- /**
- * @var string
- */
- private $pageTitle;
-
- /**
- * @var string
- */
- private $subTitle;
-
- /**
- * @var array
- */
- private $breadcrumb = [];
-
- /**
- * @var array
- */
- private $pageHeader = [];
-
- /**
- * @param $pageTitle
- */
- public function setPageTitle($pageTitle)
- {
- $this->pageTitle = $pageTitle;
- }
-
- /**
- * @param string $subTitle
- */
- public function setSubTitle($subTitle)
- {
- $this->subTitle = $subTitle;
- }
-
- /**
- * @return string
- */
- public function getPageTitle()
- {
- return $this->pageTitle;
- }
-
- /**
- * @return string
- */
- public function getSubTitle()
- {
- return $this->subTitle;
- }
-
- /**
- * @param array $breadcrumb
- */
- public function setBreadcrumb($breadcrumb)
- {
- $this->generateBreadcrumb($breadcrumb);
- }
-
- /**
- * @param array $breadcrumb
- */
- private function generateBreadcrumb($breadcrumb)
- {
-
- foreach ($breadcrumb as $key=>$value) {
- $this->breadcrumb[$value] = $key;
- }
- }
-
- /**
- * @return array
- */
- public function getBreadcrumb()
- {
- return $this->breadcrumb;
- }
-
- /**
- * @param array $pageHeaderArray
- */
- public function setPageHeader(array $pageHeaderArray)
- {
- $this->pageHeader = $this->genPageHeader($pageHeaderArray);
- }
-
- /**
- * @return array
- */
- public function getPageHeader(): array
- {
- return $this->pageHeader;
- }
-
- /**
- * @param array $pageHeaderArray
- * @return array
- */
- private function genPageHeader(array $pageHeaderArray)
- {
- $temp = [
- 'pageTitle' => $pageHeaderArray[0],
- 'subTitle' => $pageHeaderArray[1]
- ];
-
- return $temp;
- }
- }
|