From 8d9842ee686ebae8463c3427d73395e0a5ee1e6f Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Fri, 22 Nov 2024 20:03:34 +0100 Subject: [PATCH 1/4] add interfaces --- .../core/Mage/Cms/Api/Data/BlockInterface.php | 46 +++ .../core/Mage/Cms/Api/Data/PageInterface.php | 79 ++++ app/code/core/Mage/Cms/Block/Page.php | 36 +- app/code/core/Mage/Cms/Block/Widget/Block.php | 2 +- .../core/Mage/Cms/Block/Widget/Page/Link.php | 34 +- app/code/core/Mage/Cms/Helper/Page.php | 7 +- app/code/core/Mage/Cms/Model/Block.php | 159 +++++++- app/code/core/Mage/Cms/Model/Page.php | 364 +++++++++++++++-- .../core/Mage/Cms/Model/Resource/Block.php | 10 +- .../Cms/Model/Resource/Block/Collection.php | 1 - .../core/Mage/Cms/Model/Resource/Page.php | 17 +- .../Cms/Model/Resource/Page/Collection.php | 13 +- .../core/Mage/Cms/Model/Wysiwyg/Config.php | 13 +- .../Mage/Core/Api/Data/WebsiteInterface.php | 39 ++ app/code/core/Mage/Core/Block/Abstract.php | 48 ++- app/code/core/Mage/Core/Block/Text.php | 77 +++- .../core/Mage/Core/Block/Text/List/Item.php | 2 +- .../core/Mage/Core/Block/Text/List/Link.php | 4 +- app/code/core/Mage/Core/Helper/String.php | 2 +- .../core/Mage/Core/Model/Domainpolicy.php | 2 +- app/code/core/Mage/Core/Model/Layout.php | 1 + app/code/core/Mage/Core/Model/Session.php | 27 +- app/code/core/Mage/Core/Model/Store.php | 30 +- app/code/core/Mage/Core/Model/Url.php | 9 +- app/code/core/Mage/Core/Model/Website.php | 135 +++++-- .../Mage/Log/Api/Data/VisitorInterface.php | 39 ++ .../core/Mage/Log/Model/Resource/Visitor.php | 12 +- app/code/core/Mage/Log/Model/Visitor.php | 374 +++++++++++++++--- 28 files changed, 1351 insertions(+), 231 deletions(-) create mode 100644 app/code/core/Mage/Cms/Api/Data/BlockInterface.php create mode 100644 app/code/core/Mage/Cms/Api/Data/PageInterface.php create mode 100644 app/code/core/Mage/Core/Api/Data/WebsiteInterface.php create mode 100644 app/code/core/Mage/Log/Api/Data/VisitorInterface.php diff --git a/app/code/core/Mage/Cms/Api/Data/BlockInterface.php b/app/code/core/Mage/Cms/Api/Data/BlockInterface.php new file mode 100644 index 00000000000..5af0b43f83d --- /dev/null +++ b/app/code/core/Mage/Cms/Api/Data/BlockInterface.php @@ -0,0 +1,46 @@ +hasData('page')) { - if ($this->getPageId()) { + $pageId = $this->getPageId(); + if ($pageId) { $page = Mage::getModel('cms/page') ->setStoreId(Mage::app()->getStore()->getId()) - ->load($this->getPageId(), 'identifier'); + ->load($pageId, 'identifier'); } else { $page = Mage::getSingleton('cms/page'); } $this->addModelTags($page); $this->setData('page', $page); } - return $this->getData('page'); + return $this->getDataByKey('page'); + } + + public function getPageId(): ?string + { + return $this->getDataByKey('page_id'); } /** @@ -51,15 +55,17 @@ public function getPage() */ protected function _prepareLayout() { - $page = $this->getPage(); + $page = $this->getPage(); + $pageTitle = $page->getTitle(); + $identifier = $page->getIdentifier(); + $breadcrumbsArray = []; - $breadcrumbs = null; // show breadcrumbs if (Mage::getStoreConfig('web/default/show_cms_breadcrumbs') && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) - && ($page->getIdentifier() !== Mage::getStoreConfig('web/default/cms_home_page')) - && ($page->getIdentifier() !== Mage::getStoreConfig('web/default/cms_no_route')) + && ($identifier !== Mage::getStoreConfig('web/default/cms_home_page')) + && ($identifier !== Mage::getStoreConfig('web/default/cms_no_route')) ) { $breadcrumbsArray[] = [ 'crumbName' => 'home', @@ -72,17 +78,17 @@ protected function _prepareLayout() $breadcrumbsArray[] = [ 'crumbName' => 'cms_page', 'crumbInfo' => [ - 'label' => $page->getTitle(), - 'title' => $page->getTitle() + 'label' => $pageTitle, + 'title' => $pageTitle, ] ]; $breadcrumbsObject = new Varien_Object(); - $breadcrumbsObject->setCrumbs($breadcrumbsArray); + $breadcrumbsObject->setData('crumbs', $breadcrumbsArray); Mage::dispatchEvent('cms_generate_breadcrumbs', ['breadcrumbs' => $breadcrumbsObject]); if ($breadcrumbs instanceof Mage_Page_Block_Html_Breadcrumbs) { - foreach ($breadcrumbsObject->getCrumbs() as $breadcrumbsItem) { + foreach ($breadcrumbsObject->getDataByKey('crumbs') as $breadcrumbsItem) { $breadcrumbs->addCrumb($breadcrumbsItem['crumbName'], $breadcrumbsItem['crumbInfo']); } } @@ -91,13 +97,13 @@ protected function _prepareLayout() /** @var Mage_Page_Block_Html $root */ $root = $this->getLayout()->getBlock('root'); if ($root) { - $root->addBodyClass('cms-' . $page->getIdentifier()); + $root->addBodyClass('cms-' . $identifier); } /** @var Mage_Page_Block_Html_Head $head */ $head = $this->getLayout()->getBlock('head'); if ($head) { - $head->setTitle($page->getTitle()); + $head->setTitle($pageTitle); $head->setKeywords($page->getMetaKeywords()); $head->setDescription($page->getMetaDescription()); } diff --git a/app/code/core/Mage/Cms/Block/Widget/Block.php b/app/code/core/Mage/Cms/Block/Widget/Block.php index a37d60e82f6..8ea225d13c9 100644 --- a/app/code/core/Mage/Cms/Block/Widget/Block.php +++ b/app/code/core/Mage/Cms/Block/Widget/Block.php @@ -53,7 +53,7 @@ protected function _construct() protected function _beforeToHtml() { parent::_beforeToHtml(); - $blockId = $this->getData('block_id'); + $blockId = $this->getDataByKey('block_id'); $blockHash = get_class($this) . $blockId; if (isset(self::$_widgetUsageMap[$blockHash])) { diff --git a/app/code/core/Mage/Cms/Block/Widget/Page/Link.php b/app/code/core/Mage/Cms/Block/Widget/Page/Link.php index 5b4a8b867ec..b4dff7cc28d 100644 --- a/app/code/core/Mage/Cms/Block/Widget/Page/Link.php +++ b/app/code/core/Mage/Cms/Block/Widget/Page/Link.php @@ -52,10 +52,10 @@ public function getHref() { if (!$this->_href) { $this->_href = ''; - if ($this->getData('href')) { - $this->_href = $this->getData('href'); - } elseif ($this->getData('page_id')) { - $this->_href = Mage::helper('cms/page')->getPageUrl($this->getData('page_id')); + if ($this->getDataByKey('href')) { + $this->_href = $this->getDataByKey('href'); + } elseif ($this->getDataByKey('page_id')) { + $this->_href = Mage::helper('cms/page')->getPageUrl($this->getDataByKey('page_id')); } } @@ -72,14 +72,14 @@ public function getTitle() { if (!$this->_title) { $this->_title = ''; - if ($this->getData('title') !== null) { + if ($this->getDataByKey('title') !== null) { // compare to null used here bc user can specify blank title - $this->_title = $this->getData('title'); - } elseif ($this->getData('page_id')) { - $this->_title = Mage::getResourceSingleton('cms/page')->getCmsPageTitleById($this->getData('page_id')); - } elseif ($this->getData('href')) { + $this->_title = $this->getDataByKey('title'); + } elseif ($this->getDataByKey('page_id')) { + $this->_title = Mage::getResourceSingleton('cms/page')->getCmsPageTitleById($this->getDataByKey('page_id')); + } elseif ($this->getDataByKey('href')) { $this->_title = Mage::getResourceSingleton('cms/page')->setStore(Mage::app()->getStore()) - ->getCmsPageTitleByIdentifier($this->getData('href')); + ->getCmsPageTitleByIdentifier($this->getDataByKey('href')); } } @@ -95,17 +95,17 @@ public function getTitle() */ public function getAnchorText() { - if ($this->getData('anchor_text')) { - $this->_anchorText = $this->getData('anchor_text'); + if ($this->getDataByKey('anchor_text')) { + $this->_anchorText = $this->getDataByKey('anchor_text'); } elseif ($this->getTitle()) { $this->_anchorText = $this->getTitle(); - } elseif ($this->getData('href')) { + } elseif ($this->getDataByKey('href')) { $this->_anchorText = Mage::getResourceSingleton('cms/page')->setStore(Mage::app()->getStore()) - ->getCmsPageTitleByIdentifier($this->getData('href')); - } elseif ($this->getData('page_id')) { - $this->_anchorText = Mage::getResourceSingleton('cms/page')->getCmsPageTitleById($this->getData('page_id')); + ->getCmsPageTitleByIdentifier($this->getDataByKey('href')); + } elseif ($this->getDataByKey('page_id')) { + $this->_anchorText = Mage::getResourceSingleton('cms/page')->getCmsPageTitleById($this->getDataByKey('page_id')); } else { - $this->_anchorText = $this->getData('href'); + $this->_anchorText = $this->getDataByKey('href'); } return $this->_anchorText; diff --git a/app/code/core/Mage/Cms/Helper/Page.php b/app/code/core/Mage/Cms/Helper/Page.php index bebb0d17cef..f73b66779a5 100644 --- a/app/code/core/Mage/Cms/Helper/Page.php +++ b/app/code/core/Mage/Cms/Helper/Page.php @@ -84,9 +84,10 @@ protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pag $action->addActionLayoutHandles(); if ($page->getRootTemplate()) { - $handle = ($page->getCustomRootTemplate() - && $page->getCustomRootTemplate() != 'empty' - && $inRange) ? $page->getCustomRootTemplate() : $page->getRootTemplate(); + $customRootTemplate = $page->getCustomRootTemplate(); + $handle = ($customRootTemplate + && $customRootTemplate != 'empty' + && $inRange) ? $customRootTemplate : $page->getRootTemplate(); $action->getLayout()->helper('page/layout')->applyHandle($handle); } diff --git a/app/code/core/Mage/Cms/Model/Block.php b/app/code/core/Mage/Cms/Model/Block.php index fe4e32ebeb3..00a29668dde 100644 --- a/app/code/core/Mage/Cms/Model/Block.php +++ b/app/code/core/Mage/Cms/Model/Block.php @@ -22,27 +22,11 @@ * @method Mage_Cms_Model_Resource_Block _getResource() * @method Mage_Cms_Model_Resource_Block getResource() * @method Mage_Cms_Model_Resource_Block_Collection getCollection() - * - * @method string getTitle() - * @method $this setTitle(string $value) - * @method string getIdentifier() - * @method $this setIdentifier(string $value) - * @method string getContent() - * @method $this setContent(string $value) - * @method string getCreationTime() - * @method $this setCreationTime(string $value) - * @method string getUpdateTime() - * @method $this setUpdateTime(string $value) - * @method int getIsActive() - * @method $this setIsActive(int $value) - * @method $this setStoreId(int $storeId) - * @method int getStoreId() - * @method int getBlockId() */ -class Mage_Cms_Model_Block extends Mage_Core_Model_Abstract +class Mage_Cms_Model_Block extends Mage_Core_Model_Abstract implements Mage_Cms_Api_Data_BlockInterface { - public const CACHE_TAG = 'cms_block'; - protected $_cacheTag = 'cms_block'; + public const CACHE_TAG = 'cms_block'; + protected $_cacheTag = 'cms_block'; protected function _construct() { @@ -65,4 +49,141 @@ protected function _beforeSave() Mage::helper('cms')->__('The static block content cannot contain directive with its self.') ); } + + /** + * @api + */ + public function getBlockId(): ?int + { + $blockId = $this->getDataByKey(self::DATA_ID); + return is_null($blockId) ? null : (int) $blockId; + } + + /** + * @api + * @return $this + */ + public function setBlockId(?int $blockId) + { + return $this->setData(self::DATA_ID, $blockId); + } + + /** + * @api + */ + public function getContent(): ?string + { + return $this->getDataByKey(self::DATA_CONTENT); + } + + /** + * @api + * @return $this + */ + public function setContent(?string $content) + { + return $this->setData(self::DATA_CONTENT, $content); + } + + /** + * @api + */ + public function getCreationTime(): ?string + { + return $this->getDataByKey(self::DATA_CREATION_TIME); + } + + /** + * @api + * @return $this + */ + public function setCreationTime(?string $time) + { + return $this->setData(self::DATA_CREATION_TIME, $time); + } + + /** + * @api + */ + public function getIsActive(): int + { + return $this->getDataByKey(self::DATA_IS_ACTIVE); + } + + /** + * @api + * @return $this + */ + public function setIsActive(int $value) + { + return $this->setData(self::DATA_IS_ACTIVE, $value); + } + + /** + * @api + */ + public function getIdentifier(): string + { + return $this->getDataByKey(self::DATA_IDENTIFIER); + } + + /** + * @api + * @return $this + */ + public function setIdentifier(string $identifier) + { + return $this->setData(self::DATA_IDENTIFIER, $identifier); + } + + /** + * @api + */ + public function getTitle(): string + { + return $this->getDataByKey(self::DATA_TITLE); + } + + /** + * @api + * @return $this + */ + public function setTitle(string $title) + { + return $this->setData(self::DATA_TITLE, $title); + } + + /** + * @api + */ + public function getStoreId(): int + { + return $this->getDataByKey(self::DATA_STORE_ID); + } + + /** + * @api + * @return $this + */ + public function setStoreId(int $storeId) + { + return $this->setData(self::DATA_STORE_ID, $storeId); + } + + /** + * @api + */ + public function getUpdateTime(): ?string + { + return $this->getDataByKey(self::DATA_UPDATE_TIME); + } + + /** + * @api + * @return $this + */ + public function setUpdateTime(?string $time) + { + return $this->setData(self::DATA_UPDATE_TIME, $time); + } } diff --git a/app/code/core/Mage/Cms/Model/Page.php b/app/code/core/Mage/Cms/Model/Page.php index e414cafac56..8c4491764b1 100644 --- a/app/code/core/Mage/Cms/Model/Page.php +++ b/app/code/core/Mage/Cms/Model/Page.php @@ -23,49 +23,12 @@ * @method Mage_Cms_Model_Resource_Page getResource() * @method Mage_Cms_Model_Resource_Page_Collection getCollection() * - * @method string getContentHeading() - * @method $this setContentHeading(string $value) - * @method string getContent() - * @method $this setContent(string $value) - * @method string getCreationTime() - * @method $this setCreationTime(string $value) - * @method int getIsActive() - * @method $this setIsActive(int $value) - * @method string getLayoutUpdateXml() - * @method $this setLayoutUpdateXml(string $value) - * @method bool hasCreationTime() - * @method string getCustomTheme() - * @method $this setCustomTheme(string $value) - * @method string getCustomRootTemplate() - * @method $this setCustomRootTemplate(string $value) - * @method string getCustomLayoutUpdateXml() - * @method $this setCustomLayoutUpdateXml(string $value) - * @method string getCustomThemeFrom() - * @method $this setCustomThemeFrom(string $value) - * @method string getCustomThemeTo() - * @method $this setCustomThemeTo(string $value) - * @method string getIdentifier() - * @method $this setIdentifier(string $value) - * @method string getMetaDescription() - * @method $this setMetaDescription(string $value) - * @method string getMetaKeywords() - * @method $this setMetaKeywords(string $value) * @method string getPreviewUrl() - * @method string getRootTemplate() - * @method $this setRootTemplate(string $value) - * @method $this setStoreId(int $value) - * @method int getSortOrder() - * @method $this setSortOrder(int $value) * @method bool hasStores() * @method array getStores() * @method string getStoreCode() - * @method string getStoreId() - * @method string getTitle() - * @method $this setTitle(string $value) - * @method string getUpdateTime() - * @method $this setUpdateTime(string $value) */ -class Mage_Cms_Model_Page extends Mage_Core_Model_Abstract +class Mage_Cms_Model_Page extends Mage_Core_Model_Abstract implements Mage_Cms_Api_Data_PageInterface { public const NOROUTE_PAGE_ID = 'no-route'; @@ -179,4 +142,329 @@ public function isUsedInStoreConfig(?array $paths = []): bool { return $this->_getResource()->isUsedInStoreConfig($this, $paths); } + + public function hasCreationTime(): bool + { + return $this->hasData(self::DATA_CREATION_TIME); + } + + /** + * @api + */ + public function getPageId(): ?int + { + $pageId = $this->getDataByKey(self::DATA_ID); + return is_null($pageId) ? null : (int) $pageId; + } + + /** + * @api + * @return $this + */ + public function setPageId(?int $pageId) + { + return $this->setData(self::DATA_ID, $pageId); + } + + /** + * @api + */ + public function getContent(): ?string + { + return $this->getDataByKey(self::DATA_CONTENT); + } + + /** + * @api + * @return $this + */ + public function setContent(?string $content) + { + return $this->setData(self::DATA_CONTENT, $content); + } + + /** + * @api + */ + public function getContentHeading(): ?string + { + return $this->getDataByKey(self::DATA_CONTENT_HEADING); + } + + /** + * @api + * @return $this + */ + public function setContentHeading(?string $heading) + { + return $this->setData(self::DATA_CONTENT_HEADING, $heading); + } + + /** + * @api + */ + public function getCreationTime(): ?string + { + return $this->getDataByKey(self::DATA_CREATION_TIME); + } + + /** + * @api + * @return $this + */ + public function setCreationTime(?string $value) + { + return $this->setData(self::DATA_CREATION_TIME, $value); + } + + /** + * @api + */ + public function getCustomLayoutUpdateXml(): ?string + { + return $this->getDataByKey(self::DATA_CUSTOM_LAYOUT_UPDATE_XML); + } + + /** + * @api + * @return $this + */ + public function setCustomLayoutUpdateXml(?string $xml) + { + return $this->setData(self::DATA_CUSTOM_LAYOUT_UPDATE_XML, $xml); + } + + /** + * @api + */ + public function getCustomRootTemplate(): ?string + { + return $this->getDataByKey(self::DATA_CUSTOM_ROOT_TEMPLATE); + } + + /** + * @api + * @return $this + */ + public function setCustomRootTemplate(?string $template) + { + return $this->setData(self::DATA_CUSTOM_ROOT_TEMPLATE, $template); + } + + /** + * @api + */ + public function getCustomTheme(): ?string + { + return $this->getDataByKey(self::DATA_CUSTOM_THEME); + } + + /** + * @api + * @return $this + */ + public function setCustomTheme(?string $from) + { + return $this->setData(self::DATA_CUSTOM_THEME, $from); + } + + /** + * @api + */ + public function getCustomThemeFrom(): ?string + { + return $this->getDataByKey(self::DATA_CUSTOM_THEME_FROM); + } + + /** + * @api + * @return $this + */ + public function setCustomThemeFrom(?string $from) + { + return $this->setData(self::DATA_CUSTOM_THEME_FROM, $from); + } + + /** + * @api + */ + public function getCustomThemeTo(): ?string + { + return $this->getDataByKey(self::DATA_CUSTOM_THEME_TO); + } + + /** + * @api + * @return $this + */ + public function setCustomThemeTo(?string $to) + { + return $this->setData(self::DATA_CUSTOM_THEME_TO, $to); + } + + /** + * @api + */ + public function getIdentifier(): ?string + { + return $this->getDataByKey(self::DATA_IDENTIFIER); + } + + /** + * @api + * @return $this + */ + public function setIdentifier(?string $identifier) + { + return $this->setData(self::DATA_IDENTIFIER, $identifier); + } + + /** + * @api + */ + public function getIsActive(): int + { + return (int) $this->getDataByKey(self::DATA_IS_ACTIVE); + } + + /** + * @api + * @return $this + */ + public function setIsActive(int $value) + { + return $this->setData(self::DATA_IS_ACTIVE, $value); + } + + /** + * @api + */ + public function getLayoutUpdateXml(): ?string + { + return $this->getDataByKey(self::DATA_LAYOUT_UPDATE_XML); + } + + /** + * @api + * @return $this + */ + public function setLayoutUpdateXml(?string $xml) + { + return $this->setData(self::DATA_LAYOUT_UPDATE_XML, $xml); + } + + /** + * @api + */ + public function getMetaDescription(): ?string + { + return $this->getDataByKey(self::DATA_META_DESCRIPTION); + } + + /** + * @api + * @return $this + */ + public function setMetaDescription(?string $description) + { + return $this->setData(self::DATA_META_DESCRIPTION, $description); + } + + /** + * @api + */ + public function getMetaKeywords(): ?string + { + return $this->getDataByKey(self::DATA_META_KEYWORDS); + } + + /** + * @api + * @return $this + */ + public function setMetaKeywords(?string $keywords) + { + return $this->setData(self::DATA_META_KEYWORDS, $keywords); + } + + /** + * @api + */ + public function getRootTemplate(): ?string + { + return $this->getDataByKey(self::DATA_ROOT_TEMPLATE); + } + + /** + * @api + * @return $this + */ + public function setRootTemplate(?string $template) + { + return $this->setData(self::DATA_ROOT_TEMPLATE, $template); + } + + /** + * @api + */ + public function getSortOrder(): int + { + return (int) $this->getDataByKey(self::DATA_SORT_ORDER); + } + + /** + * @api + * @return $this + */ + public function setSortOrder(int $position) + { + return $this->setData(self::DATA_SORT_ORDER, $position); + } + + /** + * @api + */ + public function getStoreId(): int + { + return (int) $this->getDataByKey(self::DATA_STORE_ID); + } + + /** + * @api + * @return $this + */ + public function setStoreId(int $storeId) + { + return $this->setData(self::DATA_STORE_ID, $storeId); + } + + public function getTitle(): ?string + { + return $this->getDataByKey(self::DATA_TITLE); + } + + /** + * @return $this + */ + public function setTitle(?string $title) + { + return $this->setData(self::DATA_TITLE, $title); + } + + /** + * @api + */ + public function getUpdateTime(): ?string + { + return $this->getDataByKey(self::DATA_UPDATE_TIME); + } + + /** + * @api + * @return $this + */ + public function setUpdateTime(?string $time) + { + return $this->setData(self::DATA_UPDATE_TIME, $time); + } } diff --git a/app/code/core/Mage/Cms/Model/Resource/Block.php b/app/code/core/Mage/Cms/Model/Resource/Block.php index f418a538ed5..76e8f77533c 100644 --- a/app/code/core/Mage/Cms/Model/Resource/Block.php +++ b/app/code/core/Mage/Cms/Model/Resource/Block.php @@ -27,6 +27,7 @@ protected function _construct() } /** + * @param Mage_Cms_Model_Block $object * @inheritDoc */ protected function _beforeDelete(Mage_Core_Model_Abstract $object) @@ -43,6 +44,7 @@ protected function _beforeDelete(Mage_Core_Model_Abstract $object) /** * Perform operations before object save * + * @param Mage_Cms_Model_Block $object * @return $this * @throws Mage_Core_Exception */ @@ -60,6 +62,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) } /** + * @param Mage_Cms_Model_Block $object * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) @@ -97,6 +100,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) } /** + * @param Mage_Cms_Model_Block $object * @inheritDoc */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) @@ -109,6 +113,7 @@ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) } /** + * @param Mage_Cms_Model_Block $object * @inheritDoc */ protected function _afterLoad(Mage_Core_Model_Abstract $object) @@ -156,6 +161,7 @@ protected function _getLoadSelect($field, $value, $object) /** * Check for unique of identifier of block to selected store(s). * + * @param Mage_Cms_Model_Block $object * @return bool */ public function getIsUniqueBlockToStores(Mage_Core_Model_Abstract $object) @@ -163,7 +169,7 @@ public function getIsUniqueBlockToStores(Mage_Core_Model_Abstract $object) if (Mage::app()->isSingleStoreMode()) { $stores = [Mage_Core_Model_App::ADMIN_STORE_ID]; } else { - $stores = (array)$object->getData('stores'); + $stores = (array)$object->getDataByKey('stores'); } $select = $this->_getReadAdapter()->select() @@ -172,7 +178,7 @@ public function getIsUniqueBlockToStores(Mage_Core_Model_Abstract $object) ['cbs' => $this->getTable('cms/block_store')], 'cb.block_id = cbs.block_id', [] - )->where('cb.identifier = ?', $object->getData('identifier')) + )->where('cb.identifier = ?', $object->getDataByKey('identifier')) ->where('cbs.store_id IN (?)', $stores); if ($object->getId()) { diff --git a/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php b/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php index cdb8d2bc9d6..deecc02cbfe 100644 --- a/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php +++ b/app/code/core/Mage/Cms/Model/Resource/Block/Collection.php @@ -23,7 +23,6 @@ class Mage_Cms_Model_Resource_Block_Collection extends Mage_Core_Model_Resource_ { /** * Define resource model - * */ protected function _construct() { diff --git a/app/code/core/Mage/Cms/Model/Resource/Page.php b/app/code/core/Mage/Cms/Model/Resource/Page.php index a80b20c4221..daa41f5dd6a 100644 --- a/app/code/core/Mage/Cms/Model/Resource/Page.php +++ b/app/code/core/Mage/Cms/Model/Resource/Page.php @@ -75,7 +75,11 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) * If they are empty we need to convert them into DB * type NULL so in DB they will be empty and not some default value */ - foreach (['custom_theme_from', 'custom_theme_to'] as $field) { + $dates = [ + Mage_Cms_Api_Data_PageInterface::DATA_CUSTOM_THEME_FROM, + Mage_Cms_Api_Data_PageInterface::DATA_CUSTOM_THEME_TO, + ]; + foreach ($dates as $field) { $value = !$object->getData($field) ? null : $object->getData($field); $object->setData($field, $this->formatDate($value)); } @@ -83,7 +87,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) if (!$object->getIsActive()) { $isUsedInConfig = $this->getUsedInStoreConfigCollection($object); if ($isUsedInConfig->count()) { - $object->setIsActive(true); + $object->setIsActive(1); Mage::getSingleton('adminhtml/session')->addWarning( Mage::helper('cms')->__( 'Cannot disable page, it is used in configuration "%s".', @@ -249,10 +253,10 @@ public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object) if (!$object->hasStores()) { $stores = [Mage_Core_Model_App::ADMIN_STORE_ID]; } else { - $stores = (array)$object->getData('stores'); + $stores = (array)$object->getDataByKey('stores'); } - $select = $this->_getLoadByIdentifierSelect($object->getData('identifier'), $stores); + $select = $this->_getLoadByIdentifierSelect($object->getDataByKey('identifier'), $stores); if ($object->getId()) { $select->where('cps.page_id <> ?', $object->getId()); @@ -272,18 +276,17 @@ public function getIsUniquePageToStores(Mage_Core_Model_Abstract $object) */ protected function isNumericPageIdentifier(Mage_Core_Model_Abstract $object) { - return preg_match('/^[0-9]+$/', $object->getData('identifier')); + return preg_match('/^[0-9]+$/', $object->getDataByKey('identifier')); } /** * Check whether page identifier is valid * - * * @return int|false */ protected function isValidPageIdentifier(Mage_Core_Model_Abstract $object) { - return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('identifier')); + return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getDataByKey('identifier')); } public function getUsedInStoreConfigCollection(Mage_Cms_Model_Page $page, ?array $paths = []): Mage_Core_Model_Resource_Db_Collection_Abstract diff --git a/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php b/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php index 0b26cc8e353..cd15b14a965 100644 --- a/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php +++ b/app/code/core/Mage/Cms/Model/Resource/Page/Collection.php @@ -30,7 +30,6 @@ class Mage_Cms_Model_Resource_Page_Collection extends Mage_Core_Model_Resource_D /** * Define resource model - * */ protected function _construct() { @@ -60,13 +59,13 @@ public function toOptionIdArray() $res = []; $existingIdentifiers = []; foreach ($this as $item) { - $identifier = $item->getData('identifier'); + $identifier = $item->getDataByKey('identifier'); $data['value'] = $identifier; - $data['label'] = $item->getData('title'); + $data['label'] = $item->getDataByKey('title'); if (in_array($identifier, $existingIdentifiers)) { - $data['value'] .= '|' . $item->getData('page_id'); + $data['value'] .= '|' . $item->getDataByKey('page_id'); } else { $existingIdentifiers[] = $identifier; } @@ -104,15 +103,15 @@ protected function _afterLoad() if ($result = $connection->fetchPairs($select)) { foreach ($this as $item) { - if (!isset($result[$item->getData('page_id')])) { + if (!isset($result[$item->getDataByKey('page_id')])) { continue; } - if ($result[$item->getData('page_id')] == 0) { + if ($result[$item->getDataByKey('page_id')] == 0) { $stores = Mage::app()->getStores(false, true); $storeId = current($stores)->getId(); $storeCode = key($stores); } else { - $storeId = $result[$item->getData('page_id')]; + $storeId = $result[$item->getDataByKey('page_id')]; $storeCode = Mage::app()->getStore($storeId)->getCode(); } $item->setData('_first_store_id', $storeId); diff --git a/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php b/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php index 0b33c163187..d3c3abff59d 100644 --- a/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php +++ b/app/code/core/Mage/Cms/Model/Wysiwyg/Config.php @@ -88,16 +88,15 @@ public function getConfig($data = []) 'plugins' => [], 'lang' => $lang ]); - $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url'))); + $config->setData('directives_url_quoted', preg_quote($config->getDataByKey('directives_url'))); if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) { + $configNode = Mage::getConfig()->getNode('adminhtml/cms/browser'); $config->addData([ - 'add_images' => true, - 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg_images/index'), - 'files_browser_window_width' - => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width'), - 'files_browser_window_height' - => (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height'), + 'add_images' => true, + 'files_browser_window_url' => Mage::getSingleton('adminhtml/url')->getUrl('*/cms_wysiwyg_images/index'), + 'files_browser_window_width' => (int) $configNode->window_width, + 'files_browser_window_height' => (int) $configNode->window_height, ]); } diff --git a/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php b/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php new file mode 100644 index 00000000000..1c36d277d27 --- /dev/null +++ b/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php @@ -0,0 +1,39 @@ +setData('cache_key', $cacheKey); + } + + /** + * Get tags array for saving cached * * @return array */ @@ -1411,6 +1414,14 @@ public function getCacheTags() return array_unique($tags); } + /** + * @return $this + */ + public function setCacheTags(array $cacheTags) + { + return $this->setData('cache_tags', $cacheTags); + } + /** * Add tag to block * @@ -1453,6 +1464,14 @@ public function getCacheLifetime() return $this->getData('cache_lifetime'); } + /** + * @return $this + */ + public function setCacheLifetime($lifetime) + { + return $this->setData('cache_lifetime', $lifetime); + } + /** * Retrieve Session Form Key * @@ -1577,4 +1596,21 @@ protected function _isSecure() { return $this->_getApp()->getFrontController()->getRequest()->isSecure(); } + + /** + * @return string|null + */ + public function getTemplate() + { + return $this->getDataByKey('template'); + } + + /** + * @param string $template + * @return $this + */ + public function setTemplate($template) + { + return $this->setData('template', $template); + } } diff --git a/app/code/core/Mage/Core/Block/Text.php b/app/code/core/Mage/Core/Block/Text.php index 428af4a0db1..2e6abbf0ab1 100644 --- a/app/code/core/Mage/Core/Block/Text.php +++ b/app/code/core/Mage/Core/Block/Text.php @@ -18,26 +18,33 @@ * * @category Mage * @package Mage_Core - * - * @method array getLiParams() - * @method $this setLiParams(array $value) - * @method array getAParams() - * @method $this setAParams(array $value) - * @method string getInnerText() - * @method $this setInnerText(string $value) - * @method string getAfterText() - * @method $this setAfterText(string $value) */ class Mage_Core_Block_Text extends Mage_Core_Block_Abstract { + public function getAfterText(): ?string + { + return $this->getData('after_text'); + } + /** - * @param string $text * @return $this */ - public function setText($text) + public function setAfterText(?string $text) { - $this->setData('text', $text); - return $this; + return $this->setData('after_text', $text); + } + + public function getInnerText(): ?string + { + return $this->getData('inner_text'); + } + + /** + * @return $this + */ + public function setInnerText(?string $text) + { + return $this->setData('inner_text', $text); } /** @@ -48,6 +55,16 @@ public function getText() return $this->getData('text'); } + /** + * @param string $text + * @return $this + */ + public function setText($text) + { + $this->setData('text', $text); + return $this; + } + /** * @param string $text * @param bool $before @@ -61,6 +78,40 @@ public function addText($text, $before = false) } } + /** + * @return string|array + */ + public function getAParams() + { + return $this->getData('a_params'); + } + + /** + * @param string|array $params + * @return $this + */ + public function setAParams($params) + { + return $this->setData('a_params', $params); + } + + /** + * @return string|array + */ + public function getLiParams() + { + return $this->getData('li_params'); + } + + /** + * @param string|array $params + * @return $this + */ + public function setLiParams($params) + { + return $this->setData('li_params', $params); + } + /** * @return string */ diff --git a/app/code/core/Mage/Core/Block/Text/List/Item.php b/app/code/core/Mage/Core/Block/Text/List/Item.php index 6dfa799ac3e..133fe00aa41 100644 --- a/app/code/core/Mage/Core/Block/Text/List/Item.php +++ b/app/code/core/Mage/Core/Block/Text/List/Item.php @@ -23,7 +23,7 @@ class Mage_Core_Block_Text_List_Item extends Mage_Core_Block_Text { /** * @param array $liParams - * @param array $innerText + * @param string $innerText * @return $this */ public function setLink($liParams, $innerText) diff --git a/app/code/core/Mage/Core/Block/Text/List/Link.php b/app/code/core/Mage/Core/Block/Text/List/Link.php index 83c7464a8af..af58f91eb54 100644 --- a/app/code/core/Mage/Core/Block/Text/List/Link.php +++ b/app/code/core/Mage/Core/Block/Text/List/Link.php @@ -22,8 +22,8 @@ class Mage_Core_Block_Text_List_Link extends Mage_Core_Block_Text { /** - * @param array $liParams - * @param array $aParams + * @param string|array $liParams + * @param string|array $aParams * @param string $innerText * @param string $afterText * @return $this diff --git a/app/code/core/Mage/Core/Helper/String.php b/app/code/core/Mage/Core/Helper/String.php index 689fd0fa3d2..efaa8eb037d 100644 --- a/app/code/core/Mage/Core/Helper/String.php +++ b/app/code/core/Mage/Core/Helper/String.php @@ -271,7 +271,7 @@ public function splitWords($str, $uniqueOnly = false, $maxWordLength = 0, $wordS /** * Clean non UTF-8 characters * - * @param string $string + * @param string|null $string * @return string */ public function cleanString($string) diff --git a/app/code/core/Mage/Core/Model/Domainpolicy.php b/app/code/core/Mage/Core/Model/Domainpolicy.php index d0e0ca5aaf8..d1f15abfa1b 100644 --- a/app/code/core/Mage/Core/Model/Domainpolicy.php +++ b/app/code/core/Mage/Core/Model/Domainpolicy.php @@ -63,7 +63,7 @@ public function __construct($options = []) */ public function addDomainPolicyHeader(Varien_Event_Observer $observer) { - $action = $observer->getControllerAction(); + $action = $observer->getDataByKey('controller_action'); $policy = null; if ($action->getLayout()->getArea() == 'adminhtml') { diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php index 47d2fd4ffc8..90b8439bf09 100644 --- a/app/code/core/Mage/Core/Model/Layout.php +++ b/app/code/core/Mage/Core/Model/Layout.php @@ -581,6 +581,7 @@ public function getOutput() */ public function getMessagesBlock() { + /** @var Mage_Core_Block_Messages $block */ $block = $this->getBlock('messages'); if ($block) { return $block; diff --git a/app/code/core/Mage/Core/Model/Session.php b/app/code/core/Mage/Core/Model/Session.php index a523fa59f43..01f6d459351 100644 --- a/app/code/core/Mage/Core/Model/Session.php +++ b/app/code/core/Mage/Core/Model/Session.php @@ -30,7 +30,6 @@ * @method array getOrderIds() * @method $this setOrderIds(array $value) * @method $this setJustVotedPoll(int $value) - * @method $this setLastUrl(string $value) */ class Mage_Core_Model_Session extends Mage_Core_Model_Session_Abstract { @@ -74,4 +73,30 @@ public function validateFormKey($formKey) { return ($formKey === $this->getFormKey()); } + + public function getLastUrl(): ?string + { + return $this->getDataByKey('last_url'); + } + + /** + * @return $this + */ + public function setLastUrl(?string $storeId) + { + return $this->setData('last_url', $storeId); + } + + public function getVisitorData(): ?array + { + return $this->getDataByKey('visitor_data'); + } + + /** + * @return $this + */ + public function setVisitorData(?array $data) + { + return $this->setData('visitor_data', $data); + } } diff --git a/app/code/core/Mage/Core/Model/Store.php b/app/code/core/Mage/Core/Model/Store.php index f9deb4b67e6..78afa83fb3e 100644 --- a/app/code/core/Mage/Core/Model/Store.php +++ b/app/code/core/Mage/Core/Model/Store.php @@ -26,12 +26,8 @@ * * @method $this setCode(string $value) * @method $this setGroupId(int $value) - * @method string getHomeUrl() - * @method $this setHomeUrl(string $value) * @method $this setIsActive(int $value) - * @method $this setLocaleCode(string $value) * @method string getLanguageCode() - * @method string getLocaleCode() * @method $this setName(string $value) * @method $this setRootCategory(Mage_Catalog_Model_Category $value) * @method $this setRootCategoryPath(string $value) @@ -1236,4 +1232,30 @@ public function getFrontendName() } return $this->_frontendName; } + + public function getHomeUrl(): ?string + { + return $this->getDataByKey('home_url'); + } + + /** + * @return $this + */ + public function setHomeUrl(?string $localeCode) + { + return $this->setData('home_url', $localeCode); + } + + public function getLocaleCode(): ?string + { + return $this->getDataByKey('locale_code'); + } + + /** + * @return $this + */ + public function setLocaleCode(?string $localeCode) + { + return $this->setData('locale_code', $localeCode); + } } diff --git a/app/code/core/Mage/Core/Model/Url.php b/app/code/core/Mage/Core/Model/Url.php index 097127a9a6b..eb9b5823cd6 100644 --- a/app/code/core/Mage/Core/Model/Url.php +++ b/app/code/core/Mage/Core/Model/Url.php @@ -325,23 +325,24 @@ public function getSecure() } $store = $this->getStore(); + $isAdmin = $store->isAdmin(); - if ($store->isAdmin() && !$store->isAdminUrlSecure()) { + if ($isAdmin && !$store->isAdminUrlSecure()) { return false; } - if (!$store->isAdmin() && !$store->isFrontUrlSecure()) { + if (!$isAdmin && !$store->isFrontUrlSecure()) { return false; } if (!$this->hasData('secure')) { - if ($this->getType() == Mage_Core_Model_Store::URL_TYPE_LINK && !$store->isAdmin()) { + if ($this->getType() == Mage_Core_Model_Store::URL_TYPE_LINK && !$isAdmin) { $pathSecure = Mage::getConfig()->shouldUrlBeSecure('/' . $this->getActionPath()); $this->setData('secure', $pathSecure); } else { $this->setData('secure', true); } } - return $this->getData('secure'); + return $this->getDataByKey('secure'); } /** diff --git a/app/code/core/Mage/Core/Model/Website.php b/app/code/core/Mage/Core/Model/Website.php index a55ca2a8bf7..fbf510944b8 100644 --- a/app/code/core/Mage/Core/Model/Website.php +++ b/app/code/core/Mage/Core/Model/Website.php @@ -24,23 +24,13 @@ * @method Mage_Core_Model_Resource_Website_Collection getCollection() * @method Mage_Core_Model_Resource_Website_Collection getResourceCollection() * - * @method $this setCode(string $value) - * @method string getName() - * @method $this setName(string $value) - * @method int getSortOrder() - * @method $this setSortOrder(int $value) - * @method $this setDefaultGroupId(int $value) - * @method int getIsDefault() - * @method $this setIsDefault(int $value) * @method int getGroupId() * @method int getStoreId() * @method $this setStoreId(int $value) * @method array getStoresIds() * @method bool hasWebsiteId() - * @method int getWebsiteId() - * @method bool hasDefaultGroupId() */ -class Mage_Core_Model_Website extends Mage_Core_Model_Abstract +class Mage_Core_Model_Website extends Mage_Core_Model_Abstract implements Mage_Core_Api_Data_WebsiteInterface { public const ENTITY = 'core_website'; public const CACHE_TAG = 'website'; @@ -315,7 +305,7 @@ public function getGroupsCount() */ public function getDefaultGroup() { - if (!$this->hasDefaultGroupId()) { + if (!$this->hasData('default_group_id')) { return false; } if (is_null($this->_groups)) { @@ -456,22 +446,6 @@ public function getWebsiteGroupStore() return implode('-', [$this->getWebsiteId(), $this->getGroupId(), $this->getStoreId()]); } - /** - * @return int - */ - public function getDefaultGroupId() - { - return $this->_getData('default_group_id'); - } - - /** - * @return string - */ - public function getCode() - { - return $this->_getData('code'); - } - /** * @inheritDoc */ @@ -563,4 +537,109 @@ public function isReadOnly($value = null) } return $this->_isReadOnly; } + + /** + * @api + */ + public function getWebsiteId(): ?int + { + $websiteId = $this->getDataByKey(self::DATA_ID); + return is_null($websiteId) ? null : (int) $websiteId; + } + + /** + * @api + * @return $this + */ + public function setWebsiteId(?int $value) + { + return $this->setData(self::DATA_ID, $value); + } + + /** + * @api + * @return string + */ + public function getCode() + { + return $this->_getData(self::DATA_CODE); + } + + /** + * @api + * @return $this + */ + public function setCode(?string $code) + { + return $this->setData(self::DATA_CODE, $code); + } + + /** + * @api + * @return int + */ + public function getDefaultGroupId() + { + return (int) $this->_getData(self::DATA_DEFAULT_GROUP_ID); + } + + /** + * @api + * @return $this + */ + public function setDefaultGroupId(int $value) + { + return $this->setData(self::DATA_DEFAULT_GROUP_ID, $value); + } + + /** + * @api + */ + public function getIsDefault(): ?int + { + return (int) $this->_getData(self::DATA_IS_DEFAULT); + } + + /** + * @api + * @return $this + */ + public function setIsDefault(?int $value) + { + return $this->setData(self::DATA_IS_DEFAULT, $value); + } + + /** + * @api + */ + public function getName(): ?string + { + return $this->_getData(self::DATA_NAME); + } + + /** + * @api + * @return $this + */ + public function setName(?string $name) + { + return $this->setData(self::DATA_NAME, $name); + } + + /** + * @api + */ + public function getSortOrder(): int + { + return (int) $this->_getData(self::DATA_SORT_ORDER); + } + + /** + * @api + * @return $this + */ + public function setSortOrder(int $position) + { + return $this->setData(self::DATA_SORT_ORDER, $position); + } } diff --git a/app/code/core/Mage/Log/Api/Data/VisitorInterface.php b/app/code/core/Mage/Log/Api/Data/VisitorInterface.php new file mode 100644 index 00000000000..74d282401eb --- /dev/null +++ b/app/code/core/Mage/Log/Api/Data/VisitorInterface.php @@ -0,0 +1,39 @@ +insert($this->getTable('log/url_info_table'), $bind); - $visitor->setLastUrlId($adapter->lastInsertId($this->getTable('log/url_info_table'))); + $visitor->setLastUrlId((int) $adapter->lastInsertId($this->getTable('log/url_info_table'))); return $this; } @@ -83,6 +84,7 @@ protected function _saveUrlInfo($visitor) /** * Save url info before save * + * @param Mage_Log_Model_Visitor $visitor * @return $this */ protected function _beforeSave(Mage_Core_Model_Abstract $visitor) @@ -99,6 +101,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $visitor) /** * Actions after save * + * @param Mage_Log_Model_Visitor $visitor * @return $this */ protected function _afterSave(Mage_Core_Model_Abstract $visitor) @@ -130,6 +133,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $visitor) /** * Perform actions after object load * + * @param Mage_Log_Model_Visitor $object * @return $this */ protected function _afterLoad(Mage_Core_Model_Abstract $object) @@ -152,8 +156,8 @@ protected function _afterLoad(Mage_Core_Model_Abstract $object) /** * Saving visitor information * - * @param Mage_Core_Model_Abstract|Mage_Log_Model_Visitor $visitor - * @return $this + * @param Mage_Log_Model_Visitor $visitor + * @return $this */ protected function _saveVisitorInfo($visitor) { diff --git a/app/code/core/Mage/Log/Model/Visitor.php b/app/code/core/Mage/Log/Model/Visitor.php index 12b43827ee4..af6aa147f55 100644 --- a/app/code/core/Mage/Log/Model/Visitor.php +++ b/app/code/core/Mage/Log/Model/Visitor.php @@ -18,42 +18,8 @@ * @package Mage_Log * * @method Mage_Log_Model_Resource_Visitor getResource() - * @method int getCustomerId() - * @method $this setCustomerId(int $value) - * @method int getCustomerLogId() - * @method $this setCustomerLogId(int $value) - * @method bool getDoCustomerLogin() - * @method $this setDoCustomerLogin(bool $value) - * @method bool getDoCustomerLogout() - * @method $this setDoCustomerLogout(bool $value) - * @method bool getDoQuoteCreate() - * @method $this setDoQuoteCreate(bool $value) - * @method bool getDoQuoteDestroy() - * @method $this setDoQuoteDestroy(bool $value) - * @method $this setFirstVisitAt(string $value) - * @method string getHttpAcceptCharset() - * @method string getHttpAcceptLanguage() - * @method string getHttpHost() - * @method string getHttpReferer() - * @method string getHttpSecure() - * @method string getHttpUserAgent() - * @method bool getIsNewVisitor() - * @method $this setIsNewVisitor(bool $value) - * @method $this setLastVisitAt(string $value) - * @method int getLastUrlId() - * @method $this setLastUrlId(int $value) - * @method int getQuoteId() - * @method $this setQuoteId(int $value) - * @method string getRemoteAddr() - * @method string getRequestUri() - * @method string getServerAddr() - * @method string getSessionId() - * @method $this setSessionId(string $value) - * @method int getStoreId() - * @method $this setStoreId(int $value) - * @method int getVisitorId() */ -class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract +class Mage_Log_Model_Visitor extends Mage_Core_Model_Abstract implements Mage_Log_Api_Data_VisitorInterface { public const DEFAULT_ONLINE_MINUTES_INTERVAL = 15; public const VISITOR_TYPE_CUSTOMER = 'c'; @@ -138,7 +104,7 @@ public function initServerData() $this->addData([ 'server_addr' => $this->_httpHelper->getServerAddr(true), 'remote_addr' => $this->_httpHelper->getRemoteAddr(true), - 'http_secure' => Mage::app()->getStore()->isCurrentlySecure(), + 'http_secure' => Mage::app()->isCurrentlySecure(), 'http_host' => $this->_httpHelper->getHttpHost(true), 'http_user_agent' => $this->_httpHelper->getHttpUserAgent(true), 'http_accept_language' => $this->_httpHelper->getHttpAcceptLanguage(true), @@ -177,25 +143,45 @@ public function getUrl() } /** + * @api * @return string */ public function getFirstVisitAt() { - if (!$this->hasData('first_visit_at')) { - $this->setData('first_visit_at', Varien_Date::now()); + if (!$this->hasData(self::DATA_FIRST_VISIT_AT)) { + $this->setData(self::DATA_FIRST_VISIT_AT, Varien_Date::now()); } - return $this->getData('first_visit_at'); + return $this->getDataByKey(self::DATA_FIRST_VISIT_AT); } /** + * @api + * @return $this + */ + public function setFirstVisitAt(?string $value) + { + return $this->setData(self::DATA_FIRST_VISIT_AT, $value); + } + + /** + * @api * @return string */ public function getLastVisitAt() { - if (!$this->hasData('last_visit_at')) { - $this->setData('last_visit_at', Varien_Date::now()); + if (!$this->hasData(self::DATA_LAST_VISIT_AT)) { + $this->setData(self::DATA_LAST_VISIT_AT, Varien_Date::now()); } - return $this->getData('last_visit_at'); + return $this->getDataByKey(self::DATA_LAST_VISIT_AT); + } + + /** + * @api + * @return $this + */ + public function setLastVisitAt(string $value) + { + return $this->setData(self::DATA_LAST_VISIT_AT, $value); } /** @@ -261,8 +247,8 @@ public function saveByRequest($observer) $this->setLastVisitAt(Varien_Date::now()); $this->save(); $this->_session->setVisitorData($this->getData()); - } catch (Exception $e) { - Mage::logException($e); + } catch (Exception $exception) { + Mage::logException($exception); } return $this; } @@ -278,7 +264,7 @@ public function saveByRequest($observer) public function bindCustomerLogin($observer) { /** @var Mage_Customer_Model_Customer $customer */ - $customer = $observer->getEvent()->getCustomer(); + $customer = $observer->getEvent()->getDataByKey('customer'); if ($customer) { $this->setDoCustomerLogin(true); $this->setCustomerId($customer->getId()); @@ -296,7 +282,7 @@ public function bindCustomerLogin($observer) */ public function bindCustomerLogout($observer) { - if ($this->getCustomerId() && $customer = $observer->getEvent()->getCustomer()) { + if ($this->getCustomerId() && $observer->getEvent()->getDataByKey('customer')) { $this->setDoCustomerLogout(true); } return $this; @@ -309,7 +295,7 @@ public function bindCustomerLogout($observer) public function bindQuoteCreate($observer) { /** @var Mage_Sales_Model_Quote $quote */ - $quote = $observer->getEvent()->getQuote(); + $quote = $observer->getEvent()->getDataByKey('quote'); if ($quote) { if ($quote->getIsCheckoutCart()) { $this->setQuoteId($quote->getId()); @@ -326,7 +312,7 @@ public function bindQuoteCreate($observer) public function bindQuoteDestroy($observer) { /** @var Mage_Sales_Model_Quote $quote */ - $quote = $observer->getEvent()->getQuote(); + $quote = $observer->getEvent()->getDataByKey('quote'); if ($quote) { $this->setDoQuoteDestroy(true); } @@ -388,11 +374,301 @@ public function isModuleIgnored($observer) $ignores = $this->_config->getNode('global/ignoredModules/entities')->asArray(); if (is_array($ignores) && $observer) { - $curModule = $observer->getEvent()->getControllerAction()->getRequest()->getRouteName(); + $curModule = $observer->getEvent()->getDataByKey('controller_action')->getRequest()->getRouteName(); if (isset($ignores[$curModule])) { return true; } } return false; } + + public function getCustomerId(): ?int + { + return $this->getDataByKey('customer_id'); + } + + /** + * @return $this + */ + public function setCustomerId(?int $value) + { + return $this->setData('customer_id', $value); + } + + public function getCustomerLogId(): ?int + { + return $this->getDataByKey('customer_log_id'); + } + + /** + * @return $this + */ + public function setCustomerLogId(?int $value) + { + return $this->setData('customer_log_id', $value); + } + + public function getDoCustomerLogin(): int + { + return $this->getDataByKey('do_customer_login'); + } + + /** + * @return $this + */ + public function setDoCustomerLogin(?bool $value) + { + return $this->setData('do_customer_login', $value); + } + + public function getDoCustomerLogout(): ?bool + { + return $this->getDataByKey('do_customer_logout'); + } + + /** + * @return $this + */ + public function setDoCustomerLogout(?bool $value) + { + return $this->setData('do_customer_logout', $value); + } + + public function getDoQuoteCreate(): ?bool + { + return $this->getDataByKey('do_quote_create'); + } + + /** + * @return $this + */ + public function setDoQuoteCreate(?bool $value) + { + return $this->setData('do_quote_create', $value); + } + + public function getIsNewVisitor(): bool + { + return $this->getDataByKey('is_new_visitor'); + } + + /** + * @return $this + */ + public function setIsNewVisitor(bool $value) + { + return $this->setData('is_new_visitor', $value); + } + + public function getDoQuoteDestroy(): ?bool + { + return $this->getDataByKey('do_quote_destroy'); + } + + /** + * @return $this + */ + public function setDoQuoteDestroy(?bool $value) + { + return $this->setData('do_quote_destroy', $value); + } + + public function getHttpAcceptCharset(): ?string + { + return $this->getDataByKey('http_accept_charset'); + } + + /** + * @return $this + */ + public function setHttpAcceptCharset(?string $value) + { + return $this->setData('http_accept_charset', $value); + } + + public function getHttpAcceptLanguage(): ?string + { + return $this->getDataByKey('http_accept_language'); + } + + /** + * @return $this + */ + public function setHttpAcceptLanguage(?string $value) + { + return $this->setData('http_accept_language', $value); + } + + public function getHttpHost(): ?string + { + return $this->getDataByKey('http_host'); + } + + /** + * @return $this + */ + public function setHttpHost(?string $value) + { + return $this->setData('http_host', $value); + } + + public function getHttpReferer(): ?string + { + return $this->getDataByKey('http_referer'); + } + + /** + * @return $this + */ + public function setHttpReferer(?string $value) + { + return $this->setData('http_referer', $value); + } + + public function getHttpSecure(): ?string + { + return $this->getDataByKey('http_secure'); + } + + /** + * @return $this + */ + public function setHttpSecure(?string $value) + { + return $this->setData('http_secure', $value); + } + + public function getHttpUserAgent(): ?string + { + return $this->getDataByKey('http_user_agent'); + } + + /** + * @return $this + */ + public function setHttpUserAgent(?string $value) + { + return $this->setData('http_user_agent', $value); + } + + public function getQuoteId(): ?int + { + return $this->getDataByKey('quote_id'); + } + + /** + * @return $this + */ + public function setQuoteId(?int $value) + { + return $this->setData('quote_id', $value); + } + + public function getRemoteAddr(): ?string + { + return $this->getDataByKey('remote_addr'); + } + + /** + * @return $this + */ + public function setRemoteAddr(?string $value) + { + return $this->setData('remote_addr', $value); + } + + public function getRequestUri(): ?string + { + return $this->getDataByKey('request_uri'); + } + + /** + * @return $this + */ + public function setRequestUri(?string $value) + { + return $this->setData('request_uri', $value); + } + + public function getServerAddr(): ?string + { + return $this->getDataByKey('server_addr'); + } + + /** + * @return $this + */ + public function setServerAddr(?string $value) + { + return $this->setData('server_addr', $value); + } + + /** + * @api + */ + public function getVisitorId(): ?int + { + $visitorId = $this->getDataByKey(self::DATA_ID); + return is_null($visitorId) ? null : (int) $visitorId; + } + + /** + * @api + * @return $this + */ + public function setVisitorId(?int $value) + { + return $this->setData(self::DATA_ID, $value); + } + + /** + * @api + */ + public function getLastUrlId(): int + { + return (int) $this->getDataByKey(self::DATA_LAST_URL_ID); + } + + /** + * @api + * @return $this + */ + public function setLastUrlId(int $value) + { + return $this->setData(self::DATA_LAST_URL_ID, $value); + } + + /** + * @api + */ + public function getSessionId(): ?string + { + return $this->getDataByKey(self::DATA_SESSION_ID); + } + + /** + * @api + * @return $this + */ + public function setSessionId(?string $value) + { + return $this->setData(self::DATA_SESSION_ID, $value); + } + + /** + * @api + */ + public function getStoreId(): int + { + return (int) $this->getDataByKey(self::DATA_STORE_ID); + } + + /** + * @api + * @return $this + */ + public function setStoreId(int $storeId) + { + return $this->setData(self::DATA_STORE_ID, $storeId); + } } From 278755f110042c64add5b59920dcf07ef396129b Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Fri, 22 Nov 2024 20:24:17 +0100 Subject: [PATCH 2/4] new phpstan issues found --- .phpstan.dist.baseline.neon | 5 ----- .../Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php | 1 + .../core/Mage/Adminhtml/Block/Sales/Items/Abstract.php | 4 +++- .../core/Mage/Adminhtml/Block/System/Store/Tree.php | 8 ++++---- .../Mage/Adminhtml/controllers/IndexController.php | 10 ++++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index 013eec00674..e47f21e4a96 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -3240,11 +3240,6 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Layout.php - - - message: "#^Method Mage_Core_Model_Layout\\:\\:getMessagesBlock\\(\\) should return Mage_Core_Block_Messages but returns Mage_Core_Block_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Core/Model/Layout.php - - message: "#^Method Mage_Core_Model_Layout\\:\\:getMessagesBlock\\(\\) should return Mage_Core_Block_Messages but returns Mage_Core_Block_Abstract\\|false\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php index b4450e986ea..bde2ae923e2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php +++ b/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php @@ -76,6 +76,7 @@ protected function _prepareForm() ]); // Setting custom renderer for content field to remove label column + /** @var Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element $renderer */ $renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element') ->setTemplate('cms/page/edit/form/renderer/content.phtml'); $contentField->setRenderer($renderer); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php index b475d682e75..7144dc0439a 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Abstract.php @@ -110,9 +110,11 @@ public function getItemRenderer($type) $type = 'default'; } if (is_null($this->_itemRenders[$type]['renderer'])) { - $this->_itemRenders[$type]['renderer'] = $this->getLayout() + /** @var Mage_Adminhtml_Block_Sales_Items_Abstract $renderer */ + $renderer = $this->getLayout() ->createBlock($this->_itemRenders[$type]['block']) ->setTemplate($this->_itemRenders[$type]['template']); + $this->_itemRenders[$type]['renderer'] = $renderer; foreach ($this->_columnRenders as $columnType => $renderer) { $this->_itemRenders[$type]['renderer']->addColumnRender($columnType, $renderer['block'], $renderer['template']); } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Store/Tree.php b/app/code/core/Mage/Adminhtml/Block/System/Store/Tree.php index 3884de74fd7..1e411096820 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Store/Tree.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Store/Tree.php @@ -40,13 +40,13 @@ public function _construct() /** * Prepare block layout * - * @return Mage_Core_Block_Abstract + * @return Mage_Adminhtml_Block_Template */ protected function _prepareLayout() { - $this->_cellTemplate = $this->getLayout() - ->createBlock('adminhtml/template') - ->setTemplate('system/store/cell.phtml'); + /** @var Mage_Adminhtml_Block_Template $block */ + $block = $this->getLayout()->createBlock('adminhtml/template'); + $this->_cellTemplate = $block->setTemplate('system/store/cell.phtml'); return parent::_prepareLayout(); } diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/core/Mage/Adminhtml/controllers/IndexController.php index 2e1b04e76f4..a4160ab90cc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/IndexController.php +++ b/app/code/core/Mage/Adminhtml/controllers/IndexController.php @@ -30,7 +30,9 @@ class Mage_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action protected function _outTemplate($tplName, $data = []) { $this->_initLayoutMessages('adminhtml/session'); - $block = $this->getLayout()->createBlock('adminhtml/template')->setTemplate("$tplName.phtml"); + /** @var Mage_Adminhtml_Block_Template $block */ + $block = $this->getLayout()->createBlock('adminhtml/template'); + $block->setTemplate("$tplName.phtml"); foreach ($data as $index => $value) { $block->assign($index, $value); } @@ -135,9 +137,9 @@ public function globalSearchAction() } } - $block = $this->getLayout()->createBlock('adminhtml/template') - ->setTemplate('system/autocomplete.phtml') - ->assign('items', $items); + /** @var Mage_Adminhtml_Block_Template $block */ + $block = $this->getLayout()->createBlock('adminhtml/template'); + $block->setTemplate('system/autocomplete.phtml')->assign('items', $items); $this->getResponse()->setBody($block->toHtml()); } From c8eb05fda15a38c7758e35b5a5d8739d6272924f Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 23 Nov 2024 04:44:03 +0100 Subject: [PATCH 3/4] Updated methods --- app/code/core/Mage/Cms/Api/Data/BlockInterface.php | 2 +- app/code/core/Mage/Cms/Api/Data/PageInterface.php | 2 +- app/code/core/Mage/Cms/Model/Block.php | 2 +- app/code/core/Mage/Cms/Model/Page.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/core/Mage/Cms/Api/Data/BlockInterface.php b/app/code/core/Mage/Cms/Api/Data/BlockInterface.php index 5af0b43f83d..8e302021843 100644 --- a/app/code/core/Mage/Cms/Api/Data/BlockInterface.php +++ b/app/code/core/Mage/Cms/Api/Data/BlockInterface.php @@ -41,6 +41,6 @@ public function getUpdateTime(): ?string; public function setUpdateTime(?string $time); public function getIsActive(): int; public function setIsActive(int $value); - public function getStoreId(): int; + public function getStoreId(): ?int; public function setStoreId(int $storeId); } diff --git a/app/code/core/Mage/Cms/Api/Data/PageInterface.php b/app/code/core/Mage/Cms/Api/Data/PageInterface.php index 537abcb6f18..9b183288a0b 100644 --- a/app/code/core/Mage/Cms/Api/Data/PageInterface.php +++ b/app/code/core/Mage/Cms/Api/Data/PageInterface.php @@ -74,6 +74,6 @@ public function getCustomThemeTo(): ?string; public function setCustomThemeTo(?string $to); public function getCustomThemeFrom(): ?string; public function setCustomThemeFrom(?string $from); - public function getStoreId(): int; + public function getStoreId(): ?int; public function setStoreId(int $storeId); } diff --git a/app/code/core/Mage/Cms/Model/Block.php b/app/code/core/Mage/Cms/Model/Block.php index 00a29668dde..082a131d33a 100644 --- a/app/code/core/Mage/Cms/Model/Block.php +++ b/app/code/core/Mage/Cms/Model/Block.php @@ -156,7 +156,7 @@ public function setTitle(string $title) /** * @api */ - public function getStoreId(): int + public function getStoreId(): ?int { return $this->getDataByKey(self::DATA_STORE_ID); } diff --git a/app/code/core/Mage/Cms/Model/Page.php b/app/code/core/Mage/Cms/Model/Page.php index 8c4491764b1..eccacc46ca7 100644 --- a/app/code/core/Mage/Cms/Model/Page.php +++ b/app/code/core/Mage/Cms/Model/Page.php @@ -424,7 +424,7 @@ public function setSortOrder(int $position) /** * @api */ - public function getStoreId(): int + public function getStoreId(): ?int { return (int) $this->getDataByKey(self::DATA_STORE_ID); } From 467bfb0494ddcdcc9df5c6a6534b3489da5ff24b Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Mon, 27 Oct 2025 03:45:04 +0100 Subject: [PATCH 4/4] rector --- .../core/Mage/Cms/Api/Data/BlockInterface.php | 22 ++++++++ .../core/Mage/Cms/Api/Data/PageInterface.php | 55 +++++++++++++++++++ .../Mage/Core/Api/Data/WebsiteInterface.php | 16 ++++++ .../Mage/Log/Api/Data/VisitorInterface.php | 16 ++++++ 4 files changed, 109 insertions(+) diff --git a/app/code/core/Mage/Cms/Api/Data/BlockInterface.php b/app/code/core/Mage/Cms/Api/Data/BlockInterface.php index 8e302021843..a5dbb508706 100644 --- a/app/code/core/Mage/Cms/Api/Data/BlockInterface.php +++ b/app/code/core/Mage/Cms/Api/Data/BlockInterface.php @@ -19,28 +19,50 @@ interface Mage_Cms_Api_Data_BlockInterface { public const DATA_ID = 'block_id'; + public const DATA_CONTENT = 'content'; + public const DATA_CREATION_TIME = 'creation_time'; + public const DATA_IDENTIFIER = 'identifier'; + public const DATA_IS_ACTIVE = 'is_active'; + public const DATA_STORE_ID = 'store_id'; + public const DATA_TITLE = 'title'; + public const DATA_UPDATE_TIME = 'update_time'; public function getBlockId(): ?int; + public function setBlockId(?int $blockId); + public function getTitle(): string; + public function setTitle(string $title); + public function getIdentifier(): string; + public function setIdentifier(string $identifier); + public function getContent(): ?string; + public function setContent(?string $content); + public function getCreationTime(): ?string; + public function setCreationTime(?string $time); + public function getUpdateTime(): ?string; + public function setUpdateTime(?string $time); + public function getIsActive(): int; + public function setIsActive(int $value); + public function getStoreId(): ?int; + public function setStoreId(int $storeId); } diff --git a/app/code/core/Mage/Cms/Api/Data/PageInterface.php b/app/code/core/Mage/Cms/Api/Data/PageInterface.php index 9b183288a0b..82e78c6e83e 100644 --- a/app/code/core/Mage/Cms/Api/Data/PageInterface.php +++ b/app/code/core/Mage/Cms/Api/Data/PageInterface.php @@ -19,61 +19,116 @@ interface Mage_Cms_Api_Data_PageInterface { public const DATA_ID = 'page_id'; + public const DATA_CONTENT = 'content'; + public const DATA_CONTENT_HEADING = 'content_heading'; + public const DATA_CREATION_TIME = 'creation_time'; + public const DATA_CUSTOM_LAYOUT_UPDATE_XML = 'custom_layout_update_xml'; + public const DATA_CUSTOM_ROOT_TEMPLATE = 'custom_root_template'; + public const DATA_CUSTOM_THEME = 'custom_theme'; + public const DATA_CUSTOM_THEME_FROM = 'custom_theme_from'; + public const DATA_CUSTOM_THEME_TO = 'custom_theme_to'; + public const DATA_IDENTIFIER = 'identifier'; + public const DATA_IS_ACTIVE = 'is_active'; + public const DATA_LAYOUT_UPDATE_XML = 'layout_update_xml'; + public const DATA_META_DESCRIPTION = 'meta_description'; + public const DATA_META_KEYWORDS = 'meta_keywords'; + public const DATA_ROOT_TEMPLATE = 'root_template'; + public const DATA_SORT_ORDER = 'sort_order'; + public const DATA_STORE_ID = 'store_id'; + public const DATA_TITLE = 'title'; + public const DATA_UPDATE_TIME = 'update_time'; public function getPageId(): ?int; + public function setPageId(?int $pageId); + public function getTitle(): ?string; + public function setTitle(?string $title); + public function getRootTemplate(): ?string; + public function setRootTemplate(?string $template); + public function getMetaKeywords(): ?string; + public function setMetaKeywords(?string $keywords); + public function getMetaDescription(): ?string; + public function setMetaDescription(?string $description); + public function getIdentifier(): ?string; + public function setIdentifier(?string $identifier); + public function getContentHeading(): ?string; + public function setContentHeading(?string $content); + public function getContent(): ?string; + public function setContent(?string $content); + public function getCreationTime(): ?string; + public function setCreationTime(?string $value); + public function getUpdateTime(): ?string; + public function setUpdateTime(?string $time); + public function getIsActive(): int; + public function setIsActive(int $value); + public function getSortOrder(): int; + public function setSortOrder(int $position); + public function getLayoutUpdateXml(): ?string; + public function setLayoutUpdateXml(?string $xml); + public function getCustomTheme(): ?string; + public function setCustomTheme(?string $from); + public function getCustomRootTemplate(): ?string; + public function setCustomRootTemplate(?string $template); + public function getCustomLayoutUpdateXml(): ?string; + public function setCustomLayoutUpdateXml(?string $xml); + public function getCustomThemeTo(): ?string; + public function setCustomThemeTo(?string $to); + public function getCustomThemeFrom(): ?string; + public function setCustomThemeFrom(?string $from); + public function getStoreId(): ?int; + public function setStoreId(int $storeId); } diff --git a/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php b/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php index 1c36d277d27..0e8fc58a46d 100644 --- a/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php +++ b/app/code/core/Mage/Core/Api/Data/WebsiteInterface.php @@ -18,22 +18,38 @@ interface Mage_Core_Api_Data_WebsiteInterface { public const DATA_ID = 'website_id'; + public const DATA_CODE = 'code'; + public const DATA_NAME = 'name'; + public const DATA_SORT_ORDER = 'sort_order'; + public const DATA_DEFAULT_GROUP_ID = 'default_group_id'; + public const DATA_IS_DEFAULT = 'is_default'; public function getWebsiteId(): ?int; + public function setWebsiteId(?int $value); + public function getCode(); + public function setCode(?string $code); + public function getName(): ?string; + public function setName(?string $name); + public function getSortOrder(): int; + public function setSortOrder(int $position); + public function getDefaultGroupId(); + public function setDefaultGroupId(int $value); + public function getIsDefault(): ?int; + public function setIsDefault(?int $value); } diff --git a/app/code/core/Mage/Log/Api/Data/VisitorInterface.php b/app/code/core/Mage/Log/Api/Data/VisitorInterface.php index 74d282401eb..3e3a8e9eecf 100644 --- a/app/code/core/Mage/Log/Api/Data/VisitorInterface.php +++ b/app/code/core/Mage/Log/Api/Data/VisitorInterface.php @@ -18,22 +18,38 @@ interface Mage_Log_Api_Data_VisitorInterface { public const DATA_ID = 'visitor_id'; + public const DATA_FIRST_VISIT_AT = 'first_visit_at'; + public const DATA_LAST_URL_ID = 'last_url_id'; + public const DATA_LAST_VISIT_AT = 'last_visit_at'; + public const DATA_SESSION_ID = 'session_id'; + public const DATA_STORE_ID = 'store_id'; public function getVisitorId(): ?int; + public function setVisitorId(?int $value); + public function getSessionId(): ?string; + public function setSessionId(?string $value); + public function getFirstVisitAt(); + public function setFirstVisitAt(?string $value); + public function getLastVisitAt(); + public function setLastVisitAt(string $value); + public function getLastUrlId(): int; + public function setLastUrlId(int $value); + public function getStoreId(): int; + public function setStoreId(int $storeId); }