diff --git a/app/code/core/Mage/Core/Block/Abstract.php b/app/code/core/Mage/Core/Block/Abstract.php index e11e5b702ae..82672d56517 100644 --- a/app/code/core/Mage/Core/Block/Abstract.php +++ b/app/code/core/Mage/Core/Block/Abstract.php @@ -33,6 +33,21 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method $this setAdditionalHtml(string $value) + * @method $this setBlockParams(array $value) + * @method $this setCacheLifetime(int|false $value) + * @method $this setCacheKey(string $value) + * @method $this setCacheTags(array $value) + * @method $this setClass(string $value) + * @method $this setDisabled(bool $value) + * @method string getFormKey() + * @method $this setLabel(string $value) + * @method $this setOnclick(string $value) + * @method string getPosition() + * @method $this setTemplate(string $value) + * @method $this setType(string $value) + * @method bool hasWrapperMustBeVisible() */ abstract class Mage_Core_Block_Abstract extends Varien_Object { @@ -88,7 +103,7 @@ abstract class Mage_Core_Block_Abstract extends Varien_Object /** * Contains references to child block objects * - * @var array + * @var Mage_Core_Block_Abstract[] */ protected $_children = array(); @@ -255,7 +270,7 @@ public function getRequest() /** * Retrieve parent block * - * @return Mage_Core_Block_Abstract + * @return $this */ public function getParentBlock() { @@ -266,7 +281,7 @@ public function getParentBlock() * Set parent block * * @param Mage_Core_Block_Abstract $block - * @return Mage_Core_Block_Abstract + * @return $this */ public function setParentBlock(Mage_Core_Block_Abstract $block) { @@ -288,7 +303,7 @@ public function getAction() * Set layout object * * @param Mage_Core_Model_Layout $layout - * @return Mage_Core_Block_Abstract + * @return $this */ public function setLayout(Mage_Core_Model_Layout $layout) { @@ -304,7 +319,7 @@ public function setLayout(Mage_Core_Model_Layout $layout) * * You can redefine this method in child classes for changing layout * - * @return Mage_Core_Block_Abstract + * @return $this */ protected function _prepareLayout() { @@ -334,7 +349,7 @@ public function getIsAnonymous() * Set the anonymous flag * * @param bool $flag - * @return Mage_Core_Block_Abstract + * @return $this */ public function setIsAnonymous($flag) { @@ -356,7 +371,7 @@ public function getAnonSuffix() * Set anonymous suffix for current block * * @param string $suffix - * @return Mage_Core_Block_Abstract + * @return $this */ public function setAnonSuffix($suffix) { @@ -378,7 +393,7 @@ public function getBlockAlias() * Set block alias * * @param string $alias - * @return Mage_Core_Block_Abstract + * @return $this */ public function setBlockAlias($alias) { @@ -390,7 +405,7 @@ public function setBlockAlias($alias) * Set block's name in layout and unsets previous link if such exists. * * @param string $name - * @return Mage_Core_Block_Abstract + * @return $this */ public function setNameInLayout($name) { @@ -420,7 +435,7 @@ public function getSortedChildren() * * @param string $name * @param mixed $value - * @return Mage_Core_Block_Abstract + * @return $this */ public function setAttribute($name, $value = null) { @@ -432,7 +447,7 @@ public function setAttribute($name, $value = null) * * @param string $alias * @param Mage_Core_Block_Abstract $block - * @return Mage_Core_Block_Abstract + * @return $this */ public function setChild($alias, $block) { @@ -473,7 +488,7 @@ public function setChild($alias, $block) * Unset child block * * @param string $alias - * @return Mage_Core_Block_Abstract + * @return $this */ public function unsetChild($alias) { @@ -508,7 +523,7 @@ public function unsetChild($alias) * @param string $callback * @param mixed $result * @param array $params - * @return Mage_Core_Block_Abstract + * @return $this */ public function unsetCallChild($alias, $callback, $result, $params) { @@ -532,7 +547,7 @@ public function unsetCallChild($alias, $callback, $result, $params) /** * Unset all children blocks * - * @return Mage_Core_Block_Abstract + * @return $this */ public function unsetChildren() { @@ -608,7 +623,7 @@ public function getChildChildHtml($name, $childName = '', $useCache = true, $sor /** * Obtain sorted child blocks * - * @return array + * @return Mage_Core_Block_Abstract[] */ public function getSortedChildBlocks() { @@ -737,7 +752,7 @@ public function insert($block, $siblingName = '', $after = false, $alias = '') * Sort block's children * * @param boolean $force force re-sort all children - * @return Mage_Core_Block_Abstract + * @return $this */ public function sortChildren($force = false) { @@ -784,7 +799,7 @@ public function sortChildren($force = false) * * @param Mage_Core_Block_Abstract|string $block * @param string $alias - * @return Mage_Core_Block_Abstract + * @return $this */ public function append($block, $alias = '') { @@ -812,7 +827,7 @@ public function addToChildGroup($groupName, Mage_Core_Block_Abstract $child) * Add self to the specified group of parent block * * @param string $groupName - * @return Mage_Core_Block_Abstract + * @return $this */ public function addToParentGroup($groupName) { @@ -849,7 +864,6 @@ public function getChildGroup($groupName, $callback = null, $skipEmptyResults = } else { $result[$alias] = $block; } - } } return $result; @@ -873,7 +887,7 @@ public function getChildData($alias, $key = '') /** * Before rendering html, but after trying to load cache * - * @return Mage_Core_Block_Abstract + * @return $this */ protected function _beforeToHtml() { @@ -885,7 +899,7 @@ protected function _beforeToHtml() * * @param $openTag * @param $closeTag - * @return Mage_Core_Block_Abstract + * @return $this */ public function setFrameTags($openTag, $closeTag = null) { @@ -914,7 +928,7 @@ final public function toHtml() $html = $this->_loadCache(); if ($html === false) { $translate = Mage::getSingleton('core/translate'); - /** @var $translate Mage_Core_Model_Translate */ + /** @var Mage_Core_Model_Translate $translate */ if ($this->hasData('translate_inline')) { $translate->setTranslateInline($this->getData('translate_inline')); } @@ -943,8 +957,10 @@ final public function toHtml() self::$_transportObject = new Varien_Object; } self::$_transportObject->setHtml($html); - Mage::dispatchEvent('core_block_abstract_to_html_after', - array('block' => $this, 'transport' => self::$_transportObject)); + Mage::dispatchEvent( + 'core_block_abstract_to_html_after', + array('block' => $this, 'transport' => self::$_transportObject) + ); $html = self::$_transportObject->getHtml(); return $html; @@ -1072,7 +1088,7 @@ public function getMessagesBlock() * Set messages block * * @param Mage_Core_Block_Messages $block - * @return Mage_Core_Block_Abstract + * @return $this */ public function setMessagesBlock(Mage_Core_Block_Messages $block) { @@ -1084,7 +1100,7 @@ public function setMessagesBlock(Mage_Core_Block_Messages $block) * Return block helper * * @param string $type - * @return Mage_Core_Block_Abstract + * @return $this */ public function getHelper($type) { @@ -1161,8 +1177,11 @@ public function __() } /** - * @deprecated after 1.4.0.0-rc1 + * @param string|array $data + * @param array $allowedTags + * @return string * @see self::escapeHtml() + * @deprecated after 1.4.0.0-rc1 */ public function htmlEscape($data, $allowedTags = null) { @@ -1172,7 +1191,7 @@ public function htmlEscape($data, $allowedTags = null) /** * Escape html entities * - * @param mixed $data + * @param string|array $data * @param array $allowedTags * @return string */ @@ -1195,6 +1214,8 @@ public function stripTags($data, $allowableTags = null, $allowHtmlEntities = fal } /** + * @param string $data + * @return string * @deprecated after 1.4.0.0-rc1 * @see self::escapeUrl() */ @@ -1261,7 +1282,7 @@ public function countChildren() /** * Prepare url for save to cache * - * @return Mage_Core_Block_Abstract + * @return $this */ protected function _beforeCacheUrl() { @@ -1353,7 +1374,7 @@ public function getCacheTags() * Add tag to block * * @param string|array $tag - * @return Mage_Core_Block_Abstract + * @return $this */ public function addCacheTag($tag) { @@ -1368,7 +1389,7 @@ public function addCacheTag($tag) * Add tags from specified model to current block * * @param Mage_Core_Model_Abstract $model - * @return Mage_Core_Block_Abstract + * @return $this */ public function addModelTags(Mage_Core_Model_Abstract $model) { @@ -1414,7 +1435,7 @@ protected function _loadCache() return false; } $cacheKey = $this->getCacheKey(); - /** @var $session Mage_Core_Model_Session */ + /** @var Mage_Core_Model_Session $session */ $session = Mage::getSingleton('core/session'); $cacheData = $this->_getApp()->loadCache($cacheKey); if ($cacheData) { @@ -1431,7 +1452,7 @@ protected function _loadCache() * Save block content to cache storage * * @param string $data - * @return Mage_Core_Block_Abstract + * @return $this|false */ protected function _saveCache($data) { @@ -1439,7 +1460,7 @@ protected function _saveCache($data) return false; } $cacheKey = $this->getCacheKey(); - /** @var $session Mage_Core_Model_Session */ + /** @var Mage_Core_Model_Session $session */ $session = Mage::getSingleton('core/session'); $data = str_replace( $session->getSessionIdQueryParam() . '=' . $session->getEncryptedSessionId(), @@ -1497,7 +1518,7 @@ protected function _getSidPlaceholder($cacheKey = null) public function getItemsTags($items) { $tags = array(); - /** @var $item Mage_Core_Model_Abstract */ + /** @var Mage_Core_Model_Abstract $item */ foreach ($items as $item) { $itemTags = $item->getCacheIdTags(); if (false === $itemTags) { diff --git a/app/code/core/Mage/Core/Block/Flush.php b/app/code/core/Mage/Core/Block/Flush.php index 3ef156f45d6..a724071f0eb 100644 --- a/app/code/core/Mage/Core/Block/Flush.php +++ b/app/code/core/Mage/Core/Block/Flush.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Immediate flush block. To be used only as root * @@ -32,7 +31,9 @@ */ class Mage_Core_Block_Flush extends Mage_Core_Block_Abstract { - + /** + * @return string + */ protected function _toHtml() { if (!$this->_beforeToHtml()) { @@ -49,5 +50,4 @@ protected function _toHtml() echo $block->toHtml(); } } - } diff --git a/app/code/core/Mage/Core/Block/Html/Calendar.php b/app/code/core/Mage/Core/Block/Html/Calendar.php index bf3cf2419d3..eb503cc48a0 100644 --- a/app/code/core/Mage/Core/Block/Html/Calendar.php +++ b/app/code/core/Mage/Core/Block/Html/Calendar.php @@ -34,6 +34,10 @@ */ class Mage_Core_Block_Html_Calendar extends Mage_Core_Block_Template { + /** + * @return string + * @throws Zend_Locale_Exception + */ protected function _toHtml() { $localeCode = Mage::app()->getLocale()->getLocaleCode(); @@ -61,7 +65,7 @@ protected function _toHtml() $this->assign('pm', Mage::helper('core')->jsonEncode(Zend_Locale_Data::getContent($localeCode, 'pm'))); // get first day of week and weekend days - $this->assign('firstDay', (int)Mage::getStoreConfig('general/locale/firstday')); + $this->assign('firstDay', (int)Mage::getStoreConfig('general/locale/firstday')); $this->assign('weekendDays', Mage::helper('core')->jsonEncode((string)Mage::getStoreConfig('general/locale/weekend'))); // define default format and tooltip format diff --git a/app/code/core/Mage/Core/Block/Html/Date.php b/app/code/core/Mage/Core/Block/Html/Date.php index 6112746885e..1a3e088042f 100644 --- a/app/code/core/Mage/Core/Block/Html/Date.php +++ b/app/code/core/Mage/Core/Block/Html/Date.php @@ -31,10 +31,30 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getClass() + * @method $this setClass(string $value) + * @method string getExtraParams() + * @method $this setExtraParams(string $value) + * @method string getFormat() + * @method $this setFormat(string $value) + * @method string getImage() + * @method $this setImage(string $value) + * @method string getName() + * @method $this setName(string $value) + * @method string getTime() + * @method $this setTime(string $value) + * @method $this setTitle(string $value) + * @method string getValue() + * @method $this setValue(string $value) + * @method string getYearsRange() + * @method $this setYearsRange(string $value) */ class Mage_Core_Block_Html_Date extends Mage_Core_Block_Template { - + /** + * @return string + */ protected function _toHtml() { $displayFormat = Varien_Date::convertZendToStrftime($this->getFormat(), true, (bool)$this->getTime()); @@ -73,18 +93,25 @@ protected function _toHtml() return $html; } - public function getEscapedValue($index=null) { + /** + * @param null $index + * @return string + */ + public function getEscapedValue($index = null) + { - if($this->getFormat() && $this->getValue()) { + if ($this->getFormat() && $this->getValue()) { return strftime($this->getFormat(), strtotime($this->getValue())); } return htmlspecialchars($this->getValue()); } + /** + * @return string + */ public function getHtml() { return $this->toHtml(); } - } diff --git a/app/code/core/Mage/Core/Block/Html/Link.php b/app/code/core/Mage/Core/Block/Html/Link.php index f79e7b9198c..85eabfb13b6 100644 --- a/app/code/core/Mage/Core/Block/Html/Link.php +++ b/app/code/core/Mage/Core/Block/Html/Link.php @@ -83,7 +83,7 @@ public function getLinkAttributes() * @param string $quote * @return string */ - public function serialize($attributes = array(), $valueSeparator='=', $fieldSeparator=' ', $quote='"') + public function serialize($attributes = array(), $valueSeparator = '=', $fieldSeparator = ' ', $quote = '"') { $res = ''; $data = array(); diff --git a/app/code/core/Mage/Core/Block/Html/Select.php b/app/code/core/Mage/Core/Block/Html/Select.php index 87ebbe0cf0a..cb42a65fa52 100644 --- a/app/code/core/Mage/Core/Block/Html/Select.php +++ b/app/code/core/Mage/Core/Block/Html/Select.php @@ -24,17 +24,23 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * HTML select element block * * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getExtraParams() + * @method $this setExtraParams(string $value) + * @method string getName() + * @method $this setName(string $value) + * @method string getValue() + * @method $this setValue(string $value) + * @method bool getIsRenderToJsTemplate() */ class Mage_Core_Block_Html_Select extends Mage_Core_Block_Abstract { - protected $_options = array(); /** @@ -67,7 +73,7 @@ public function setOptions($options) * @param array $params HTML attributes * @return $this */ - public function addOption($value, $label, $params=array()) + public function addOption($value, $label, $params = array()) { $this->_options[] = array('value' => $value, 'label' => $label, 'params' => $params); return $this; @@ -154,7 +160,7 @@ protected function _toHtml() . $this->getClass() . '" title="' . $this->getTitle() . '" ' . $this->getExtraParams() . '>'; $values = $this->getValue(); - if (!is_array($values)){ + if (!is_array($values)) { if (!is_null($values)) { $values = array($values); } else { @@ -232,11 +238,13 @@ protected function _optionToHtml($option, $selected = false) } } - return sprintf('', + return sprintf( + '', $this->escapeHtml($option['value']), $selectedHtml, $params, - $this->escapeHtml($option['label'])); + $this->escapeHtml($option['label']) + ); } /** diff --git a/app/code/core/Mage/Core/Block/Messages.php b/app/code/core/Mage/Core/Block/Messages.php index ca78479d1f8..6590ae73158 100644 --- a/app/code/core/Mage/Core/Block/Messages.php +++ b/app/code/core/Mage/Core/Block/Messages.php @@ -75,6 +75,9 @@ class Mage_Core_Block_Messages extends Mage_Core_Block_Template */ protected $_usedStorageTypes = array('core/session'); + /** + * @inheritDoc + */ public function _prepareLayout() { $this->addMessages(Mage::getSingleton('core/session')->getMessages(true)); @@ -197,7 +200,7 @@ public function addSuccess($message) * @param string $type * @return array */ - public function getMessages($type=null) + public function getMessages($type = null) { return $this->getMessageCollection()->getItems($type); } @@ -208,7 +211,7 @@ public function getMessages($type=null) * @param string $type * @return string */ - public function getHtml($type=null) + public function getHtml($type = null) { $html = '<' . $this->_messagesFirstLevelTagName . ' id="admin_messages">'; foreach ($this->getMessages($type) as $message) { @@ -223,7 +226,6 @@ public function getHtml($type=null) /** * Retrieve messages in HTML format grouped by type * - * @param string $type * @return string */ public function getGroupedHtml() @@ -236,14 +238,14 @@ public function getGroupedHtml() ); $html = ''; foreach ($types as $type) { - if ( $messages = $this->getMessages($type) ) { - if ( !$html ) { + if ($messages = $this->getMessages($type)) { + if (!$html) { $html .= '<' . $this->_messagesFirstLevelTagName . ' class="messages">'; } $html .= '<' . $this->_messagesSecondLevelTagName . ' class="' . $type . '-msg">'; $html .= '<' . $this->_messagesFirstLevelTagName . '>'; - foreach ( $messages as $message ) { + foreach ($messages as $message) { $html.= '<' . $this->_messagesSecondLevelTagName . '>'; $html.= '<' . $this->_messagesContentWrapperTagName . '>'; $html.= ($this->_escapeMessageFlag) ? $this->escapeHtml($message->getText()) : $message->getText(); @@ -254,12 +256,15 @@ public function getGroupedHtml() $html .= '_messagesSecondLevelTagName . '>'; } } - if ( $html) { + if ($html) { $html .= '_messagesFirstLevelTagName . '>'; } return $html; } + /** + * @return string + */ protected function _toHtml() { return $this->getGroupedHtml(); diff --git a/app/code/core/Mage/Core/Block/Profiler.php b/app/code/core/Mage/Core/Block/Profiler.php index eec99493813..3a2ecdc478b 100644 --- a/app/code/core/Mage/Core/Block/Profiler.php +++ b/app/code/core/Mage/Core/Block/Profiler.php @@ -24,9 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Block_Profiler extends Mage_Core_Block_Abstract { + /** + * @return string + */ protected function _toHtml() { if (!$this->_beforeToHtml() @@ -44,17 +46,17 @@ protected function _toHtml() $out .= '
Memory usage: real: '.memory_get_usage(true).', emalloc: '.memory_get_usage().'
'; $out .= ''; $out .= ''; - foreach ($timers as $name=>$timer) { - $sum = Varien_Profiler::fetch($name,'sum'); - $count = Varien_Profiler::fetch($name,'count'); - $realmem = Varien_Profiler::fetch($name,'realmem'); - $emalloc = Varien_Profiler::fetch($name,'emalloc'); + foreach ($timers as $name => $timer) { + $sum = Varien_Profiler::fetch($name, 'sum'); + $count = Varien_Profiler::fetch($name, 'count'); + $realmem = Varien_Profiler::fetch($name, 'realmem'); + $emalloc = Varien_Profiler::fetch($name, 'emalloc'); if ($sum<.0010 && $count<10 && $emalloc<10000) { continue; } $out .= '' .'' - .'' + .'' .'' .'' .'' diff --git a/app/code/core/Mage/Core/Block/Store/Switcher.php b/app/code/core/Mage/Core/Block/Store/Switcher.php index dd19e8e6529..40a73072eaf 100644 --- a/app/code/core/Mage/Core/Block/Store/Switcher.php +++ b/app/code/core/Mage/Core/Block/Store/Switcher.php @@ -30,6 +30,11 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method array getLanguages() + * @method $this setLanguages(array $value) + * @method array getStores() + * @method $this setStores(array $value) */ class Mage_Core_Block_Store_Switcher extends Mage_Core_Block_Template { @@ -45,6 +50,10 @@ public function __construct() return parent::__construct(); } + /** + * @return $this + * @throws Mage_Core_Model_Store_Exception + */ protected function _loadData() { if ($this->_loaded) { @@ -58,9 +67,11 @@ protected function _loadData() $groupCollection = Mage::getModel('core/store_group') ->getCollection() ->addWebsiteFilter($websiteId); + /** @var Mage_Core_Model_Store_Group $group */ foreach ($groupCollection as $group) { $this->_groups[$group->getId()] = $group; } + /** @var Mage_Core_Model_Store $store */ foreach ($storeCollection as $store) { if (!$store->getIsActive()) { continue; @@ -74,6 +85,9 @@ protected function _loadData() return $this; } + /** + * @return int + */ public function getStoreCount() { $stores = array(); @@ -83,6 +97,7 @@ public function getStoreCount() continue; } $useStore = false; + /** @var Mage_Core_Model_Store $store */ foreach ($this->_stores[$group->getId()] as $store) { if ($store->getLocaleCode() == $localeCode) { $useStore = true; @@ -98,6 +113,10 @@ public function getStoreCount() return count($this->getStores()); } + /** + * @return int + * @throws Mage_Core_Model_Store_Exception + */ public function getLanguageCount() { $groupId = Mage::app()->getStore()->getGroupId(); @@ -109,11 +128,19 @@ public function getLanguageCount() return count($this->getLanguages()); } + /** + * @return int + * @throws Mage_Core_Model_Store_Exception + */ public function getCurrentStoreId() { return Mage::app()->getStore()->getId(); } + /** + * @return string + * @throws Mage_Core_Model_Store_Exception + */ public function getCurrentStoreCode() { return Mage::app()->getStore()->getCode(); diff --git a/app/code/core/Mage/Core/Block/Template.php b/app/code/core/Mage/Core/Block/Template.php index c3dac8ec3df..46d8cc36a3d 100644 --- a/app/code/core/Mage/Core/Block/Template.php +++ b/app/code/core/Mage/Core/Block/Template.php @@ -24,13 +24,18 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Base html block * * @category Mage * @package Mage_Core - * @author Magento Core Team + * @author Magento Core Team + * + * @method $this setContentHeading(string $value) + * @method $this setFormAction(string $value) + * @method $this setIdSuffix(string $value) + * @method $this setProduct(Mage_Catalog_Model_Product $value) + * @method $this setDisplayMinimalPrice(bool $value) */ class Mage_Core_Block_Template extends Mage_Core_Block_Abstract { @@ -146,14 +151,13 @@ public function getArea() * @param mixed $value * @return Mage_Core_Block_Template */ - public function assign($key, $value=null) + public function assign($key, $value = null) { if (is_array($key)) { - foreach ($key as $k=>$v) { + foreach ($key as $k => $v) { $this->assign($k, $v); } - } - else { + } else { $this->_viewVars[$key] = $value; } return $this; @@ -189,6 +193,9 @@ public function getDirectOutput() return false; } + /** + * @return bool + */ public function getShowTemplateHints() { if (is_null(self::$_showTemplateHints)) { @@ -243,7 +250,6 @@ public function fetchView($fileName) $thisClass = get_class($this); Mage::log('Not valid template file:' . $fileName . ' class: ' . $thisClass, Zend_Log::CRIT, null, true); } - } catch (Exception $e) { ob_get_clean(); throw $e; @@ -309,7 +315,7 @@ public function getBaseUrl() * @param string $fileName * @return string */ - public function getJsUrl($fileName='') + public function getJsUrl($fileName = '') { if (!$this->_jsUrl) { $this->_jsUrl = Mage::getBaseUrl('js'); @@ -330,9 +336,7 @@ public function getObjectData(Varien_Object $object, $key) } /** - * Get cache key informative items - * - * @return array + * @inheritDoc */ public function getCacheKeyInfo() { diff --git a/app/code/core/Mage/Core/Block/Template/Facade.php b/app/code/core/Mage/Core/Block/Template/Facade.php index bd9d4def349..d632ea5efc4 100644 --- a/app/code/core/Mage/Core/Block/Template/Facade.php +++ b/app/code/core/Mage/Core/Block/Template/Facade.php @@ -86,7 +86,7 @@ public function ifEquals($conditionKeys) } $lastValue = $this->_data[$key]; foreach ($conditionKeys as $key) { - if ($this->_data[$key] !== $lastValue) { + if ($this->_data[$key] !== $lastValue) { return false; } } diff --git a/app/code/core/Mage/Core/Block/Template/Zend.php b/app/code/core/Mage/Core/Block/Template/Zend.php index e3038ab5dc6..81a45469aab 100644 --- a/app/code/core/Mage/Core/Block/Template/Zend.php +++ b/app/code/core/Mage/Core/Block/Template/Zend.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Zend html block * @@ -34,14 +33,13 @@ */ class Mage_Core_Block_Template_Zend extends Mage_Core_Block_Template { - + /** + * @var Zend_View + */ protected $_view = null; /** * Class constructor. Base html block - * - * @param none - * @return void */ public function _construct() { @@ -49,10 +47,16 @@ public function _construct() $this->_view = new Zend_View(); } - public function assign($key, $value=null) + /** + * @param array|string $key + * @param null $value + * @return $this|Mage_Core_Block_Template + * @throws Zend_View_Exception + */ + public function assign($key, $value = null) { if (is_array($key) && is_null($value)) { - foreach ($key as $k=>$v) { + foreach ($key as $k => $v) { $this->assign($k, $v); } } elseif (!is_null($value)) { @@ -61,14 +65,21 @@ public function assign($key, $value=null) return $this; } + /** + * @param string $dir + * @return void + */ public function setScriptPath($dir) { $this->_view->setScriptPath($dir.DS); } + /** + * @param string $fileName + * @return string + */ public function fetchView($fileName) { return $this->_view->render($fileName); } - } diff --git a/app/code/core/Mage/Core/Block/Text.php b/app/code/core/Mage/Core/Block/Text.php index bda523b7d96..5b6482b3090 100644 --- a/app/code/core/Mage/Core/Block/Text.php +++ b/app/code/core/Mage/Core/Block/Text.php @@ -29,22 +29,41 @@ * Base html block * * @author Magento Core Team + * + * @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 { - + /** + * @param string $text + * @return $this + */ public function setText($text) { $this->setData('text', $text); return $this; } + /** + * @return string + */ public function getText() { return $this->getData('text'); } - public function addText($text, $before=false) + /** + * @param string $text + * @param bool $before + */ + public function addText($text, $before = false) { if ($before) { $this->setText($text.$this->getText()); @@ -53,6 +72,9 @@ public function addText($text, $before=false) } } + /** + * @return string + */ protected function _toHtml() { if (!$this->_beforeToHtml()) { @@ -61,5 +83,4 @@ protected function _toHtml() return $this->getText(); } - } diff --git a/app/code/core/Mage/Core/Block/Text/List.php b/app/code/core/Mage/Core/Block/Text/List.php index 57e51202b06..beb90d42cd7 100644 --- a/app/code/core/Mage/Core/Block/Text/List.php +++ b/app/code/core/Mage/Core/Block/Text/List.php @@ -29,9 +29,11 @@ * * @author Magento Core Team */ - class Mage_Core_Block_Text_List extends Mage_Core_Block_Text { + /** + * @inheritDoc + */ protected function _toHtml() { $this->setText(''); 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 88fea949c3e..a92e51fd0b0 100644 --- a/app/code/core/Mage/Core/Block/Text/List/Item.php +++ b/app/code/core/Mage/Core/Block/Text/List/Item.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * List item block * @@ -32,6 +31,11 @@ */ class Mage_Core_Block_Text_List_Item extends Mage_Core_Block_Text { + /** + * @param array $liParams + * @param array $innerText + * @return $this + */ public function setLink($liParams, $innerText) { $this->setLiParams($liParams); @@ -40,12 +44,15 @@ public function setLink($liParams, $innerText) return $this; } + /** + * @inheritDoc + */ protected function _toHtml() { $this->setText('getLiParams(); if (!empty($params) && is_array($params)) { - foreach ($params as $key=>$value) { + foreach ($params as $key => $value) { $this->addText(' '.$key.'="'.addslashes($value).'"'); } } elseif (is_string($params)) { @@ -55,5 +62,4 @@ protected function _toHtml() return parent::_toHtml(); } - } 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 6db0108f42b..f8aade1605e 100644 --- a/app/code/core/Mage/Core/Block/Text/List/Link.php +++ b/app/code/core/Mage/Core/Block/Text/List/Link.php @@ -32,7 +32,14 @@ */ class Mage_Core_Block_Text_List_Link extends Mage_Core_Block_Text { - public function setLink($liParams, $aParams, $innerText, $afterText='') + /** + * @param array $liParams + * @param array $aParams + * @param string $innerText + * @param string $afterText + * @return $this + */ + public function setLink($liParams, $aParams, $innerText, $afterText = '') { $this->setLiParams($liParams); $this->setAParams($aParams); @@ -42,12 +49,15 @@ public function setLink($liParams, $aParams, $innerText, $afterText='') return $this; } + /** + * @inheritDoc + */ protected function _toHtml() { $this->setText('getLiParams(); if (!empty($params) && is_array($params)) { - foreach ($params as $key=>$value) { + foreach ($params as $key => $value) { $this->addText(' '.$key.'="'.addslashes($value).'"'); } } elseif (is_string($params)) { @@ -57,7 +67,7 @@ protected function _toHtml() $params = $this->getAParams(); if (!empty($params) && is_array($params)) { - foreach ($params as $key=>$value) { + foreach ($params as $key => $value) { $this->addText(' '.$key.'="'.addslashes($value).'"'); } } elseif (is_string($params)) { @@ -68,5 +78,4 @@ protected function _toHtml() return parent::_toHtml(); } - } diff --git a/app/code/core/Mage/Core/Block/Text/Tag.php b/app/code/core/Mage/Core/Block/Text/Tag.php index 2b0dd60b7c3..db097b4458c 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag.php +++ b/app/code/core/Mage/Core/Block/Text/Tag.php @@ -24,11 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Base html block * * @author Magento Core Team + * + * @method string getTagContents() + * @method $this setTagContents(string $value) + * @method getTagName() + * @method array getTagParams() + * @method $this setTagParams(array $value) */ class Mage_Core_Block_Text_Tag extends Mage_Core_Block_Text { @@ -39,10 +44,15 @@ protected function _construct() $this->setTagParams(array()); } - public function setTagParam($param, $value=null) + /** + * @param string|array $param + * @param null $value + * @return $this + */ + public function setTagParam($param, $value = null) { if (is_array($param) && is_null($value)) { - foreach ($param as $k=>$v) { + foreach ($param as $k => $v) { $this->setTagParam($k, $v); } } else { @@ -53,17 +63,24 @@ public function setTagParam($param, $value=null) return $this; } + /** + * @param string $text + * @return $this + */ public function setContents($text) { $this->setTagContents($text); return $this; } + /** + * @inheritDoc + */ protected function _toHtml() { $this->setText('<'.$this->getTagName().' '); if ($this->getTagParams()) { - foreach ($this->getTagParams() as $k=>$v) { + foreach ($this->getTagParams() as $k => $v) { $this->addText($k.'="'.$v.'" '); } } @@ -71,5 +88,4 @@ protected function _toHtml() $this->addText('>'.$this->getTagContents().'getTagName().'>'."\r\n"); return parent::_toHtml(); } - } diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Css.php b/app/code/core/Mage/Core/Block/Text/Tag/Css.php index c304b269326..871f9f881d0 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Css.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Css.php @@ -24,15 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Base html block * + * @method Mage_Core_Block_Text_Tag_Css setTagName(string $value) + * @method Mage_Core_Block_Text_Tag_Css setTagParams(array $value) + * * @author Magento Core Team */ class Mage_Core_Block_Text_Tag_Css extends Mage_Core_Block_Text_Tag { - protected function _construct() { parent::_construct(); @@ -40,7 +41,12 @@ protected function _construct() $this->setTagParams(array('rel'=>'stylesheet', 'type'=>'text/css', 'media'=>'all')); } - public function setHref($href, $type=null) + /** + * @param string $href + * @param string|null $type + * @return Mage_Core_Block_Text_Tag_Css + */ + public function setHref($href, $type = null) { $type = (string)$type; if (empty($type)) { @@ -50,5 +56,4 @@ public function setHref($href, $type=null) return $this->setTagParam('href', $url); } - } diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php b/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php index 0c6859319a7..7ed44598d2d 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Css/Admin.php @@ -24,15 +24,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Base html block * * @author Magento Core Team + * + * @method string getTheme() */ class Mage_Core_Block_Text_Tag_Css_Admin extends Mage_Core_Block_Text_Tag_Css { - protected function _construct() { parent::_construct(); @@ -40,7 +40,12 @@ protected function _construct() $this->setAttribute('theme', $theme); } - public function setHref($href, $type=null) + /** + * @param string $href + * @param string|null $type + * @return $this + */ + public function setHref($href, $type = null) { $type = (string)$type; if (empty($type)) { @@ -49,5 +54,4 @@ public function setHref($href, $type=null) $url = Mage::getBaseUrl($type).$href.$this->getTheme().'.css'; return $this->setTagParam('href', $url); } - } diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Debug.php b/app/code/core/Mage/Core/Block/Text/Tag/Debug.php index 120137b4858..7e46f5ccb29 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Debug.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Debug.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Base html block * @@ -32,7 +31,6 @@ */ class Mage_Core_Block_Text_Tag_Debug extends Mage_Core_Block_Text_Tag { - protected function _construct() { parent::_construct(); @@ -41,9 +39,12 @@ protected function _construct() )); } + /** + * @param mixed $value + * @return Mage_Core_Block_Text_Tag_Debug + */ public function setValue($value) { return $this->setContents(print_r($value, 1)); } - } diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Js.php b/app/code/core/Mage/Core/Block/Text/Tag/Js.php index 7a1828fb016..36b1f700dc8 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Js.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Js.php @@ -24,11 +24,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Base html block * * @author Magento Core Team + * + * @method $this setTagName(string $value) + * @method $this setTagParams(array $value) */ class Mage_Core_Block_Text_Tag_Js extends Mage_Core_Block_Text_Tag { @@ -40,7 +42,12 @@ protected function _construct() $this->setTagParams(array('language'=>'javascript', 'type'=>'text/javascript')); } - public function setSrc($src, $type=null) + /** + * @param string $src + * @param string|null $type + * @return $this + */ + public function setSrc($src, $type = null) { $type = (string)$type; if (empty($type)) { @@ -50,5 +57,4 @@ public function setSrc($src, $type=null) return $this->setTagParam('src', $url); } - } diff --git a/app/code/core/Mage/Core/Block/Text/Tag/Meta.php b/app/code/core/Mage/Core/Block/Text/Tag/Meta.php index 6299d890030..b0c7b2b5315 100644 --- a/app/code/core/Mage/Core/Block/Text/Tag/Meta.php +++ b/app/code/core/Mage/Core/Block/Text/Tag/Meta.php @@ -24,9 +24,19 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @method string getContentType() + * @method $this setContentType(string $value) + * @method string getTitle() + * @method string getDescription() + * @method string getKeywords() + * @method string getRobots() + */ class Mage_Core_Block_Text_Tag_Meta extends Mage_Core_Block_Text { + /** + * @return string + */ protected function _toHtml() { if (!$this->getContentType()) { diff --git a/app/code/core/Mage/Core/Controller/Front/Action.php b/app/code/core/Mage/Core/Controller/Front/Action.php index 8ea3e4fa950..9883a32e421 100644 --- a/app/code/core/Mage/Core/Controller/Front/Action.php +++ b/app/code/core/Mage/Core/Controller/Front/Action.php @@ -78,7 +78,7 @@ public function preDispatch() public function postDispatch() { parent::postDispatch(); - if (!$this->getFlag('', self::FLAG_NO_START_SESSION )) { + if (!$this->getFlag('', self::FLAG_NO_START_SESSION)) { Mage::getSingleton('core/session')->setLastUrl(Mage::getUrl('*/*/*', array('_current'=>true))); } return $this; @@ -107,7 +107,10 @@ public function __() * @param int $contentLength explicit content length, if strlen($content) isn't applicable * @return $this */ - protected function _prepareDownloadResponse($fileName, $content, $contentType = 'application/octet-stream', + protected function _prepareDownloadResponse( + $fileName, + $content, + $contentType = 'application/octet-stream', $contentLength = null ) { $session = Mage::getSingleton('admin/session'); diff --git a/app/code/core/Mage/Core/Controller/Front/Router.php b/app/code/core/Mage/Core/Controller/Front/Router.php index 95bade7cd29..196a2132b25 100644 --- a/app/code/core/Mage/Core/Controller/Front/Router.php +++ b/app/code/core/Mage/Core/Controller/Front/Router.php @@ -24,21 +24,30 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Controller_Front_Router { protected $_config = null; - + + /** + * @param Mage_Core_Model_Config_Element $config + */ public function __construct($config) { $this->_config = $config; } - + + /** + * @return Mage_Core_Model_Config_Element + */ public function getConfig() { return $this->_config; } - + + /** + * @param Zend_Controller_Router_Interface $router + * @return $this + */ public function addRoutes(Zend_Controller_Router_Interface $router) { $frontName = $this->_config->getName(); @@ -50,8 +59,12 @@ public function addRoutes(Zend_Controller_Router_Interface $router) return $this; } - - public function getUrl($params=array()) + + /** + * @param array $params + * @return string + */ + public function getUrl($params = array()) { static $reservedKeys = array('module'=>1, 'controller'=>1, 'action'=>1, 'array'=>1); @@ -70,7 +83,7 @@ public function getUrl($params=array()) if (!empty($params)) { $paramsStr = ''; - foreach ($params as $key=>$value) { + foreach ($params as $key => $value) { if (!isset($reservedKeys[$key]) && '_'!==$key[0] && !empty($value)) { $paramsStr .= $key.'/'.$value.'/'; } diff --git a/app/code/core/Mage/Core/Controller/Request/Http.php b/app/code/core/Mage/Core/Controller/Request/Http.php index 0ecfdc46ad9..18d9b7eaf4a 100644 --- a/app/code/core/Mage/Core/Controller/Request/Http.php +++ b/app/code/core/Mage/Core/Controller/Request/Http.php @@ -49,7 +49,7 @@ class Mage_Core_Controller_Request_Http extends Zend_Controller_Request_Http /** * Path info array used before applying rewrite from config * - * @var null || array + * @var null|array */ protected $_rewritedPathInfo= null; protected $_requestedRouteName = null; @@ -64,7 +64,7 @@ class Mage_Core_Controller_Request_Http extends Zend_Controller_Request_Http * Streight request flag. * If flag is determined no additional logic is applicable * - * @var $_isStraight bool + * @var bool $_isStraight */ protected $_isStraight = false; @@ -97,6 +97,10 @@ public function getOriginalPathInfo() return $this->_originalPathInfo; } + /** + * @return string|null + * @throws Mage_Core_Model_Store_Exception + */ public function getStoreCodeFromPath() { if (!$this->_storeCode) { @@ -112,14 +116,12 @@ public function getStoreCodeFromPath() $this->setPathInfo(implode('/', $p)); $this->_storeCode = $storeCode; Mage::app()->setCurrentStore($storeCode); - } - else { + } else { $this->_storeCode = Mage::app()->getStore()->getCode(); } } else { $this->_storeCode = Mage::app()->getStore()->getCode(); } - } return $this->_storeCode; } @@ -166,8 +168,7 @@ public function setPathInfo($pathInfo = null) if ($storeCode!=='' && isset($stores[$storeCode])) { Mage::app()->setCurrentStore($storeCode); $pathInfo = '/'.(isset($pathParts[1]) ? $pathParts[1] : ''); - } - elseif ($storeCode !== '') { + } elseif ($storeCode !== '') { $this->setActionName('noRoute'); } } @@ -239,6 +240,10 @@ public function getDirectFrontNames() return $this->_directFrontNames; } + /** + * @return Zend_Controller_Request_Http + * @throws Zend_Controller_Request_Exception + */ public function getOriginalRequest() { $request = new Zend_Controller_Request_Http(); @@ -246,11 +251,17 @@ public function getOriginalRequest() return $request; } + /** + * @return string + */ public function getRequestString() { return $this->_requestString; } + /** + * @return string + */ public function getBasePath() { $path = parent::getBasePath(); @@ -273,11 +284,17 @@ public function getBaseUrl($raw = false) return $url; } + /** + * @param string $route + * @return $this + */ public function setRouteName($route) { $this->_route = $route; $router = Mage::app()->getFrontController()->getRouterByRoute($route); - if (!$router) return $this; + if (!$router) { + return $this; + } $module = $router->getFrontNameByRoute($route); if ($module) { $this->setModuleName($module); @@ -285,6 +302,9 @@ public function setRouteName($route) return $this; } + /** + * @return string + */ public function getRouteName() { return $this->_route; @@ -328,8 +348,7 @@ public function setPost($key, $value = null) { if (is_array($key)) { $_POST = $key; - } - else { + } else { $_POST[$key] = $value; } return $this; @@ -488,7 +507,7 @@ public function setRoutingInfo($data) * Collect properties changed by _forward in protected storage * before _forward was called first time. * - * @return Mage_Core_Controller_Varien_Action + * @return $this */ public function initForward() { diff --git a/app/code/core/Mage/Core/Controller/Response/Http.php b/app/code/core/Mage/Core/Controller/Response/Http.php index e15db025552..b5fb84856a3 100644 --- a/app/code/core/Mage/Core/Controller/Response/Http.php +++ b/app/code/core/Mage/Core/Controller/Response/Http.php @@ -44,7 +44,7 @@ class Mage_Core_Controller_Response_Http extends Zend_Controller_Response_Http * * @link http://bugs.php.net/bug.php?id=36705 * - * @return $this + * @inheritDoc */ public function sendHeaders() { @@ -55,7 +55,7 @@ public function sendHeaders() if (substr(php_sapi_name(), 0, 3) == 'cgi') { $statusSent = false; - foreach ($this->_headersRaw as $i=>$header) { + foreach ($this->_headersRaw as $i => $header) { if (stripos($header, 'status:')===0) { if ($statusSent) { unset($this->_headersRaw[$i]); @@ -64,7 +64,7 @@ public function sendHeaders() } } } - foreach ($this->_headers as $i=>$header) { + foreach ($this->_headers as $i => $header) { if (strcasecmp($header['name'], 'status')===0) { if ($statusSent) { unset($this->_headers[$i]); @@ -78,6 +78,9 @@ public function sendHeaders() return parent::sendHeaders(); } + /** + * @inheritDoc + */ public function sendResponse() { Mage::dispatchEvent('http_response_send_before', array('response'=>$this)); @@ -87,9 +90,7 @@ public function sendResponse() /** * Additionally check for session messages in several domains case * - * @param string $url - * @param int $code - * @return $this + * @inheritDoc */ public function setRedirect($url, $code = 302) { @@ -101,8 +102,10 @@ public function setRedirect($url, $code = 302) } self::$_transportObject->setUrl($url); self::$_transportObject->setCode($code); - Mage::dispatchEvent('controller_response_redirect', - array('response' => $this, 'transport' => self::$_transportObject)); + Mage::dispatchEvent( + 'controller_response_redirect', + array('response' => $this, 'transport' => self::$_transportObject) + ); return parent::setRedirect(self::$_transportObject->getUrl(), self::$_transportObject->getCode()); } diff --git a/app/code/core/Mage/Core/Controller/Varien/Action.php b/app/code/core/Mage/Core/Controller/Varien/Action.php index 7c6e1b8c760..83edbebd8ba 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Action.php +++ b/app/code/core/Mage/Core/Controller/Varien/Action.php @@ -55,14 +55,14 @@ abstract class Mage_Core_Controller_Varien_Action /** * Request object * - * @var Zend_Controller_Request_Abstract + * @var Mage_Core_Controller_Request_Http */ protected $_request; /** * Response object * - * @var Zend_Controller_Response_Abstract + * @var Mage_Core_Controller_Response_Http */ protected $_response; @@ -149,6 +149,10 @@ protected function _construct() { } + /** + * @param string $action + * @return bool + */ public function hasAction($action) { return method_exists($this, $this->getActionMethodName($action)); @@ -179,20 +183,18 @@ public function getResponse() * * @param string $action * @param string $flag - * @return bool + * @return array|bool */ - public function getFlag($action, $flag='') + public function getFlag($action, $flag = '') { if (''===$action) { $action = $this->getRequest()->getActionName(); } if (''===$flag) { return $this->_flags; - } - elseif (isset($this->_flags[$action][$flag])) { + } elseif (isset($this->_flags[$action][$flag])) { return $this->_flags[$action][$flag]; - } - else { + } else { return false; } } @@ -202,8 +204,8 @@ public function getFlag($action, $flag='') * * @param string $action * @param string $flag - * @param string $value - * @return Mage_Core_Controller_Varien_Action + * @param string|int $value + * @return $this */ public function setFlag($action, $flag, $value) { @@ -221,7 +223,7 @@ public function setFlag($action, $flag, $value) * @param string $delimiter * @return string */ - public function getFullActionName($delimiter='_') + public function getFullActionName($delimiter = '_') { return $this->getRequest()->getRequestedRouteName().$delimiter. $this->getRequest()->getRequestedControllerName().$delimiter. @@ -244,7 +246,7 @@ public function getLayout() * @param string|null|bool $handles * @param bool $generateBlocks * @param bool $generateXml - * @return Mage_Core_Controller_Varien_Action + * @return $this */ public function loadLayout($handles = null, $generateBlocks = true, $generateXml = true) { @@ -272,6 +274,10 @@ public function loadLayout($handles = null, $generateBlocks = true, $generateXml return $this; } + /** + * @return $this + * @throws Mage_Core_Model_Store_Exception + */ public function addActionLayoutHandles() { $update = $this->getLayout()->getUpdate(); @@ -291,6 +297,10 @@ public function addActionLayoutHandles() return $this; } + /** + * @return $this + * @throws Mage_Core_Exception + */ public function loadLayoutUpdates() { $_profilerKey = self::PROFILER_KEY . '::' .$this->getFullActionName(); @@ -309,11 +319,14 @@ public function loadLayoutUpdates() return $this; } + /** + * @return $this + */ public function generateLayoutXml() { $_profilerKey = self::PROFILER_KEY . '::' . $this->getFullActionName(); // dispatch event for adding text layouts - if(!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) { + if (!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) { Mage::dispatchEvent( 'controller_action_layout_generate_xml_before', array('action'=>$this, 'layout'=>$this->getLayout()) @@ -328,11 +341,14 @@ public function generateLayoutXml() return $this; } + /** + * @return $this + */ public function generateLayoutBlocks() { $_profilerKey = self::PROFILER_KEY . '::' . $this->getFullActionName(); // dispatch event for adding xml layout elements - if(!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) { + if (!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) { Mage::dispatchEvent( 'controller_action_layout_generate_blocks_before', array('action'=>$this, 'layout'=>$this->getLayout()) @@ -344,7 +360,7 @@ public function generateLayoutBlocks() $this->getLayout()->generateBlocks(); Varien_Profiler::stop("$_profilerKey::layout_generate_blocks"); - if(!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) { + if (!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) { Mage::dispatchEvent( 'controller_action_layout_generate_blocks_after', array('action'=>$this, 'layout'=>$this->getLayout()) @@ -358,9 +374,9 @@ public function generateLayoutBlocks() * Rendering layout * * @param string $output - * @return Mage_Core_Controller_Varien_Action + * @return $this|void */ - public function renderLayout($output='') + public function renderLayout($output = '') { $_profilerKey = self::PROFILER_KEY . '::' . $this->getFullActionName(); @@ -395,6 +411,9 @@ public function renderLayout($output='') return $this; } + /** + * @param string $action + */ public function dispatch($action) { try { @@ -423,8 +442,7 @@ public function dispatch($action) Varien_Profiler::stop(self::PROFILER_KEY.'::postdispatch'); } } - } - catch (Mage_Core_Controller_Varien_Exception $e) { + } catch (Mage_Core_Controller_Varien_Exception $e) { // set prepared flags foreach ($e->getResultFlags() as $flagData) { list($action, $flag, $value) = $flagData; @@ -489,7 +507,7 @@ public function preDispatch() $checkCookie = in_array($this->getRequest()->getActionName(), $this->_cookieCheckActions) && !$this->getRequest()->getParam('nocookie', false); $cookies = Mage::getSingleton('core/cookie')->get(); - /** @var $session Mage_Core_Model_Session */ + /** @var Mage_Core_Model_Session $session */ $session = Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start(); if (empty($cookies)) { @@ -523,10 +541,14 @@ public function preDispatch() } Mage::dispatchEvent('controller_action_predispatch', array('controller_action' => $this)); - Mage::dispatchEvent('controller_action_predispatch_' . $this->getRequest()->getRouteName(), - array('controller_action' => $this)); - Mage::dispatchEvent('controller_action_predispatch_' . $this->getFullActionName(), - array('controller_action' => $this)); + Mage::dispatchEvent( + 'controller_action_predispatch_' . $this->getRequest()->getRouteName(), + array('controller_action' => $this) + ); + Mage::dispatchEvent( + 'controller_action_predispatch_' . $this->getFullActionName(), + array('controller_action' => $this) + ); } /** @@ -549,6 +571,9 @@ public function postDispatch() Mage::dispatchEvent('controller_action_postdispatch', array('controller_action'=>$this)); } + /** + * @param mixed|null $coreRoute + */ public function norouteAction($coreRoute = null) { $status = ( $this->getRequest()->getParam('__status__') ) @@ -567,7 +592,8 @@ public function norouteAction($coreRoute = null) $status->getForwardAction(), $status->getForwardController(), $status->getForwardModule(), - array('__status__' => $status)); + array('__status__' => $status) + ); } } @@ -581,11 +607,9 @@ public function noCookiesAction() if ($url = $redirect->getRedirectUrl()) { $this->_redirectUrl($url); - } - elseif ($redirect->getRedirect()) { + } elseif ($redirect->getRedirect()) { $this->_redirect($redirect->getPath(), $redirect->getArguments()); - } - else { + } else { $this->loadLayout(array('default', 'noCookie')); $this->renderLayout(); } @@ -628,7 +652,7 @@ protected function _forward($action, $controller = null, $module = null, array $ * Initializing layout messages by message storage(s), loading and adding messages to layout messages block * * @param string|array $messagesStorage - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _initLayoutMessages($messagesStorage) { @@ -642,10 +666,9 @@ protected function _initLayoutMessages($messagesStorage) $block->addMessages($storage->getMessages(true)); $block->setEscapeMessageFlag($storage->getEscapeMessages(true)); $block->addStorageType($storageName); - } - else { + } else { Mage::throwException( - Mage::helper('core')->__('Invalid messages storage "%s" for layout messages initialization', (string) $storageName) + Mage::helper('core')->__('Invalid messages storage "%s" for layout messages initialization', (string) $storageName) ); } } @@ -656,7 +679,7 @@ protected function _initLayoutMessages($messagesStorage) * Initializing layout messages by message storage(s), loading and adding messages to layout messages block * * @param string|array $messagesStorage - * @return Mage_Core_Controller_Varien_Action + * @return $this */ public function initLayoutMessages($messagesStorage) { @@ -667,7 +690,7 @@ public function initLayoutMessages($messagesStorage) * Set redirect url into response * * @param string $url - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _redirectUrl($url) { @@ -680,7 +703,7 @@ protected function _redirectUrl($url) * * @param string $path * @param array $arguments - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _redirect($path, $arguments = array()) { @@ -693,11 +716,11 @@ protected function _redirect($path, $arguments = array()) * * @param string $path * @param array $arguments - * @return Mage_Core_Controller_Varien_Action + * @return $this */ public function setRedirectWithCookieCheck($path, array $arguments = array()) { - /** @var $session Mage_Core_Model_Session */ + /** @var Mage_Core_Model_Session $session */ $session = Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace)); if ($session->getCookieShouldBeReceived() && Mage::app()->getUseSessionInUrl() && $this->_sessionNamespace != Mage_Adminhtml_Controller_Action::SESSION_NAMESPACE @@ -715,7 +738,7 @@ public function setRedirectWithCookieCheck($path, array $arguments = array()) * Redirect to success page * * @param string $defaultUrl - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _redirectSuccess($defaultUrl) { @@ -734,7 +757,7 @@ protected function _redirectSuccess($defaultUrl) * Redirect to error page * * @param string $defaultUrl - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _redirectError($defaultUrl) { @@ -753,9 +776,9 @@ protected function _redirectError($defaultUrl) * Set referer url for redirect in response * * @param string $defaultUrl - * @return Mage_Core_Controller_Varien_Action + * @return $this */ - protected function _redirectReferer($defaultUrl=null) + protected function _redirectReferer($defaultUrl = null) { $refererUrl = $this->_getRefererUrl(); @@ -919,7 +942,7 @@ protected function _validateFormKey() * @see self::_renderTitles() * @param string|false|-1|null $text * @param bool $resetIfExists - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _title($text = null, $resetIfExists = true) { @@ -1031,14 +1054,14 @@ protected function _filterDateTime($array, $dateFields) * that case * @param string $contentType * @param int $contentLength explicit content length, if strlen($content) isn't applicable - * @return Mage_Core_Controller_Varien_Action + * @return $this */ protected function _prepareDownloadResponse( $fileName, $content, $contentType = 'application/octet-stream', - $contentLength = null) - { + $contentLength = null + ) { $session = Mage::getSingleton('admin/session'); if ($session->isFirstPageAfterLogin()) { $this->_redirect($session->getUser()->getStartupPageUrl()); diff --git a/app/code/core/Mage/Core/Controller/Varien/Front.php b/app/code/core/Mage/Core/Controller/Varien/Front.php index 8f4590dd6dd..a783d3184ea 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Front.php +++ b/app/code/core/Mage/Core/Controller/Varien/Front.php @@ -24,7 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * @method Mage_Core_Controller_Varien_Action getAction() + * @method $this setAction(Mage_Core_Controller_Varien_Action $value) + * @method bool getNoRender() + */ class Mage_Core_Controller_Varien_Front extends Varien_Object { protected $_defaults = array(); @@ -40,7 +44,12 @@ class Mage_Core_Controller_Varien_Front extends Varien_Object const XML_STORE_ROUTERS_PATH = 'web/routers'; - public function setDefault($key, $value=null) + /** + * @param array|string $key + * @param string|null $value + * @return $this + */ + public function setDefault($key, $value = null) { if (is_array($key)) { $this->_defaults = $key; @@ -50,7 +59,11 @@ public function setDefault($key, $value=null) return $this; } - public function getDefault($key=null) + /** + * @param string|null $key + * @return array|false + */ + public function getDefault($key = null) { if (is_null($key)) { return $this->_defaults; @@ -73,7 +86,7 @@ public function getRequest() /** * Retrieve response object * - * @return Zend_Controller_Response_Http + * @return Mage_Core_Controller_Response_Http */ public function getResponse() { @@ -98,7 +111,7 @@ public function addRouter($name, Mage_Core_Controller_Varien_Router_Abstract $ro * Retrieve router by name * * @param string $name - * @return Mage_Core_Controller_Varien_Router_Abstract + * @return Mage_Core_Controller_Varien_Router_Abstract|false */ public function getRouter($name) { @@ -135,6 +148,7 @@ public function init() continue; } if (isset($routerInfo['class'])) { + /** @var Mage_Core_Controller_Varien_Router_Standard $router */ $router = new $routerInfo['class']; if (isset($routerInfo['area'])) { $router->collectRoutes($routerInfo['area'], $routerCode); @@ -153,6 +167,10 @@ public function init() return $this; } + /** + * @return $this + * @throws Mage_Core_Exception + */ public function dispatch() { $request = $this->getRequest(); @@ -170,7 +188,7 @@ public function dispatch() $i = 0; while (!$request->isDispatched() && $i++ < 100) { foreach ($this->_routers as $router) { - /** @var $router Mage_Core_Controller_Varien_Router_Abstract */ + /** @var Mage_Core_Controller_Varien_Router_Abstract $router */ if ($router->match($request)) { break; } @@ -198,7 +216,6 @@ public function dispatch() protected function _getRequestRewriteController() { $className = (string)Mage::getConfig()->getNode('global/request_rewrite/model'); - return Mage::getSingleton('core/factory')->getModel($className, array( 'routers' => $this->getRouters(), )); @@ -231,6 +248,10 @@ public function getRouterByRoute($routeName) return $router; } + /** + * @param string $frontName + * @return false|Mage_Core_Controller_Varien_Router_Standard + */ public function getRouterByFrontName($frontName) { // empty route supplied - return base url @@ -255,7 +276,6 @@ public function getRouterByFrontName($frontName) /** * Apply configuration rewrites to current url * - * @return $this * @deprecated since 1.7.0.2. Refactored and moved to Mage_Core_Controller_Request_Rewrite */ public function rewrite() @@ -375,7 +395,7 @@ protected function _isAdminFrontNameMatched($request) if (is_array($adminFrontNameNodes)) { foreach ($adminFrontNameNodes as $frontNameNode) { - /** @var $frontNameNode SimpleXMLElement */ + /** @var SimpleXMLElement $frontNameNode */ array_push($adminFrontNames, (string)$frontNameNode); } } diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php b/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php index 80c8eeefbef..d53bb776d91 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Abstract.php @@ -28,26 +28,45 @@ abstract class Mage_Core_Controller_Varien_Router_Abstract { protected $_front; + /** + * @param Mage_Core_Controller_Varien_Front $front + * @return $this + */ public function setFront($front) { $this->_front = $front; return $this; } + /** + * @return Mage_Core_Controller_Varien_Front + */ public function getFront() { return $this->_front; } + /** + * @param string $routeName + * @return string + */ public function getFrontNameByRoute($routeName) { return $routeName; } + /** + * @param string $frontName + * @return string + */ public function getRouteByFrontName($frontName) { return $frontName; } + /** + * @param Zend_Controller_Request_Http $request + * @return bool + */ abstract public function match(Zend_Controller_Request_Http $request); } diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php index 756ec2066e0..94d8f442421 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Admin.php @@ -133,10 +133,7 @@ public function collectRoutes($configArea, $useRouterName) /** * Add module definition to routes. * - * @param string $frontName - * @param mixed $moduleName - * @param string $routeName - * @return $this + * @inheritDoc */ public function addModule($frontName, $moduleName, $routeName) { @@ -157,7 +154,7 @@ public function addModule($frontName, $moduleName, $routeName) * Check if current controller instance is allowed in current router. * * @param Mage_Core_Controller_Varien_Action $controllerInstance - * @return boolean + * @return true */ protected function _validateControllerInstance($controllerInstance) { diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php index ec1f028e9a9..468a0cd8a3b 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php @@ -30,18 +30,23 @@ class Mage_Core_Controller_Varien_Router_Standard extends Mage_Core_Controller_V protected $_routes = array(); protected $_dispatchData = array(); + /** + * @param string $configArea + * @param string $useRouterName + */ public function collectRoutes($configArea, $useRouterName) { $routers = array(); $routersConfigNode = Mage::getConfig()->getNode($configArea.'/routers'); - if($routersConfigNode) { + if ($routersConfigNode) { $routers = $routersConfigNode->children(); } - foreach ($routers as $routerName=>$routerConfig) { + foreach ($routers as $routerName => $routerConfig) { $use = (string)$routerConfig->use; if ($use == $useRouterName) { $modules = array((string)$routerConfig->args->module); if ($routerConfig->args->modules) { + /** @var Varien_Simplexml_Element $customModule */ foreach ($routerConfig->args->modules->children() as $customModule) { if ((string)$customModule) { if ($before = $customModule->getAttribute('before')) { @@ -104,8 +109,8 @@ protected function _afterModuleMatch() /** * Match the request * - * @param Zend_Controller_Request_Http $request - * @return boolean + * @param Mage_Core_Controller_Request_Http $request + * @inheritDoc */ public function match(Zend_Controller_Request_Http $request) { @@ -227,8 +232,11 @@ public function match(Zend_Controller_Request_Http $request) } // instantiate controller class - $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, - $front->getResponse()); + $controllerInstance = Mage::getControllerInstance( + $controllerClassName, + $request, + $front->getResponse() + ); if (!$controllerInstance->hasAction($action)) { return false; @@ -290,7 +298,10 @@ protected function _validateControllerInstance($controllerInstance) * Generating and validating class file name, * class and if evrything ok do include if needed and return of class name * + * @param string $realModule + * @param string $controller * @return mixed + * @throws Mage_Core_Exception */ protected function _validateControllerClassName($realModule, $controller) { @@ -313,6 +324,10 @@ protected function _validateControllerClassName($realModule, $controller) } /** + * @param string $controllerFileName + * @param string $controllerClassName + * @return bool + * @throws Mage_Core_Exception * @deprecated * @see _includeControllerClass() */ @@ -343,6 +358,12 @@ protected function _includeControllerClass($controllerFileName, $controllerClass return true; } + /** + * @param string $frontName + * @param string $moduleName + * @param string $routeName + * @return $this + */ public function addModule($frontName, $moduleName, $routeName) { $this->_modules[$frontName] = $moduleName; @@ -350,6 +371,10 @@ public function addModule($frontName, $moduleName, $routeName) return $this; } + /** + * @param string $frontName + * @return bool|string + */ public function getModuleByFrontName($frontName) { if (isset($this->_modules[$frontName])) { @@ -358,6 +383,11 @@ public function getModuleByFrontName($frontName) return false; } + /** + * @param string $moduleName + * @param string $modules + * @return bool + */ public function getModuleByName($moduleName, $modules) { foreach ($modules as $module) { @@ -369,6 +399,10 @@ public function getModuleByName($moduleName, $modules) return false; } + /** + * @param string $routeName + * @return false|string + */ public function getFrontNameByRoute($routeName) { if (isset($this->_routes[$routeName])) { @@ -377,11 +411,20 @@ public function getFrontNameByRoute($routeName) return false; } + /** + * @param string $frontName + * @return false|int|string + */ public function getRouteByFrontName($frontName) { return array_search($frontName, $this->_routes); } + /** + * @param string $realModule + * @param string $controller + * @return string + */ public function getControllerFileName($realModule, $controller) { $parts = explode('_', $realModule); @@ -394,6 +437,10 @@ public function getControllerFileName($realModule, $controller) return $file; } + /** + * @param string $fileName + * @return bool + */ public function validateControllerFileName($fileName) { if ($fileName && is_readable($fileName) && false===strpos($fileName, '//')) { @@ -402,12 +449,21 @@ public function validateControllerFileName($fileName) return false; } + /** + * @param string $realModule + * @param string $controller + * @return string + */ public function getControllerClassName($realModule, $controller) { $class = $realModule.'_'.uc_words($controller).'Controller'; return $class; } + /** + * @param array $p + * @return array + */ public function rewrite(array $p) { $rewrite = Mage::getConfig()->getNode('global/rewrite'); @@ -457,6 +513,10 @@ protected function _checkShouldBeSecure($request, $path = '') } } + /** + * @param Mage_Core_Controller_Request_Http $request + * @return string + */ protected function _getCurrentSecureUrl($request) { if ($alias = $request->getAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS)) { diff --git a/app/code/core/Mage/Core/Exception.php b/app/code/core/Mage/Core/Exception.php index 4e3de4af0c8..f4fe25e8db8 100644 --- a/app/code/core/Mage/Core/Exception.php +++ b/app/code/core/Mage/Core/Exception.php @@ -37,6 +37,10 @@ class Mage_Core_Exception extends Exception { protected $_messages = array(); + /** + * @param Mage_Core_Model_Message_Abstract $message + * @return $this + */ public function addMessage(Mage_Core_Model_Message_Abstract $message) { if (!isset($this->_messages[$message->getType()])) { @@ -46,7 +50,11 @@ public function addMessage(Mage_Core_Model_Message_Abstract $message) return $this; } - public function getMessages($type='') + /** + * @param string $type + * @return array|Mage_Core_Model_Message_Abstract[] + */ + public function getMessages($type = '') { if ('' == $type) { $arrRes = array(); diff --git a/app/code/core/Mage/Core/Helper/Abstract.php b/app/code/core/Mage/Core/Helper/Abstract.php index 0cce1200266..55410cca2ad 100644 --- a/app/code/core/Mage/Core/Helper/Abstract.php +++ b/app/code/core/Mage/Core/Helper/Abstract.php @@ -55,7 +55,7 @@ abstract class Mage_Core_Helper_Abstract /** * Retrieve request object * - * @return Zend_Controller_Request_Http + * @return Mage_Core_Controller_Request_Http */ protected function _getRequest() { @@ -79,12 +79,13 @@ protected function _loadCache($id) /** * Saving cache * - * @param mixed $data - * @param string $id - * @param array $tags + * @param mixed $data + * @param string $id + * @param array $tags + * @param null|false|int $lifeTime * @return Mage_Core_Helper_Abstract */ - protected function _saveCache($data, $id, $tags=array(), $lifeTime=false) + protected function _saveCache($data, $id, $tags = array(), $lifeTime = false) { Mage::app()->saveCache($data, $id, $tags, $lifeTime); return $this; @@ -108,7 +109,7 @@ protected function _removeCache($id) * @param array $tags * @return Mage_Core_Helper_Abstract */ - protected function _cleanCache($tags=array()) + protected function _cleanCache($tags = array()) { Mage::app()->cleanCache($tags); return $this; @@ -187,8 +188,11 @@ public function __() } /** - * @deprecated after 1.4.0.0-rc1 + * @param array $data + * @param array $allowedTags + * @return mixed * @see self::escapeHtml() + * @deprecated after 1.4.0.0-rc1 */ public function htmlEscape($data, $allowedTags = null) { @@ -198,7 +202,7 @@ public function htmlEscape($data, $allowedTags = null) /** * Escape html entities * - * @param mixed $data + * @param string|array $data * @param array $allowedTags * @return mixed */ @@ -261,6 +265,8 @@ public function stripTags($data, $allowableTags = null, $escape = false) } /** + * @param string $data + * @return string * @deprecated after 1.4.0.0-rc1 * @see self::escapeHtml() */ @@ -325,7 +331,7 @@ public function escapeScriptIdentifiers($data) * @param string $quote * @return mixed */ - public function jsQuoteEscape($data, $quote='\'') + public function jsQuoteEscape($data, $quote = '\'') { if (is_array($data)) { $result = array(); diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php index d73120ed0fa..538287948b3 100644 --- a/app/code/core/Mage/Core/Helper/Data.php +++ b/app/code/core/Mage/Core/Helper/Data.php @@ -121,8 +121,7 @@ public static function currencyByStore($value, $store = null, $format = true, $i } $value = $store->convertPrice($value, $format, $includeContainer); - } - catch (Exception $e){ + } catch (Exception $e) { $value = $e->getMessage(); } @@ -156,7 +155,7 @@ public function formatPrice($price, $includeContainer = true) /** * Format date using current locale options and time zone. * - * @param date|Zend_Date|null $date + * @param string|Zend_Date|null $date * @param string $format See Mage_Core_Model_Locale::FORMAT_TYPE_* constants * @param bool $showTime Whether to include time * @return string @@ -171,7 +170,7 @@ public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMA } if (is_null($date)) { $date = Mage::app()->getLocale()->date(Mage::getSingleton('core/date')->gmtTimestamp(), null, null); - } else if (!$date instanceof Zend_Date) { + } elseif (!$date instanceof Zend_Date) { $date = Mage::app()->getLocale()->date(strtotime($date), null, null); } @@ -187,7 +186,7 @@ public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMA /** * Format time using current locale options * - * @param date|Zend_Date|null $time + * @param string|Zend_Date|null $time * @param string $format * @param bool $showDate * @return string @@ -200,7 +199,7 @@ public function formatTime($time = null, $format = Mage_Core_Model_Locale::FORMA if (is_null($time)) { $date = Mage::app()->getLocale()->date(time()); - } else if ($time instanceof Zend_Date) { + } elseif ($time instanceof Zend_Date) { $date = $time; } else { $date = Mage::app()->getLocale()->date(strtotime($time)); @@ -243,11 +242,20 @@ public function decrypt($data) return $this->getEncryptor()->decrypt($data); } + /** + * @param string $key + * @return Varien_Crypt_Mcrypt + */ public function validateKey($key) { return $this->getEncryptor()->validateKey($key); } + /** + * @param int $len + * @param string|null $chars + * @return string + */ public function getRandomString($len, $chars = null) { if (is_null($chars)) { @@ -264,6 +272,7 @@ public function getRandomString($len, $chars = null) * * @param string $password * @param string|integer|boolean $salt + * @return string */ public function getHash($password, $salt = false) { @@ -271,7 +280,7 @@ public function getHash($password, $salt = false) } /** - * Generate password hash for user + * Generate password hash for user * * @param string $password * @param mixed $salt @@ -287,6 +296,12 @@ public function getHashPassword($password, $salt = false) return $this->getEncryptor()->getHashPassword($password, Mage_Admin_Model_User::HASH_SALT_EMPTY); } + /** + * @param string $password + * @param string $hash + * @return bool + * @throws Exception + */ public function validateHash($password, $hash) { return $this->getEncryptor()->validateHash($password, $hash); @@ -311,12 +326,17 @@ public function getVersionHash(Mage_Core_Model_Encryption $encryptionModel) * @param mixed $store * @return int */ - public function getStoreId($store=null) + public function getStoreId($store = null) { return Mage::app()->getStore($store)->getId(); } - public function removeAccents($string, $german=false) + /** + * @param string $string + * @param bool $german + * @return false|string + */ + public function removeAccents($string, $german = false) { static $replacements; @@ -353,7 +373,7 @@ public function removeAccents($string, $german=false) } $replacements[$german] = array(); - foreach ($subst as $k=>$v) { + foreach ($subst as $k => $v) { $replacements[$german][$k<256 ? chr($k) : '&#'.$k.';'] = $v; } } @@ -370,7 +390,11 @@ public function removeAccents($string, $german=false) return $string; } - public function isDevAllowed($storeId=null) + /** + * @param int|null $storeId + * @return bool + */ + public function isDevAllowed($storeId = null) { $allow = true; @@ -396,7 +420,7 @@ public function getCacheTypes() { $types = array(); $config = Mage::getConfig()->getNode(Mage_Core_Model_Cache::XML_PATH_TYPES); - foreach ($config->children() as $type=>$node) { + foreach ($config->children() as $type => $node) { $types[$type] = (string)$node->label; } return $types; @@ -412,7 +436,7 @@ public function getCacheBetaTypes() $types = array(); $config = Mage::getConfig()->getNode(self::XML_PATH_CACHE_BETA_TYPES); if ($config) { - foreach ($config->children() as $type=>$node) { + foreach ($config->children() as $type => $node) { $types[$type] = (string)$node->label; } } @@ -433,11 +457,10 @@ public function getCacheBetaTypes() * @param string $root * @return boolean */ - public function copyFieldset($fieldset, $aspect, $source, $target, $root='global') + public function copyFieldset($fieldset, $aspect, $source, $target, $root = 'global') { if (!(is_array($source) || $source instanceof Varien_Object) || !(is_array($target) || $target instanceof Varien_Object)) { - return false; } $fields = Mage::getConfig()->getFieldset($fieldset, $root); @@ -449,7 +472,7 @@ public function copyFieldset($fieldset, $aspect, $source, $target, $root='global $targetIsArray = is_array($target); $result = false; - foreach ($fields as $code=>$node) { + foreach ($fields as $code => $node) { if (empty($node->$aspect)) { continue; } @@ -497,7 +520,7 @@ public function copyFieldset($fieldset, $aspect, $source, $target, $root='global * $forceSetAll true will cause to set all possible values for all elements. * When false (default), only non-empty values will be set. * - * @param mixed $array + * @param Varien_Object[] $array * @param string $prefix * @param bool $forceSetAll * @return mixed @@ -525,8 +548,7 @@ public function decorateArray($array, $prefix = 'decorated_', $forceSetAll = fal $isEven = !$isEven; $i++; $this->_decorateArrayObject($element, $keyIsLast, ($i === $count), $forceSetAll || ($i === $count)); - } - elseif (is_array($element)) { + } elseif (is_array($element)) { if ($forceSetAll || (0 === $i)) { $array[$key][$keyIsFirst] = (0 === $i); } @@ -547,12 +569,18 @@ public function decorateArray($array, $prefix = 'decorated_', $forceSetAll = fal return $array; } - private function _decorateArrayObject($element, $key, $value, $dontSkip) { + /** + * @param Varien_Object $element + * @param string $key + * @param mixed $value + * @param bool $dontSkip + */ + private function _decorateArrayObject($element, $key, $value, $dontSkip) + { if ($dontSkip) { if ($element instanceof Varien_Object) { $element->setData($key, $value); - } - else { + } else { $element->$key = $value; } } @@ -607,13 +635,11 @@ private function _assocToXml(array $array, $rootName, SimpleXMLElement &$xml) } $hasStringKey = true; $xml->$key = $value; - } - elseif (is_int($key)) { + } elseif (is_int($key)) { $hasNumericKey = true; $xml->{$rootName}[$key] = $value; } - } - else { + } else { self::_assocToXml($value, $key, $xml->$key); } } @@ -639,14 +665,12 @@ public function xmlToAssoc(SimpleXMLElement $xml) foreach ($value->$key as $v) { $array[$key][$i++] = (string)$v; } - } - else { + } else { // try to transform it into string value, trimming spaces between elements $array[$key] = trim((string)$value); if (empty($array[$key]) && !empty($value)) { $array[$key] = self::xmlToAssoc($value); - } - // untrim strings values + } // untrim strings values else { $array[$key] = (string)$value; } @@ -666,7 +690,7 @@ public function xmlToAssoc(SimpleXMLElement $xml) public function jsonEncode($valueToEncode, $cycleCheck = false, $options = array()) { $json = Zend_Json::encode($valueToEncode, $cycleCheck, $options); - /* @var $inline Mage_Core_Model_Translate_Inline */ + /* @var Mage_Core_Model_Translate_Inline $inline */ $inline = Mage::getSingleton('core/translate_inline'); if ($inline->isAllowed()) { $inline->setIsJson(true); @@ -684,7 +708,9 @@ public function jsonEncode($valueToEncode, $cycleCheck = false, $options = array * switch added to prevent exceptions in json_decode * * @param string $encodedValue + * @param int $objectDecodeType * @return mixed + * @throws Zend_Json_Exception */ public function jsonDecode($encodedValue, $objectDecodeType = Zend_Json::TYPE_ARRAY) { @@ -710,7 +736,7 @@ public function jsonDecode($encodedValue, $objectDecodeType = Zend_Json::TYPE_AR /** * Generate a hash from unique ID - * @param $prefix + * @param string $prefix * @return string */ public function uniqHash($prefix = '') @@ -733,13 +759,17 @@ public function uniqHash($prefix = '') * @param array $srcFiles * @param string|false $targetFile - file path to be written * @param bool $mustMerge - * @param callback $beforeMergeCallback + * @param callable $beforeMergeCallback * @param array|string $extensionsFilter * @return bool|string */ - public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = false, - $beforeMergeCallback = null, $extensionsFilter = array()) - { + public function mergeFiles( + array $srcFiles, + $targetFile = false, + $mustMerge = false, + $beforeMergeCallback = null, + $extensionsFilter = array() + ) { try { // check whether merger is required $shouldMerge = $mustMerge || !$targetFile; @@ -769,7 +799,7 @@ public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = fa if (!is_array($extensionsFilter)) { $extensionsFilter = array($extensionsFilter); } - if (!empty($srcFiles)){ + if (!empty($srcFiles)) { foreach ($srcFiles as $key => $file) { $fileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION)); if (!in_array($fileExt, $extensionsFilter)) { @@ -932,7 +962,7 @@ public function getExactDivision($dividend, $divisor) * Security enchancement for CSV data processing by Excel-like applications. * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702 * - * @param $data + * @param array $data * @return array */ public function getEscapedCSVData(array $data) @@ -959,7 +989,6 @@ public function getEscapedCSVData(array $data) public function unEscapeCSVData($data) { if (is_array($data) && Mage::getStoreConfigFlag(Mage_ImportExport_Model_Export_Adapter_Csv::CONFIG_ESCAPING_FLAG)) { - foreach ($data as $key => $value) { $value = (string)$value; diff --git a/app/code/core/Mage/Core/Helper/File/Storage.php b/app/code/core/Mage/Core/Helper/File/Storage.php index 081ce35a4cc..f868d474487 100644 --- a/app/code/core/Mage/Core/Helper/File/Storage.php +++ b/app/code/core/Mage/Core/Helper/File/Storage.php @@ -92,7 +92,7 @@ public function isInternalStorage($storage = null) * * @param int|null $storage * @param array $params - * @return Mage_Core_Model_Abstract|bool + * @return Mage_Core_Model_File_Storage_File|Mage_Core_Model_File_Storage_Database */ public function getStorageModel($storage = null, $params = array()) { diff --git a/app/code/core/Mage/Core/Helper/File/Storage/Database.php b/app/code/core/Mage/Core/Helper/File/Storage/Database.php index 49f808e745b..b85a919ca05 100644 --- a/app/code/core/Mage/Core/Helper/File/Storage/Database.php +++ b/app/code/core/Mage/Core/Helper/File/Storage/Database.php @@ -41,7 +41,7 @@ class Mage_Core_Helper_File_Storage_Database extends Mage_Core_Helper_Abstract /** * Storage resource model - * @var null|Mage_Core_Model_Mysql4_File_Storage_Database + * @var Mage_Core_Model_Resource_File_Storage_Database */ protected $_resourceModel = null; @@ -103,7 +103,7 @@ public function getStorageFileModel() /** * Get storage model * - * @return Mage_Core_Model_Mysql4_File_Storage_Database + * @return Mage_Core_Model_Resource_File_Storage_Database */ public function getResourceStorageModel() { @@ -145,7 +145,8 @@ public function renameFile($oldName, $newName) * @param string $oldName * @param string $newName */ - public function copyFile($oldName, $newName) { + public function copyFile($oldName, $newName) + { if ($this->checkDbUsage()) { $this->getStorageDatabaseModel() ->copyFile($this->_removeAbsPathFromFileName($oldName), $this->_removeAbsPathFromFileName($newName)); @@ -177,8 +178,8 @@ public function fileExists($filename) public function getUniqueFilename($directory, $filename) { if ($this->checkDbUsage()) { - $directory = $this->_removeAbsPathFromFileName($directory); - if($this->fileExists($directory . $filename)) { + $directory = $this->_removeAbsPathFromFileName($directory); + if ($this->fileExists($directory . $filename)) { $index = 1; $extension = strrchr($filename, '.'); $filenameWoExtension = substr($filename, 0, -1 * strlen($extension)); @@ -195,12 +196,12 @@ public function getUniqueFilename($directory, $filename) * Save database file to file system * * @param string $filename - * @return bool|int + * @return bool */ public function saveFileToFilesystem($filename) { if ($this->checkDbUsage()) { - /** @var $file Mage_Core_Model_File_Storage_Database */ + /** @var Mage_Core_Model_File_Storage_Database $file */ $file = Mage::getModel('core/file_storage_database') ->loadByFilename($this->_removeAbsPathFromFileName($filename)); if (!$file->getId()) { diff --git a/app/code/core/Mage/Core/Helper/Http.php b/app/code/core/Mage/Core/Helper/Http.php index d133bcc3809..26e4cdb1626 100644 --- a/app/code/core/Mage/Core/Helper/Http.php +++ b/app/code/core/Mage/Core/Helper/Http.php @@ -45,11 +45,12 @@ class Mage_Core_Helper_Http extends Mage_Core_Helper_Abstract /** * Validate and retrieve user and password from HTTP * + * @param string|null $headers * @return array */ public function authValidate($headers = null) { - if(!is_null($headers)) { + if (!is_null($headers)) { $_SERVER = $headers; } @@ -58,7 +59,7 @@ public function authValidate($headers = null) // moshe's fix for CGI if (empty($_SERVER['HTTP_AUTHORIZATION'])) { - foreach ($_SERVER as $k=>$v) { + foreach ($_SERVER as $k => $v) { if (substr($k, -18)==='HTTP_AUTHORIZATION' && !empty($v)) { $_SERVER['HTTP_AUTHORIZATION'] = $v; break; @@ -69,14 +70,12 @@ public function authValidate($headers = null) if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { $user = $_SERVER['PHP_AUTH_USER']; $pass = $_SERVER['PHP_AUTH_PW']; - } - // IIS Note:: For HTTP Authentication to work with IIS, + } // IIS Note:: For HTTP Authentication to work with IIS, // the PHP directive cgi.rfc2616_headers must be set to 0 (the default value). elseif (!empty($_SERVER['HTTP_AUTHORIZATION'])) { $auth = $_SERVER['HTTP_AUTHORIZATION']; list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1))); - } - elseif (!empty($_SERVER['Authorization'])) { + } elseif (!empty($_SERVER['Authorization'])) { $auth = $_SERVER['Authorization']; list($user, $pass) = explode(':', base64_decode(substr($auth, strpos($auth, " ") + 1))); } @@ -95,8 +94,8 @@ public function authValidate($headers = null) public function authFailed() { Mage::app()->getResponse() - ->setHeader('HTTP/1.1','401 Unauthorized') - ->setHeader('WWW-Authenticate','Basic realm="RSS Feeds"') + ->setHeader('HTTP/1.1', '401 Unauthorized') + ->setHeader('WWW-Authenticate', 'Basic realm="RSS Feeds"') ->setBody('

401 Unauthorized

') ->sendResponse(); exit; diff --git a/app/code/core/Mage/Core/Helper/Js.php b/app/code/core/Mage/Core/Helper/Js.php index a0a4972baad..b9615922b30 100644 --- a/app/code/core/Mage/Core/Helper/Js.php +++ b/app/code/core/Mage/Core/Helper/Js.php @@ -147,8 +147,7 @@ protected function _getTranslateData() foreach ($messages as $message) { $messageText = (string)$message; $module = $message->getParent()->getAttribute("module"); - $this->_translateData[$messageText] = Mage::helper(empty($module) ? 'core' : $module - )->__($messageText); + $this->_translateData[$messageText] = Mage::helper(empty($module) ? 'core' : $module)->__($messageText); } } @@ -179,8 +178,11 @@ protected function _getXmlConfig() Mage::getConfig()->loadModulesConfiguration(self::JAVASCRIPT_TRANSLATE_CONFIG_FILENAME, $xmlConfig); if ($canUsaCache) { - Mage::app()->saveCache($xmlConfig->getXmlString(), self::JAVASCRIPT_TRANSLATE_CONFIG_KEY, - array(Mage_Core_Model_Config::CACHE_TAG)); + Mage::app()->saveCache( + $xmlConfig->getXmlString(), + self::JAVASCRIPT_TRANSLATE_CONFIG_KEY, + array(Mage_Core_Model_Config::CACHE_TAG) + ); } } $this->_config = $xmlConfig; diff --git a/app/code/core/Mage/Core/Helper/String.php b/app/code/core/Mage/Core/Helper/String.php index 99afb5ca5e2..41d8c96afd0 100644 --- a/app/code/core/Mage/Core/Helper/String.php +++ b/app/code/core/Mage/Core/Helper/String.php @@ -185,8 +185,7 @@ public function str_split($str, $length = 1, $keepWords = false, $trim = false, for ($offset = 0; $offset < $strlen; $offset += $length) { $result[] = $this->substr($str, $offset, $length); } - } - // split smartly, keeping words + } // split smartly, keeping words else { $split = preg_split('/(' . $wordSeparatorRegex . '+)/siu', $str, null, PREG_SPLIT_DELIM_CAPTURE); $i = 0; @@ -213,21 +212,18 @@ public function str_split($str, $length = 1, $keepWords = false, $trim = false, $result[$i] = ''; $space = ''; $spaceLen = 0; - } - else { + } else { $currentLength = $this->strlen($result[$i]); } $partLength = $this->strlen($part); // add part to current last element if (($currentLength + $spaceLen + $partLength) <= $length) { $result[$i] .= $space . $part; - } - // add part to new element + } // add part to new element elseif ($partLength <= $length) { $i++; $result[$i] = $part; - } - // break too long part recursively + } // break too long part recursively else { foreach ($this->str_split($part, $length, false, $trim, $wordSeparatorRegex) as $subpart) { $i++; @@ -265,8 +261,7 @@ public function splitWords($str, $uniqueOnly = false, $maxWordLength = 0, $wordS foreach ($split as $word) { if ($uniqueOnly) { $result[$word] = $word; - } - else { + } else { $result[] = $word; } } @@ -305,7 +300,7 @@ public function strpos($haystack, $needle, $offset = null) * Sorts array with multibyte string keys * * @param array $sort - * @return array + * @return array|false */ public function ksortMultibyte(array &$sort) { @@ -315,7 +310,7 @@ public function ksortMultibyte(array &$sort) $oldLocale = setlocale(LC_COLLATE, "0"); $localeCode = Mage::app()->getLocale()->getLocaleCode(); // use fallback locale if $localeCode is not available - setlocale(LC_COLLATE, $localeCode . '.UTF8', 'C.UTF-8', 'en_US.utf8'); + setlocale(LC_COLLATE, $localeCode . '.UTF8', 'C.UTF-8', 'en_US.utf8'); ksort($sort, SORT_LOCALE_STRING); setlocale(LC_COLLATE, $oldLocale); @@ -468,7 +463,7 @@ protected function _getLastSubkey($key, $withBrackets = true) /** * Set array helper * - * @param Mage_Core_Helper_Abstract $helper + * @param Mage_Core_Helper_Abstract|Mage_Core_Helper_Array $helper * @return $this */ public function setArrayHelper(Mage_Core_Helper_Abstract $helper) @@ -503,13 +498,13 @@ public function uniOrd($c) if ($h <= 0x7F) { $ord = $h; - } else if ($h < 0xC2) { + } elseif ($h < 0xC2) { $ord = 0; - } else if ($h <= 0xDF) { + } elseif ($h <= 0xDF) { $ord = (($h & 0x1F) << 6 | (ord($c[1]) & 0x3F)); - } else if ($h <= 0xEF) { + } elseif ($h <= 0xEF) { $ord = (($h & 0x0F) << 12 | (ord($c[1]) & 0x3F) << 6 | (ord($c[2]) & 0x3F)); - } else if ($h <= 0xF4) { + } elseif ($h <= 0xF4) { $ord = (($h & 0x0F) << 18 | (ord($c[1]) & 0x3F) << 12 | (ord($c[2]) & 0x3F) << 6 | (ord($c[3]) & 0x3F)); } @@ -519,7 +514,7 @@ public function uniOrd($c) /** * UnSerialize string - * @param $str + * @param string $str * @return mixed|null * @throws Exception */ diff --git a/app/code/core/Mage/Core/Helper/Url.php b/app/code/core/Mage/Core/Helper/Url.php index 070ec45818f..e74e9c2cc1d 100644 --- a/app/code/core/Mage/Core/Helper/Url.php +++ b/app/code/core/Mage/Core/Helper/Url.php @@ -107,13 +107,13 @@ protected function _prepareString($string) /** * Add request parameter into url * - * @param $url string - * @param $param array( 'key' => value ) + * @param string $url + * @param array $param ( 'key' => value ) * @return string */ public function addRequestParam($url, $param) { - $startDelimiter = (false === strpos($url,'?'))? '?' : '&'; + $startDelimiter = (false === strpos($url, '?'))? '?' : '&'; $arrQueryParams = array(); foreach ($param as $key => $value) { diff --git a/app/code/core/Mage/Core/Model/Abstract.php b/app/code/core/Mage/Core/Model/Abstract.php index 6ae463bfb44..e6171184efe 100644 --- a/app/code/core/Mage/Core/Model/Abstract.php +++ b/app/code/core/Mage/Core/Model/Abstract.php @@ -31,6 +31,14 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getCreatedAt() + * @method $this setCreatedAt(string $currentTime) + * @method $this setUpdatedAt(string $currentTime) + * @method $this setAttribute(Mage_Eav_Model_Entity_Attribute_Abstract $value) + * @method bool hasErrors() + * @method Mage_Customer_Model_Address_Abstract getBillingAddress() + * @method Mage_Customer_Model_Address_Abstract getShippingAddress() */ abstract class Mage_Core_Model_Abstract extends Varien_Object { @@ -76,7 +84,7 @@ abstract class Mage_Core_Model_Abstract extends Varien_Object * * When you use true - all cache will be clean * - * @var string || true + * @var string|true */ protected $_cacheTag = false; @@ -114,7 +122,7 @@ protected function _init($resourceModel) * @param string $resourceName * @param string|null $resourceCollectionName */ - protected function _setResourceModel($resourceName, $resourceCollectionName=null) + protected function _setResourceModel($resourceName, $resourceCollectionName = null) { $this->_resourceName = $resourceName; if (is_null($resourceCollectionName)) { @@ -126,7 +134,7 @@ protected function _setResourceModel($resourceName, $resourceCollectionName=null /** * Get resource instance * - * @return Mage_Core_Model_Mysql4_Abstract + * @return Mage_Core_Model_Resource_Db_Abstract|object|string */ protected function _getResource() { @@ -171,7 +179,7 @@ public function getId() * Declare model object identifier value * * @param mixed $id - * @return Mage_Core_Model_Abstract + * @return $this */ public function setId($id) { @@ -196,7 +204,8 @@ public function getResourceName() /** * Get collection instance * - * @return object + * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @throws Mage_Core_Exception */ public function getResourceCollection() { @@ -206,6 +215,9 @@ public function getResourceCollection() return Mage::getResourceModel($this->_resourceCollectionName, $this->_getResource()); } + /** + * @return Mage_Core_Model_Resource_Db_Collection_Abstract|object + */ public function getCollection() { return $this->getResourceCollection(); @@ -214,10 +226,11 @@ public function getCollection() /** * Load object data * - * @param integer $id - * @return Mage_Core_Model_Abstract + * @param string|integer $id + * @param string|null $field + * @return $this */ - public function load($id, $field=null) + public function load($id, $field = null) { $this->_beforeLoad($id, $field); $this->_getResource()->load($this, $id, $field); @@ -243,7 +256,9 @@ protected function _getEventData() /** * Processing object before load data * - * @return Mage_Core_Model_Abstract + * @param int $id + * @param string|null $field + * @return $this */ protected function _beforeLoad($id, $field = null) { @@ -257,7 +272,7 @@ protected function _beforeLoad($id, $field = null) /** * Processing object after load data * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _afterLoad() { @@ -266,12 +281,10 @@ protected function _afterLoad() return $this; } - - /** * Object after load processing. Implemented as public interface for supporting objects after load in collections * - * @return Mage_Core_Model_Abstract + * @return $this */ public function afterLoad() { @@ -295,7 +308,7 @@ protected function _hasModelChanged() /** * Save object data * - * @return Mage_Core_Model_Abstract + * @return $this */ public function save() { @@ -334,7 +347,7 @@ public function save() /** * Callback function which called after transaction commit in resource model * - * @return Mage_Core_Model_Abstract + * @return $this */ public function afterCommitCallback() { @@ -349,7 +362,7 @@ public function afterCommitCallback() * When method is called we don't have garantee what transaction was really commited * * @deprecated after 1.4.0.0 - please use afterCommitCallback instead - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _afterSaveCommit() { @@ -365,7 +378,7 @@ protected function _afterSaveCommit() * @param bool $flag * @return bool */ - public function isObjectNew($flag=null) + public function isObjectNew($flag = null) { if ($flag !== null) { $this->_isObjectNew = $flag; @@ -379,7 +392,7 @@ public function isObjectNew($flag=null) /** * Processing object before save data * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _beforeSave() { @@ -442,7 +455,7 @@ public function getCacheIdTags() /** * Remove model onject related cache * - * @return Mage_Core_Model_Abstract + * @return $this */ public function cleanModelCache() { @@ -456,7 +469,7 @@ public function cleanModelCache() /** * Processing object after save data * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _afterSave() { @@ -468,7 +481,7 @@ protected function _afterSave() /** * Delete object from database * - * @return Mage_Core_Model_Abstract + * @return $this */ public function delete() { @@ -479,8 +492,7 @@ public function delete() $this->_afterDelete(); $this->_getResource()->commit(); - } - catch (Exception $e){ + } catch (Exception $e) { $this->_getResource()->rollBack(); throw $e; } @@ -491,7 +503,7 @@ public function delete() /** * Processing object before delete data * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _beforeDelete() { @@ -519,7 +531,7 @@ protected function _protectFromNonAdmin() /** * Processing object after delete data * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _afterDelete() { @@ -531,7 +543,7 @@ protected function _afterDelete() /** * Processing manipulation after main transaction commit * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _afterDeleteCommit() { @@ -543,13 +555,16 @@ protected function _afterDeleteCommit() /** * Retrieve model resource * - * @return Mage_Core_Model_Mysql4_Abstract + * @return Mage_Core_Model_Resource_Db_Abstract */ public function getResource() { return $this->_getResource(); } + /** + * @return int + */ public function getEntityId() { return $this->_getData('entity_id'); @@ -558,7 +573,7 @@ public function getEntityId() /** * Clearing object for correct deleting by garbage collector * - * @return Mage_Core_Model_Abstract + * @return $this */ final public function clearInstance() { @@ -571,7 +586,7 @@ final public function clearInstance() /** * Clearing cyclic references * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _clearReferences() { @@ -581,11 +596,10 @@ protected function _clearReferences() /** * Clearing object's data * - * @return Mage_Core_Model_Abstract + * @return $this */ protected function _clearData() { return $this; } - } diff --git a/app/code/core/Mage/Core/Model/App.php b/app/code/core/Mage/Core/Model/App.php index 8c05da21431..e721f229fce 100644 --- a/app/code/core/Mage/Core/Model/App.php +++ b/app/code/core/Mage/Core/Model/App.php @@ -168,21 +168,21 @@ class Mage_Core_Model_App /** * Websites cache * - * @var array + * @var Mage_Core_Model_Website[] */ protected $_websites = array(); /** * Groups cache * - * @var array + * @var Mage_Core_Model_Store_Group[] */ protected $_groups = array(); /** * Stores cache * - * @var array + * @var Mage_Core_Model_Store[] */ protected $_stores = array(); @@ -208,7 +208,7 @@ class Mage_Core_Model_App /** * Request object * - * @var Zend_Controller_Request_Http + * @var Mage_Core_Controller_Request_Http */ protected $_request; @@ -485,7 +485,7 @@ protected function _initRequest() * * @param string $scopeCode code of default scope (website/store_group/store code) * @param string $scopeType type of default scope (website/group/store) - * @return Mage_Core_Model_App + * @return $this */ protected function _initCurrentStore($scopeCode, $scopeType) { @@ -516,7 +516,8 @@ protected function _initCurrentStore($scopeCode, $scopeType) $this->_checkGetStore($scopeType); } $this->_useSessionInUrl = $this->getStore()->getConfig( - Mage_Core_Model_Session_Abstract::XML_PATH_USE_FRONTEND_SID); + Mage_Core_Model_Session_Abstract::XML_PATH_USE_FRONTEND_SID + ); return $this; } @@ -566,11 +567,9 @@ protected function _checkGetStore($type) $curStoreObj = $this->_stores[$this->_currentStore]; if ($type == 'website' && $storeObj->getWebsiteId() == $curStoreObj->getWebsiteId()) { $this->_currentStore = $store; - } - elseif ($type == 'group' && $storeObj->getGroupId() == $curStoreObj->getGroupId()) { + } elseif ($type == 'group' && $storeObj->getGroupId() == $curStoreObj->getGroupId()) { $this->_currentStore = $store; - } - elseif ($type == 'store') { + } elseif ($type == 'store') { $this->_currentStore = $store; } @@ -632,17 +631,17 @@ protected function _initStores() $this->_website = null; $this->_websites = array(); - /** @var $websiteCollection Mage_Core_Model_Website */ + /** @var Mage_Core_Model_Resource_Website_Collection $websiteCollection */ $websiteCollection = Mage::getModel('core/website')->getCollection() ->initCache($this->getCache(), 'app', array(Mage_Core_Model_Website::CACHE_TAG)) ->setLoadDefault(true); - /** @var $websiteCollection Mage_Core_Model_Store_Group */ + /** @var Mage_Core_Model_Resource_Store_Group_Collection $groupCollection */ $groupCollection = Mage::getModel('core/store_group')->getCollection() ->initCache($this->getCache(), 'app', array(Mage_Core_Model_Store_Group::CACHE_TAG)) ->setLoadDefault(true); - /** @var $websiteCollection Mage_Core_Model_Store */ + /** @var Mage_Core_Model_Resource_Store_Collection $storeCollection */ $storeCollection = Mage::getModel('core/store')->getCollection() ->initCache($this->getCache(), 'app', array(Mage_Core_Model_Store::CACHE_TAG)) ->setLoadDefault(true); @@ -657,7 +656,7 @@ protected function _initStores() $groupStores = array(); foreach ($storeCollection as $store) { - /** @var $store Mage_Core_Model_Store */ + /** @var Mage_Core_Model_Store $store */ $store->initConfigCache(); $store->setWebsite($websiteCollection->getItemById($store->getWebsiteId())); $store->setGroup($groupCollection->getItemById($store->getGroupId())); @@ -674,7 +673,7 @@ protected function _initStores() } foreach ($groupCollection as $group) { - /* @var $group Mage_Core_Model_Store_Group */ + /* @var Mage_Core_Model_Store_Group $group */ if (!isset($groupStores[$group->getId()])) { $groupStores[$group->getId()] = array(); } @@ -687,7 +686,7 @@ protected function _initStores() } foreach ($websiteCollection as $website) { - /* @var $website Mage_Core_Model_Website */ + /* @var Mage_Core_Model_Website $website */ if (!isset($websiteGroups[$website->getId()])) { $websiteGroups[$website->getId()] = array(); } @@ -787,7 +786,7 @@ protected function _initFrontController() * Redeclare custom error handler * * @param string $handler - * @return Mage_Core_Model_App + * @return $this */ public function setErrorHandler($handler) { @@ -799,7 +798,7 @@ public function setErrorHandler($handler) * Loading application area * * @param string $code - * @return Mage_Core_Model_App + * @return $this */ public function loadArea($code) { @@ -812,7 +811,7 @@ public function loadArea($code) * * @param string $area * @param string $part - * @return Mage_Core_Model_App + * @return $this */ public function loadAreaPart($area, $part) { @@ -867,7 +866,7 @@ public function getStore($id = null) if (empty($this->_stores[$id])) { $store = Mage::getModel('core/store'); - /* @var $store Mage_Core_Model_Store */ + /* @var Mage_Core_Model_Store $store */ if (is_numeric($id)) { $store->load($id); } elseif (is_string($id)) { @@ -887,19 +886,17 @@ public function getStore($id = null) * Retrieve application store object without Store_Exception * * @param string|int|Mage_Core_Model_Store $id - * @return Mage_Core_Model_Store + * @return Mage_Core_Model_Store|Varien_Object */ public function getSafeStore($id = null) { try { return $this->getStore($id); - } - catch (Exception $e) { + } catch (Exception $e) { if ($this->_currentStore) { $this->getRequest()->setActionName('noRoute'); return new Varien_Object(); - } - else { + } else { Mage::throwException(Mage::helper('core')->__('Requested invalid store "%s"', $id)); } } @@ -910,7 +907,7 @@ public function getSafeStore($id = null) * * @param bool $withDefault * @param bool $codeKey - * @return array + * @return Mage_Core_Model_Store[] */ public function getStores($withDefault = false, $codeKey = false) { @@ -921,8 +918,7 @@ public function getStores($withDefault = false, $codeKey = false) } if ($codeKey) { $stores[$store->getCode()] = $store; - } - else { + } else { $stores[$store->getId()] = $store; } } @@ -930,6 +926,9 @@ public function getStores($withDefault = false, $codeKey = false) return $stores; } + /** + * @return Mage_Core_Model_Store + */ protected function _getDefaultStore() { if (empty($this->_store)) { @@ -958,6 +957,9 @@ public function getDefaultStoreView() return null; } + /** + * @return string + */ public function getDistroLocaleCode() { return self::DISTRO_LOCALE_CODE; @@ -969,7 +971,7 @@ public function getDistroLocaleCode() * @param null|Mage_Core_Model_Website|true|int|string $id * @return Mage_Core_Model_Website */ - public function getWebsite($id=null) + public function getWebsite($id = null) { if (is_null($id)) { $id = $this->getStore()->getWebsiteId(); @@ -999,6 +1001,11 @@ public function getWebsite($id=null) return $this->_websites[$id]; } + /** + * @param bool $withDefault + * @param bool $codeKey + * @return Mage_Core_Model_Website[] + */ public function getWebsites($withDefault = false, $codeKey = false) { $websites = array(); @@ -1009,8 +1016,7 @@ public function getWebsites($withDefault = false, $codeKey = false) } if ($codeKey) { $websites[$website->getCode()] = $website; - } - else { + } else { $websites[$website->getId()] = $website; } } @@ -1025,7 +1031,7 @@ public function getWebsites($withDefault = false, $codeKey = false) * @param null|Mage_Core_Model_Store_Group|int|string $id * @return Mage_Core_Model_Store_Group */ - public function getGroup($id=null) + public function getGroup($id = null) { if (is_null($id)) { $id = $this->getStore()->getGroup()->getId(); @@ -1179,9 +1185,9 @@ public function loadCache($id) * @param string $id * @param array $tags * @param null|false|int $lifeTime - * @return Mage_Core_Model_App + * @return $this */ - public function saveCache($data, $id, $tags=array(), $lifeTime=false) + public function saveCache($data, $id, $tags = array(), $lifeTime = false) { $this->_cache->save($data, $id, $tags, $lifeTime); return $this; @@ -1202,7 +1208,7 @@ public function testCache($id) * Remove cache * * @param string $id - * @return Mage_Core_Model_App + * @return $this */ public function removeCache($id) { @@ -1214,9 +1220,9 @@ public function removeCache($id) * Cleaning cache * * @param array $tags - * @return Mage_Core_Model_App + * @return $this */ - public function cleanCache($tags=array()) + public function cleanCache($tags = array()) { $this->_cache->clean($tags); Mage::dispatchEvent('application_clean_cache', array('tags' => $tags)); @@ -1227,9 +1233,9 @@ public function cleanCache($tags=array()) * Check whether to use cache for specific component * * @param null|string $type - * @return bool|array + * @return false|array */ - public function useCache($type=null) + public function useCache($type = null) { return $this->_cache->canUse($type); } @@ -1287,7 +1293,7 @@ public function setRequest(Mage_Core_Controller_Request_Http $request) /** * Retrieve response object * - * @return Zend_Controller_Response_Http + * @return Mage_Core_Controller_Response_Http */ public function getResponse() { @@ -1311,6 +1317,10 @@ public function setResponse(Mage_Core_Controller_Response_Http $response) return $this; } + /** + * @param string $area + * @return $this + */ public function addEventArea($area) { if (!isset($this->_events[$area])) { @@ -1319,10 +1329,16 @@ public function addEventArea($area) return $this; } + /** + * @param string $eventName + * @param array $args + * @return $this + * @throws Mage_Core_Exception + */ public function dispatchEvent($eventName, $args) { $eventName = strtolower($eventName); - foreach ($this->_events as $area=>$events) { + foreach ($this->_events as $area => $events) { if (!isset($events[$eventName])) { $eventConfig = $this->getConfig()->getEventConfig($area, $eventName); if (!$eventConfig) { @@ -1330,7 +1346,11 @@ public function dispatchEvent($eventName, $args) continue; } $observers = array(); - foreach ($eventConfig->observers->children() as $obsName=>$obsConfig) { + /** + * @var string $obsName + * @var Mage_Core_Model_Config_Element $obsConfig + */ + foreach ($eventConfig->observers->children() as $obsName => $obsConfig) { $observers[$obsName] = array( 'type' => (string)$obsConfig->type, 'model' => $obsConfig->class ? (string)$obsConfig->class : $obsConfig->getClassName(), @@ -1349,7 +1369,7 @@ public function dispatchEvent($eventName, $args) $observer = new Varien_Event_Observer(); } - foreach ($events[$eventName]['observers'] as $obsName=>$obs) { + foreach ($events[$eventName]['observers'] as $obsName => $obs) { $observer->setData(array('event'=>$event)); Varien_Profiler::start('OBSERVER: '.$obsName); switch ($obs['type']) { @@ -1394,11 +1414,17 @@ protected function _callObserverMethod($object, $method, $observer) return $this; } + /** + * @param bool $value + */ public function setUpdateMode($value) { $this->_updateMode = $value; } + /** + * @return bool + */ public function getUpdateMode() { return $this->_updateMode; @@ -1488,7 +1514,7 @@ public function setIsSingleStoreModeAllowed($value) * * @param bool $withDefault * @param bool $codeKey - * @return array + * @return Mage_Core_Model_Store_Group[] */ public function getGroups($withDefault = false, $codeKey = false) { @@ -1500,8 +1526,7 @@ public function getGroups($withDefault = false, $codeKey = false) } if ($codeKey) { $groups[$group->getCode()] = $group; - } - else { + } else { $groups[$group->getId()] = $group; } } @@ -1524,14 +1549,13 @@ public function isInstalled() /** * Generate cache tags from cache id * + * @param array $tags + * @return array * @deprecated after 1.4.0.0-alpha3, functionality implemented in Mage_Core_Model_Cache - * @param string $id - * @param array $tags - * @return array */ - protected function _getCacheTags($tags=array()) + protected function _getCacheTags($tags = array()) { - foreach ($tags as $index=>$value) { + foreach ($tags as $index => $value) { $tags[$index] = $this->_getCacheId($value); } return $tags; @@ -1555,7 +1579,7 @@ public function getUseCacheFilename() * @param string $id * @return string */ - protected function _getCacheId($id=null) + protected function _getCacheId($id = null) { if ($id) { $id = $this->prepareCacheId($id); @@ -1591,7 +1615,6 @@ public function getIsCacheLocked() * Unset website by id from app cache * * @param null|bool|int|string|Mage_Core_Model_Website $id - * @return void */ public function clearWebsiteCache($id = null) { diff --git a/app/code/core/Mage/Core/Model/App/Area.php b/app/code/core/Mage/Core/Model/App/Area.php index 385ee422af0..06f08671b4e 100644 --- a/app/code/core/Mage/Core/Model/App/Area.php +++ b/app/code/core/Mage/Core/Model/App/Area.php @@ -62,6 +62,11 @@ class Mage_Core_Model_App_Area */ protected $_application; + /** + * Mage_Core_Model_App_Area constructor. + * @param string $areaCode + * @param Mage_Core_Model_App $application + */ public function __construct($areaCode, $application) { $this->_code = $areaCode; @@ -84,15 +89,14 @@ public function getApplication() * @param string|null $part * @return Mage_Core_Model_App_Area */ - public function load($part=null) + public function load($part = null) { if (is_null($part)) { $this->_loadPart(self::PART_CONFIG) ->_loadPart(self::PART_EVENTS) ->_loadPart(self::PART_DESIGN) ->_loadPart(self::PART_TRANSLATE); - } - else { + } else { $this->_loadPart($part); } return $this; @@ -131,9 +135,11 @@ protected function _loadPart($part) protected function _initConfig() { - } + /** + * @return $this + */ protected function _initEvents() { Mage::app()->addEventArea($this->_code); @@ -141,20 +147,29 @@ protected function _initEvents() return $this; } + /** + * @return $this + */ protected function _initTranslate() { Mage::app()->getTranslator()->init($this->_code); return $this; } + /** + * @return $this|void + * @throws Mage_Core_Exception + * @throws Mage_Core_Model_Store_Exception + */ protected function _initDesign() { if (Mage::app()->getRequest()->isStraight()) { return $this; } $designPackage = Mage::getSingleton('core/design_package'); - if ($designPackage->getArea() != self::AREA_FRONTEND) + if ($designPackage->getArea() != self::AREA_FRONTEND) { return; + } $currentStore = Mage::app()->getStore()->getStoreId(); diff --git a/app/code/core/Mage/Core/Model/App/Emulation.php b/app/code/core/Mage/Core/Model/App/Emulation.php index 971811ef495..295e99262b4 100644 --- a/app/code/core/Mage/Core/Model/App/Emulation.php +++ b/app/code/core/Mage/Core/Model/App/Emulation.php @@ -71,9 +71,11 @@ public function __construct(array $args = array()) * * @return Varien_Object information about environment of the initial store */ - public function startEnvironmentEmulation($storeId, $area = Mage_Core_Model_App_Area::AREA_FRONTEND, - $emulateStoreInlineTranslation = false) - { + public function startEnvironmentEmulation( + $storeId, + $area = Mage_Core_Model_App_Area::AREA_FRONTEND, + $emulateStoreInlineTranslation = false + ) { if (is_null($area)) { $area = Mage_Core_Model_App_Area::AREA_FRONTEND; } @@ -232,9 +234,10 @@ protected function _restoreInitialDesign(array $initialDesign) * * @return $this */ - protected function _restoreInitialLocale($initialLocaleCode, - $initialArea = Mage_Core_Model_App_Area::AREA_ADMINHTML) - { + protected function _restoreInitialLocale( + $initialLocaleCode, + $initialArea = Mage_Core_Model_App_Area::AREA_ADMINHTML + ) { $currentLocaleCode = $this->_app->getLocale()->getLocaleCode(); if ($currentLocaleCode != $initialLocaleCode) { $this->_app->getLocale()->setLocaleCode($initialLocaleCode); diff --git a/app/code/core/Mage/Core/Model/Cache.php b/app/code/core/Mage/Core/Model/Cache.php index cdb18fd398e..6a28a759186 100644 --- a/app/code/core/Mage/Core/Model/Cache.php +++ b/app/code/core/Mage/Core/Model/Cache.php @@ -132,8 +132,14 @@ public function __construct(array $options = array()) $backend = $this->_getBackendOptions($options); $frontend = $this->_getFrontendOptions($options); - $this->_frontend = Zend_Cache::factory('Varien_Cache_Core', $backend['type'], $frontend, $backend['options'], - true, true, true + $this->_frontend = Zend_Cache::factory( + 'Varien_Cache_Core', + $backend['type'], + $frontend, + $backend['options'], + true, + true, + true ); if (isset($options['request_processors'])) { @@ -431,7 +437,7 @@ public function remove($id) * @param array $tags * @return bool */ - public function clean($tags=array()) + public function clean($tags = array()) { $mode = Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG; if (!empty($tags)) { @@ -470,7 +476,7 @@ public function getDbAdapter() /** * Get cache resource model * - * @return Mage_Core_Model_Mysql4_Cache + * @return Mage_Core_Model_Resource_Cache */ protected function _getResource() { @@ -583,7 +589,7 @@ public function getTypes() $types = array(); $config = Mage::getConfig()->getNode(self::XML_PATH_TYPES); if ($config) { - foreach ($config->children() as $type=>$node) { + foreach ($config->children() as $type => $node) { $types[$type] = new Varien_Object(array( 'id' => $type, 'cache_type' => Mage::helper('core')->__((string)$node->label), @@ -708,6 +714,8 @@ public function processRequest() /** * Get request processor object + * @param string $processor + * @return object */ protected function _getProcessor($processor) { diff --git a/app/code/core/Mage/Core/Model/Config.php b/app/code/core/Mage/Core/Model/Config.php index 45e2f32a94e..6d19db78c5c 100644 --- a/app/code/core/Mage/Core/Model/Config.php +++ b/app/code/core/Mage/Core/Model/Config.php @@ -36,6 +36,13 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base { const CACHE_TAG = 'CONFIG'; + /** + * Configuration xml + * + * @var Mage_Core_Model_Config_Element + */ + protected $_xml = null; + /** * Flag which allow use cache logic * @@ -85,7 +92,7 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base /** * Storage for generated block class names * - * @var unknown_type + * @var array */ protected $_blockClassNameCache = array(); @@ -194,7 +201,7 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base * * @param mixed $sourceData */ - public function __construct($sourceData=null) + public function __construct($sourceData = null) { $this->setCacheId('config_global'); $this->_options = new Mage_Core_Model_Config_Options($sourceData); @@ -243,9 +250,10 @@ public function setOptions($options) /** * Initialization of core configuration * + * @param array $options * @return $this */ - public function init($options=array()) + public function init($options = array()) { $this->setCacheChecksum(null); $this->_cacheLoadedSections = array(); @@ -418,20 +426,22 @@ protected function _canUseCacheForInit() $retries = 10; do { if ($this->_loadCache($this->_getCacheLockId())) { - if ($retries) usleep(500000); // 0.5 seconds + if ($retries) { + usleep(500000); // 0.5 seconds + } } else { - return TRUE; + return true; } } while ($retries--); } - return FALSE; + return false; } /** * Retrieve cache object * - * @return Zend_Cache_Frontend_File + * @return Zend_Cache_Core */ public function getCache() { @@ -454,7 +464,7 @@ protected function _getCacheLockId() * @param array $tags cache tags * @return Mage_Core_Model_Config */ - public function saveCache($tags=array()) + public function saveCache($tags = array()) { if (!Mage::app()->useCache('config')) { return $this; @@ -494,20 +504,25 @@ public function saveCache($tags=array()) /** * Save cache of specified * - * @param string $idPrefix cache id prefix - * @param string $sectionName - * @param Varien_Simplexml_Element $source - * @param int $recursionLevel - * @return Mage_Core_Model_Config + * @param string $idPrefix cache id prefix + * @param string $sectionName + * @param Varien_Simplexml_Element $source + * @param int $recursionLevel + * @param array $tags + * @return Mage_Core_Model_Config */ - protected function _saveSectionCache($idPrefix, $sectionName, $source, $recursionLevel=0, $tags=array()) + protected function _saveSectionCache($idPrefix, $sectionName, $source, $recursionLevel = 0, $tags = array()) { if ($source && $source->$sectionName) { $cacheId = $idPrefix . '_' . $sectionName; if ($recursionLevel > 0) { foreach ($source->$sectionName->children() as $subSectionName => $node) { $this->_saveSectionCache( - $cacheId, $subSectionName, $source->$sectionName, $recursionLevel-1, $tags + $cacheId, + $subSectionName, + $source->$sectionName, + $recursionLevel-1, + $tags ); } } @@ -519,8 +534,8 @@ protected function _saveSectionCache($idPrefix, $sectionName, $source, $recursio /** * Load config section cached data * - * @param string $sectionName - * @return Varien_Simplexml_Element + * @param string $sectionName + * @return false|SimpleXMLElement */ protected function _loadSectionCache($sectionName) { @@ -560,7 +575,7 @@ protected function _loadCache($id) * @param false|int $lifetime * @return Mage_Core_Model_App */ - protected function _saveCache($data, $id, $tags=array(), $lifetime=false) + protected function _saveCache($data, $id, $tags = array(), $lifetime = false) { return Mage::app()->saveCache($data, $id, $tags, $lifetime); } @@ -579,7 +594,7 @@ protected function _removeCache($id) /** * Remove configuration cache * - * @return $this + * {@inheritDoc} */ public function removeCache() { @@ -601,7 +616,7 @@ public function cleanCache() * Getter for section configuration object * * @param array $path - * @return Mage_Core_Model_Config_Element + * @return false|Mage_Core_Model_Config_Element */ protected function _getSectionConfig($path) { @@ -627,8 +642,8 @@ protected function _getSectionConfig($path) /** * Get node value from cached section data * - * @param array $path - * @return Mage_Core_Model_Config + * @param array $path + * @return false|Varien_Simplexml_Element */ public function getSectionNode($path) { @@ -644,12 +659,10 @@ public function getSectionNode($path) /** * Returns node found by the $path and scope info * - * @param string $path - * @param string $scope - * @param string|int $scopeCode - * @return Mage_Core_Model_Config_Element + * @inheritDoc + * @return Mage_Core_Model_Config_Element|Varien_Simplexml_Element|false */ - public function getNode($path=null, $scope='', $scopeCode=null) + public function getNode($path = null, $scope = '', $scopeCode = null) { if ($scope !== '') { if (('store' === $scope) || ('website' === $scope)) { @@ -680,7 +693,7 @@ public function getNode($path=null, $scope='', $scopeCode=null) } } } - return parent::getNode($path); + return parent::getNode($path); } /** @@ -709,7 +722,7 @@ public function setNode($path, $value, $overwrite = true) /** * Retrive Declared Module file list * - * @return array + * @return array|false */ protected function _getDeclaredModuleFiles() { @@ -732,7 +745,7 @@ protected function _getDeclaredModuleFiles() if ($name == 'Mage_All') { $collectModuleFiles['base'][] = $v; - } else if (substr($name, 0, 5) == 'Mage_') { + } elseif (substr($name, 0, 5) == 'Mage_') { $collectModuleFiles['mage'][] = $v; } else { $collectModuleFiles['custom'][] = $v; @@ -749,7 +762,7 @@ protected function _getDeclaredModuleFiles() /** * Add module(s) to allowed list * - * @param strung|array $module + * @param string|array $module * @return $this */ public function addAllowedModules($module) @@ -784,7 +797,7 @@ protected function _isAllowedModule($moduleName) * Load declared modules configuration * * @param null $mergeConfig depricated - * @return Mage_Core_Model_Config + * @return $this|void */ protected function _loadDeclaredModules($mergeConfig = null) { @@ -930,7 +943,7 @@ public function determineOmittedNamespace($name, $asFullModuleName = false) } } // assume namespace is qualified - if(isset($name[1])) { + if (isset($name[1])) { $fullNS = $name[0] . '_' . $name[1]; if (2 <= $partsNum && isset($namespace[$fullNS])) { return $asFullModuleName ? $namespace[$fullNS] : $fullNS; @@ -944,11 +957,12 @@ public function determineOmittedNamespace($name, $asFullModuleName = false) * Iterate all active modules "etc" folders and combine data from * specidied xml file name to one object * - * @param string $fileName - * @param null|Mage_Core_Model_Config_Base $mergeToObject - * @return Mage_Core_Model_Config_Base + * @param string $fileName + * @param null|Mage_Core_Model_Config_Base $mergeToObject + * @param null $mergeModel + * @return Mage_Core_Model_Config_Base */ - public function loadModulesConfiguration($fileName, $mergeToObject = null, $mergeModel=null) + public function loadModulesConfiguration($fileName, $mergeToObject = null, $mergeModel = null) { $disableLocalModules = !$this->_canUseLocalModules(); @@ -960,7 +974,7 @@ public function loadModulesConfiguration($fileName, $mergeToObject = null, $merg $mergeModel = clone $this->_prototype; } $modules = $this->getNode('modules')->children(); - foreach ($modules as $modName=>$module) { + foreach ($modules as $modName => $module) { if ($module->is('active')) { if ($disableLocalModules && ('local' === (string)$module->codePool)) { continue; @@ -972,7 +986,6 @@ public function loadModulesConfiguration($fileName, $mergeToObject = null, $merg foreach ($fileName as $configFile) { $configFile = $this->getModuleDir('etc', $modName).DS.$configFile; if ($mergeModel->loadFile($configFile)) { - $this->_makeEventsLowerCase(Mage_Core_Model_App_Area::AREA_GLOBAL, $mergeModel); $this->_makeEventsLowerCase(Mage_Core_Model_App_Area::AREA_FRONTEND, $mergeModel); $this->_makeEventsLowerCase(Mage_Core_Model_App_Area::AREA_ADMIN, $mergeModel); @@ -1004,7 +1017,6 @@ public function getTempVarDir() public function getDistroServerVars() { if (!$this->_distroServerVars) { - if (isset($_SERVER['SCRIPT_NAME']) && isset($_SERVER['HTTP_HOST'])) { $secure = (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off')) || $_SERVER['SERVER_PORT']=='443'; $scheme = ($secure ? 'https' : 'http') . '://' ; @@ -1012,7 +1024,8 @@ public function getDistroServerVars() $hostArr = explode(':', $_SERVER['HTTP_HOST']); $host = $hostArr[0]; $port = isset( - $hostArr[1]) && (!$secure && $hostArr[1]!=80 || $secure && $hostArr[1]!=443 + $hostArr[1] + ) && (!$secure && $hostArr[1]!=80 || $secure && $hostArr[1]!=443 ) ? ':'.$hostArr[1] : ''; $path = Mage::app()->getRequest()->getBasePath(); @@ -1029,13 +1042,17 @@ public function getDistroServerVars() 'base_url' => $baseUrl, ); - foreach ($this->_distroServerVars as $k=>$v) { + foreach ($this->_distroServerVars as $k => $v) { $this->_substServerVars['{{'.$k.'}}'] = $v; } } return $this->_distroServerVars; } + /** + * @param $data + * @return mixed + */ public function substDistroServerVars($data) { $this->getDistroServerVars(); @@ -1050,9 +1067,9 @@ public function substDistroServerVars($data) * Get module config node * * @param string $moduleName - * @return Varien_Simplexml_Object + * @return Mage_Core_Model_Config_Element|SimpleXMLElement */ - public function getModuleConfig($moduleName='') + public function getModuleConfig($moduleName = '') { $modules = $this->getNode('modules'); if (''===$moduleName) { @@ -1067,10 +1084,10 @@ public function getModuleConfig($moduleName='') * * Defaults to Mage_Core_Setup * - * @param string|Varien_Simplexml_Object $module + * @param string|Mage_Core_Model_Config_Element $module * @return object */ - public function getModuleSetup($module='') + public function getModuleSetup($module = '') { $className = 'Mage_Core_Setup'; if (''!==$module) { @@ -1097,7 +1114,7 @@ public function getModuleSetup($module='') * @param string $type * @return string */ - public function getBaseDir($type='base') + public function getBaseDir($type = 'base') { return $this->getOptions()->getDir($type); } @@ -1109,7 +1126,7 @@ public function getBaseDir($type='base') * @param string $type * @return string */ - public function getVarDir($path=null, $type='var') + public function getVarDir($path = null, $type = 'var') { $dir = Mage::getBaseDir($type).($path!==null ? DS.$path : ''); if (!$this->createDirIfNotExists($dir)) { @@ -1118,6 +1135,10 @@ public function getVarDir($path=null, $type='var') return $dir; } + /** + * @param string $dir + * @return bool + */ public function createDirIfNotExists($dir) { return $this->getOptions()->createDirIfNotExists($dir); @@ -1214,7 +1235,7 @@ public function loadEventObservers($area) * @param array|string $args Module name if string * @return array */ - public function getPathVars($args=null) + public function getPathVars($args = null) { $path = array(); @@ -1232,7 +1253,7 @@ public function getPathVars($args=null) * @param string $groupRootNode optional config path for group config * @return string */ - public function getGroupedClassName($groupType, $classId, $groupRootNode=null) + public function getGroupedClassName($groupType, $classId, $groupRootNode = null) { if (empty($groupRootNode)) { $groupRootNode = 'global/'.$groupType.'s'; @@ -1302,7 +1323,7 @@ public function getBlockClassName($blockType) /** * Retrieve helper class name * - * @param string $name + * @param string $helperName * @return string */ public function getHelperClassName($helperName) @@ -1362,7 +1383,7 @@ public function getModelClassName($modelClass) * @param array|object $constructArguments * @return Mage_Core_Model_Abstract|false */ - public function getModelInstance($modelClass='', $constructArguments=array()) + public function getModelInstance($modelClass = '', $constructArguments = array()) { $className = $this->getModelClassName($modelClass); if (class_exists($className)) { @@ -1375,6 +1396,10 @@ public function getModelInstance($modelClass='', $constructArguments=array()) } } + /** + * @param string $path + * @return bool + */ public function getNodeClassInstance($path) { $config = Mage::getConfig()->getNode($path); @@ -1391,9 +1416,9 @@ public function getNodeClassInstance($path) * * @param string $modelClass * @param array $constructArguments - * @return object + * @return Mage_Core_Model_Resource_Db_Collection_Abstract|false */ - public function getResourceModelInstance($modelClass='', $constructArguments=array()) + public function getResourceModelInstance($modelClass = '', $constructArguments = array()) { $factoryName = $this->_getResourceModelFactoryClassName($modelClass); if (!$factoryName) { @@ -1406,7 +1431,7 @@ public function getResourceModelInstance($modelClass='', $constructArguments=arr * Get resource configuration for resource name * * @param string $name - * @return Varien_Simplexml_Element + * @return Mage_Core_Model_Config_Element|SimpleXMLElement */ public function getResourceConfig($name) { @@ -1416,13 +1441,14 @@ public function getResourceConfig($name) /** * Get connection configuration * - * @param string $name - * @return Varien_Simplexml_Element|false + * @param string $name + * @return false|Mage_Core_Model_Config_Element */ public function getResourceConnectionConfig($name) { $config = $this->getResourceConfig($name); if ($config) { + /** @var Mage_Core_Model_Config_Element $conn */ $conn = $config->connection; if ($conn) { if (!empty($conn->use)) { @@ -1439,7 +1465,7 @@ public function getResourceConnectionConfig($name) * Retrieve resource type configuration for resource name * * @param string $type - * @return Varien_Simplexml_Element + * @return SimpleXMLElement|Varien_Simplexml_Element|Mage_Core_Model_Config_Element */ public function getResourceTypeConfig($type) { @@ -1453,14 +1479,19 @@ public function getResourceTypeConfig($type) * * return array($storeId=>$pathValue) * - * @param string $path - * @param array $allowValues - * @return array + * @param string $path + * @param array $allowValues + * @param string $useAsKey + * @return array */ public function getStoresConfigByPath($path, $allowValues = array(), $useAsKey = 'id') { $storeValues = array(); $stores = $this->getNode('stores'); + /** + * @var string $code + * @var Varien_Simplexml_Element $store + */ foreach ($stores->children() as $code => $store) { switch ($useAsKey) { case 'id': @@ -1482,7 +1513,7 @@ public function getStoresConfigByPath($path, $allowValues = array(), $useAsKey = if (empty($allowValues)) { $storeValues[$key] = $pathValue; - } else if (in_array($pathValue, $allowValues)) { + } elseif (in_array($pathValue, $allowValues)) { $storeValues[$key] = $pathValue; } } @@ -1585,7 +1616,7 @@ public function deleteConfig($path, $scope = 'default', $scopeId = 0) * * @param string $name fieldset name * @param string $root fieldset area, could be 'admin' - * @return null|array + * @return null|Mage_Core_Model_Config_Element[]|SimpleXMLElement */ public function getFieldset($name, $root = 'global') { diff --git a/app/code/core/Mage/Core/Model/Config/Base.php b/app/code/core/Mage/Core/Model/Config/Base.php index 0bfc8f58168..36543c65bce 100644 --- a/app/code/core/Mage/Core/Model/Config/Base.php +++ b/app/code/core/Mage/Core/Model/Config/Base.php @@ -38,10 +38,9 @@ class Mage_Core_Model_Config_Base extends Varien_Simplexml_Config { /** - * Constructor - * + * @param string|null $sourceData */ - public function __construct($sourceData=null) + public function __construct($sourceData = null) { $this->_elementClass = 'Mage_Core_Model_Config_Element'; parent::__construct($sourceData); diff --git a/app/code/core/Mage/Core/Model/Config/Data.php b/app/code/core/Mage/Core/Model/Config/Data.php index b2523de9478..a0c26f334eb 100644 --- a/app/code/core/Mage/Core/Model/Config/Data.php +++ b/app/code/core/Mage/Core/Model/Config/Data.php @@ -31,13 +31,15 @@ * @method Mage_Core_Model_Resource_Config_Data _getResource() * @method Mage_Core_Model_Resource_Config_Data getResource() * @method string getScope() - * @method Mage_Core_Model_Config_Data setScope(string $value) + * @method $this setScope(string $value) * @method int getScopeId() - * @method Mage_Core_Model_Config_Data setScopeId(int $value) + * @method $this setScopeId(int $value) * @method string getPath() - * @method Mage_Core_Model_Config_Data setPath(string $value) + * @method $this setPath(string $value) * @method string getValue() - * @method Mage_Core_Model_Config_Data setValue(string $value) + * @method $this setValue(string $value) + * @method string getStoreCode() + * @method string getWebsiteCode() * * @category Mage * @package Mage_Core @@ -107,11 +109,12 @@ public function getOldValue() } return (string) Mage::getConfig()->getNode('default/' . $path); } - - /** + + /** * Get value by key for new user data from
/groups//fields/ - * + * + * @param string $key * @return string */ public function getFieldsetDataValue($key) diff --git a/app/code/core/Mage/Core/Model/Config/Element.php b/app/code/core/Mage/Core/Model/Config/Element.php index 0509abeb73d..536fa9c39a0 100644 --- a/app/code/core/Mage/Core/Model/Config/Element.php +++ b/app/code/core/Mage/Core/Model/Config/Element.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Config element model * @@ -33,13 +32,12 @@ */ class Mage_Core_Model_Config_Element extends Varien_Simplexml_Element { - /** * Enter description here... * * @param string $var - * @param boolean $value - * @return boolean + * @param string|true $value + * @return bool */ public function is($var, $value = true) { @@ -73,5 +71,4 @@ public function getClassName() } return Mage::getConfig()->getModelClassName($model); } - } diff --git a/app/code/core/Mage/Core/Model/Config/Options.php b/app/code/core/Mage/Core/Model/Config/Options.php index cd2dd51ded8..b58a945997a 100644 --- a/app/code/core/Mage/Core/Model/Config/Options.php +++ b/app/code/core/Mage/Core/Model/Config/Options.php @@ -72,6 +72,11 @@ protected function _construct() $this->_data['export_dir'] = $this->_data['var_dir'].DS.'export'; } + /** + * @param string $type + * @return mixed + * @throws Mage_Core_Exception + */ public function getDir($type) { $method = 'get'.ucwords($type).'Dir'; @@ -82,65 +87,99 @@ public function getDir($type) return $dir; } + /** + * @return string + */ public function getAppDir() { //return $this->getDataSetDefault('app_dir', Mage::getRoot()); return $this->_data['app_dir']; } + /** + * @return string + */ public function getBaseDir() { //return $this->getDataSetDefault('base_dir', dirname($this->getAppDir())); return $this->_data['base_dir']; } + /** + * @return string + */ public function getCodeDir() { //return $this->getDataSetDefault('code_dir', $this->getAppDir().DS.'code'); return $this->_data['code_dir']; } + /** + * @return string + */ public function getDesignDir() { //return $this->getDataSetDefault('design_dir', $this->getAppDir().DS.'design'); return $this->_data['design_dir']; } + /** + * @return string + */ public function getEtcDir() { //return $this->getDataSetDefault('etc_dir', $this->getAppDir().DS.'etc'); return $this->_data['etc_dir']; } + /** + * @return string + */ public function getLibDir() { //return $this->getDataSetDefault('lib_dir', $this->getBaseDir().DS.'lib'); return $this->_data['lib_dir']; } + /** + * @return string + */ public function getLocaleDir() { //return $this->getDataSetDefault('locale_dir', $this->getAppDir().DS.'locale'); return $this->_data['locale_dir']; } + /** + * @return string + */ public function getMediaDir() { //return $this->getDataSetDefault('media_dir', $this->getBaseDir().DS.'media'); return $this->_data['media_dir']; } + /** + * @return string + */ public function getSkinDir() { //return $this->getDataSetDefault('skin_dir', $this->getBaseDir().DS.'skin'); return $this->_data['skin_dir']; } + /** + * @return bool|string + */ public function getSysTmpDir() { return sys_get_temp_dir(); } + /** + * @return string + * @throws Mage_Core_Exception + */ public function getVarDir() { //$dir = $this->getDataSetDefault('var_dir', $this->getBaseDir().DS.'var'); @@ -155,6 +194,10 @@ public function getVarDir() return $dir; } + /** + * @return string + * @throws Mage_Core_Exception + */ public function getTmpDir() { //$dir = $this->getDataSetDefault('tmp_dir', $this->getVarDir().DS.'tmp'); @@ -168,6 +211,9 @@ public function getTmpDir() return $dir; } + /** + * @return string + */ public function getCacheDir() { //$dir = $this->getDataSetDefault('cache_dir', $this->getVarDir().DS.'cache'); @@ -176,6 +222,9 @@ public function getCacheDir() return $dir; } + /** + * @return string + */ public function getLogDir() { //$dir = $this->getDataSetDefault('log_dir', $this->getVarDir().DS.'log'); @@ -184,6 +233,9 @@ public function getLogDir() return $dir; } + /** + * @return string + */ public function getSessionDir() { //$dir = $this->getDataSetDefault('session_dir', $this->getVarDir().DS.'session'); @@ -192,6 +244,9 @@ public function getSessionDir() return $dir; } + /** + * @return string + */ public function getUploadDir() { //$dir = $this->getDataSetDefault('upload_dir', $this->getMediaDir().DS.'upload'); @@ -200,6 +255,9 @@ public function getUploadDir() return $dir; } + /** + * @return string + */ public function getExportDir() { //$dir = $this->getDataSetDefault('export_dir', $this->getVarDir().DS.'export'); @@ -208,6 +266,10 @@ public function getExportDir() return $dir; } + /** + * @param string $dir + * @return bool + */ public function createDirIfNotExists($dir) { if (!empty($this->_dirExists[$dir])) { diff --git a/app/code/core/Mage/Core/Model/Config/System.php b/app/code/core/Mage/Core/Model/Config/System.php index 2323cd0da7c..79b03211f1e 100644 --- a/app/code/core/Mage/Core/Model/Config/System.php +++ b/app/code/core/Mage/Core/Model/Config/System.php @@ -33,11 +33,18 @@ */ class Mage_Core_Model_Config_System extends Mage_Core_Model_Config_Base { - public function __construct($sourceData=null) + /** + * @param string|null $sourceData + */ + public function __construct($sourceData = null) { parent::__construct($sourceData); } + /** + * @param string $module + * @return $this + */ public function load($module) { $file = Mage::getConfig()->getModuleDir('etc', $module).DS.'system.xml'; diff --git a/app/code/core/Mage/Core/Model/Convert.php b/app/code/core/Mage/Core/Model/Convert.php index b75c67460fd..0960ae26217 100644 --- a/app/code/core/Mage/Core/Model/Convert.php +++ b/app/code/core/Mage/Core/Model/Convert.php @@ -31,7 +31,6 @@ * @package Mage_Core * @author Magento Core Team */ -//class Mage_Core_Model_Convert extends Varien_Convert_Profile_Collection class Mage_Core_Model_Convert extends Mage_Dataflow_Model_Convert_Profile_Collection { public function __construct() @@ -47,6 +46,10 @@ public function __construct() } } + /** + * @param string $type + * @return mixed|string + */ public function getClassNameByType($type) { if (strpos($type, '/')!==false) { diff --git a/app/code/core/Mage/Core/Model/Cookie.php b/app/code/core/Mage/Core/Model/Cookie.php index 17f147428c4..c723c03b19f 100644 --- a/app/code/core/Mage/Core/Model/Cookie.php +++ b/app/code/core/Mage/Core/Model/Cookie.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core cookie model * @@ -222,8 +221,7 @@ public function set($name, $value, $period = null, $path = null, $domain = null, if ($period == 0) { $expire = 0; - } - else { + } else { $expire = time() + $period; } if (is_null($path)) { @@ -252,6 +250,7 @@ public function set($name, $value, $period = null, $path = null, $domain = null, * @param string $path * @param string $domain * @param int|bool $secure + * @param bool $httponly * @return $this */ public function renew($name, $period = null, $path = null, $domain = null, $secure = null, $httponly = null) @@ -269,7 +268,7 @@ public function renew($name, $period = null, $path = null, $domain = null, $secu /** * Retrieve cookie or false if not exists * - * @param string $neme The cookie name + * @param string $name The cookie name * @return mixed */ public function get($name = null) diff --git a/app/code/core/Mage/Core/Model/Date.php b/app/code/core/Mage/Core/Model/Date.php index 6d5cc4ba0a1..6a0176f172b 100644 --- a/app/code/core/Mage/Core/Model/Date.php +++ b/app/code/core/Mage/Core/Model/Date.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Date conversion model * @@ -77,7 +76,7 @@ public function calculateOffset($timezone = null) $result = true; $offset = 0; - if (!is_null($timezone)){ + if (!is_null($timezone)) { $oldzone = @date_default_timezone_get(); $result = date_default_timezone_set($timezone); } @@ -86,7 +85,7 @@ public function calculateOffset($timezone = null) $offset = (int)date('Z'); } - if (!is_null($timezone)){ + if (!is_null($timezone)) { date_default_timezone_set($oldzone); } @@ -144,7 +143,7 @@ public function gmtTimestamp($input = null) { if (is_null($input)) { return gmdate('U'); - } else if (is_numeric($input)) { + } elseif (is_numeric($input)) { $result = $input; } else { $result = strtotime($input); @@ -160,7 +159,6 @@ public function gmtTimestamp($input = null) unset($date); return $timestamp; - } /** @@ -174,7 +172,7 @@ public function timestamp($input = null) { if (is_null($input)) { $result = $this->gmtTimestamp(); - } else if (is_numeric($input)) { + } elseif (is_numeric($input)) { $result = $input; } else { $result = strtotime($input); @@ -213,6 +211,13 @@ public function getGmtOffset($type = 'seconds') } /** + * @param int $year + * @param int $month + * @param int $day + * @param int $hour + * @param int $minute + * @param int $second + * @return bool * @deprecated since 1.1.7 */ public function checkDateTime($year, $month, $day, $hour = 0, $minute = 0, $second = 0) @@ -230,6 +235,10 @@ public function checkDateTime($year, $month, $day, $hour = 0, $minute = 0, $seco } /** + * @param string $dateTimeString + * @param string $dateTimeFormat + * @return array + * @throws Mage_Core_Exception * @deprecated since 1.1.7 */ public function parseDateTime($dateTimeString, $dateTimeFormat) diff --git a/app/code/core/Mage/Core/Model/Design.php b/app/code/core/Mage/Core/Model/Design.php index 1adb5e4d8d7..4f5f3a44f20 100644 --- a/app/code/core/Mage/Core/Model/Design.php +++ b/app/code/core/Mage/Core/Model/Design.php @@ -24,20 +24,21 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Enter description here ... * * @method Mage_Core_Model_Resource_Design _getResource() * @method Mage_Core_Model_Resource_Design getResource() * @method int getStoreId() - * @method Mage_Core_Model_Design setStoreId(int $value) + * @method $this setStoreId(int $value) * @method string getDesign() - * @method Mage_Core_Model_Design setDesign(string $value) + * @method $this setDesign(string $value) * @method string getDateFrom() - * @method Mage_Core_Model_Design setDateFrom(string $value) + * @method $this setDateFrom(string $value) * @method string getDateTo() - * @method Mage_Core_Model_Design setDateTo(string $value) + * @method $this setDateTo(string $value) + * @method string getPackage() + * @method string getTheme() * * @category Mage * @package Mage_Core @@ -50,12 +51,20 @@ protected function _construct() $this->_init('core/design'); } + /** + * @return $this + */ public function validate() { $this->getResource()->validate($this); return $this; } + /** + * @param int $storeId + * @param string|null $date + * @return $this + */ public function loadChange($storeId, $date = null) { $result = $this->getResource() diff --git a/app/code/core/Mage/Core/Model/Design/Config.php b/app/code/core/Mage/Core/Model/Design/Config.php index 068d6b5de3f..144dc31dcc8 100644 --- a/app/code/core/Mage/Core/Model/Design/Config.php +++ b/app/code/core/Mage/Core/Model/Design/Config.php @@ -38,7 +38,8 @@ class Mage_Core_Model_Design_Config extends Varien_Simplexml_Config /** * Assemble themes inheritance config - * + * @param array $params + * @throws Mage_Core_Exception */ public function __construct(array $params = array()) { diff --git a/app/code/core/Mage/Core/Model/Design/Fallback.php b/app/code/core/Mage/Core/Model/Design/Fallback.php index e50df6a2ab0..cb9d14ebc02 100644 --- a/app/code/core/Mage/Core/Model/Design/Fallback.php +++ b/app/code/core/Mage/Core/Model/Design/Fallback.php @@ -60,6 +60,7 @@ class Mage_Core_Model_Design_Fallback /** * Constructor + * @param array $params */ public function __construct(array $params = array()) { @@ -80,7 +81,7 @@ public function getStore() } /** - * @param $store string|integer|Mage_Core_Model_Store + * @param string|integer|Mage_Core_Model_Store $store * @return $this */ public function setStore($store) @@ -106,7 +107,6 @@ public function getFallbackScheme($area, $package, $theme) $cacheKey = $area . '/' . $package . '/' . $theme; if (!isset($this->_cachedSchemes[$cacheKey])) { - if ($this->_isInheritanceDefined($area, $package, $theme)) { $scheme = $this->_getFallbackScheme($area, $package, $theme); } else { @@ -122,9 +122,9 @@ public function getFallbackScheme($area, $package, $theme) /** * Check if inheritance defined in theme config * - * @param $area - * @param $package - * @param $theme + * @param string $area + * @param string $package + * @param string $theme * @return bool */ protected function _isInheritanceDefined($area, $package, $theme) @@ -147,7 +147,6 @@ protected function _getFallbackScheme($area, $package, $theme) $scheme = array(array()); $this->_visited = array(); while ($parent = (string)$this->_config->getNode($area . '/' . $package . '/' . $theme . '/parent')) { - $this->_checkVisited($area, $package, $theme); $parts = explode('/', $parent); @@ -168,7 +167,6 @@ protected function _getFallbackScheme($area, $package, $theme) * @param string $package * @param string $theme * @throws Mage_Core_Exception - * @return array */ protected function _checkVisited($area, $package, $theme) { diff --git a/app/code/core/Mage/Core/Model/Design/Package.php b/app/code/core/Mage/Core/Model/Design/Package.php index 4854ab27da2..6e61e671653 100644 --- a/app/code/core/Mage/Core/Model/Design/Package.php +++ b/app/code/core/Mage/Core/Model/Design/Package.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Design_Package { const DEFAULT_AREA = 'frontend'; @@ -154,7 +153,7 @@ public function setArea($area) /** * Retrieve package area * - * @return unknown + * @return string */ public function getArea() { @@ -178,12 +177,10 @@ public function setPackageName($name = '') $customPackage = $this->_checkUserAgentAgainstRegexps('design/package/ua_regexp'); if ($customPackage) { $this->_name = $customPackage; - } - else { + } else { $this->_name = Mage::getStoreConfig('design/package/name', $this->getStore()); } - } - else { + } else { $this->_name = $name; } // make sure not to crash, if wrong package specified @@ -233,6 +230,11 @@ public function getPackageName() return $this->_name; } + /** + * @param string $packageName + * @param string $area + * @return bool + */ public function designPackageExists($packageName, $area = self::DEFAULT_AREA) { return is_dir(Mage::getBaseDir('design') . DS . $area . DS . $packageName); @@ -265,6 +267,10 @@ public function setTheme() return $this; } + /** + * @param string $type + * @return string + */ public function getTheme($type) { if (empty($this->_theme[$type])) { @@ -290,11 +296,18 @@ public function getTheme($type) return $this->_theme[$type]; } + /** + * @return string + */ public function getDefaultTheme() { return self::DEFAULT_THEME; } + /** + * @param array $params + * @return $this + */ public function updateParamDefaults(array &$params) { if ($this->getStore()) { @@ -307,7 +320,7 @@ public function updateParamDefaults(array &$params) $params['_package'] = $this->getPackageName(); } if (empty($params['_theme'])) { - $params['_theme'] = $this->getTheme( (isset($params['_type'])) ? $params['_type'] : '' ); + $params['_theme'] = $this->getTheme((isset($params['_type'])) ? $params['_type'] : ''); } if (empty($params['_default'])) { $params['_default'] = false; @@ -315,6 +328,10 @@ public function updateParamDefaults(array &$params) return $this; } + /** + * @param array $params + * @return string + */ public function getBaseDir(array $params) { $this->updateParamDefaults($params); @@ -323,7 +340,11 @@ public function getBaseDir(array $params) return $baseDir; } - public function getSkinBaseDir(array $params=array()) + /** + * @param array $params + * @return string + */ + public function getSkinBaseDir(array $params = array()) { $params['_type'] = 'skin'; $this->updateParamDefaults($params); @@ -332,7 +353,11 @@ public function getSkinBaseDir(array $params=array()) return $baseDir; } - public function getLocaleBaseDir(array $params=array()) + /** + * @param array $params + * @return string + */ + public function getLocaleBaseDir(array $params = array()) { $params['_type'] = 'locale'; $this->updateParamDefaults($params); @@ -342,7 +367,11 @@ public function getLocaleBaseDir(array $params=array()) return $baseDir; } - public function getSkinBaseUrl(array $params=array()) + /** + * @param array $params + * @return string + */ + public function getSkinBaseUrl(array $params = array()) { $params['_type'] = 'skin'; $this->updateParamDefaults($params); @@ -379,7 +408,7 @@ public function validateFile($file, array $params) * Get filename by specified theme parameters * * @param array $file - * @param $params + * @param array $params * @return string */ protected function _renderFilename($file, array $params) @@ -408,7 +437,7 @@ protected function _renderFilename($file, array $params) * If disabled, the lookup won't be performed to spare filesystem calls. * * @param string $file - * @param array &$params + * @param array $params * @param array $fallbackScheme * @return string */ @@ -454,19 +483,34 @@ public function getFilename($file, array $params) return $result; } - public function getLayoutFilename($file, array $params=array()) + /** + * @param string $file + * @param array $params + * @return string + */ + public function getLayoutFilename($file, array $params = array()) { $params['_type'] = 'layout'; return $this->getFilename($file, $params); } - public function getTemplateFilename($file, array $params=array()) + /** + * @param string $file + * @param array $params + * @return string + */ + public function getTemplateFilename($file, array $params = array()) { $params['_type'] = 'template'; return $this->getFilename($file, $params); } - public function getLocaleFileName($file, array $params=array()) + /** + * @param string $file + * @param array $params + * @return string + */ + public function getLocaleFileName($file, array $params = array()) { $params['_type'] = 'locale'; return $this->getFilename($file, $params); @@ -518,14 +562,14 @@ public function getPackageList() /** * Design package (optional) themes list getter * @param string $package - * @return string + * @return array */ public function getThemeList($package = null) { $result = array(); - if (is_null($package)){ - foreach ($this->getPackageList() as $package){ + if (is_null($package)) { + foreach ($this->getPackageList() as $package) { $result[$package] = $this->getThemeList($package); } } else { @@ -549,7 +593,7 @@ private function _listDirectories($path, $fullPath = false) $dir = opendir($path); if ($dir) { while ($entry = readdir($dir)) { - if (substr($entry, 0, 1) == '.' || !is_dir($path . DS . $entry)){ + if (substr($entry, 0, 1) == '.' || !is_dir($path . DS . $entry)) { continue; } if ($fullPath) { @@ -632,7 +676,7 @@ public static function getPackageByUserAgent(array $rules, $regexpsConfigPath = /** * Merge specified javascript files and return URL to the merged file on success * - * @param $files + * @param array $files * @return string */ public function getMergedJsUrl($files) @@ -651,7 +695,7 @@ public function getMergedJsUrl($files) /** * Merge specified css files and return URL to the merged file on success * - * @param $files + * @param array $files * @return string */ public function getMergedCssUrl($files) @@ -675,7 +719,8 @@ public function getMergedCssUrl($files) // merge into target file $targetFilename = md5(implode(',', $files) . "|{$hostname}|{$port}") . '.css'; $mergeFilesResult = $this->_mergeFiles( - $files, $targetDir . DS . $targetFilename, + $files, + $targetDir . DS . $targetFilename, false, array($this, 'beforeMergeCss'), 'css' @@ -693,13 +738,17 @@ public function getMergedCssUrl($files) * @param array $srcFiles * @param string|bool $targetFile - file path to be written * @param bool $mustMerge - * @param callback $beforeMergeCallback + * @param callable $beforeMergeCallback * @param array|string $extensionsFilter * @return bool|string */ - protected function _mergeFiles(array $srcFiles, $targetFile = false, - $mustMerge = false, $beforeMergeCallback = null, $extensionsFilter = array()) - { + protected function _mergeFiles( + array $srcFiles, + $targetFile = false, + $mustMerge = false, + $beforeMergeCallback = null, + $extensionsFilter = array() + ) { if (Mage::helper('core/file_storage_database')->checkDbUsage()) { if (!file_exists($targetFile)) { Mage::helper('core/file_storage_database')->saveFileToFilesystem($targetFile); @@ -720,7 +769,6 @@ protected function _mergeFiles(array $srcFiles, $targetFile = false, Mage::helper('core/file_storage_database')->saveFile($targetFile); } return $result; - } else { return Mage::helper('core')->mergeFiles( $srcFiles, @@ -780,15 +828,15 @@ protected function _initMergerDir($dirRelativeName, $cleanup = false) */ public function beforeMergeCss($file, $contents) { - $this->_setCallbackFileDir($file); + $this->_setCallbackFileDir($file); - $cssImport = '/@import\\s+([\'"])(.*?)[\'"]/'; - $contents = preg_replace_callback($cssImport, array($this, '_cssMergerImportCallback'), $contents); + $cssImport = '/@import\\s+([\'"])(.*?)[\'"]/'; + $contents = preg_replace_callback($cssImport, array($this, '_cssMergerImportCallback'), $contents); - $cssUrl = '/url\\(\\s*(?![\\\'\\"]?data:)([^\\)\\s]+)\\s*\\)?/'; - $contents = preg_replace_callback($cssUrl, array($this, '_cssMergerUrlCallback'), $contents); + $cssUrl = '/url\\(\\s*(?![\\\'\\"]?data:)([^\\)\\s]+)\\s*\\)?/'; + $contents = preg_replace_callback($cssUrl, array($this, '_cssMergerUrlCallback'), $contents); - return $contents; + return $contents; } /** @@ -798,8 +846,8 @@ public function beforeMergeCss($file, $contents) */ protected function _setCallbackFileDir($file) { - $file = str_replace(Mage::getBaseDir().DS, '', $file); - $this->_callbackFileDir = dirname($file); + $file = str_replace(Mage::getBaseDir().DS, '', $file); + $this->_callbackFileDir = dirname($file); } /** @@ -864,7 +912,7 @@ protected function _prepareUrl($uri) $baseUrl = Mage::getBaseUrl('web', $secure); } - foreach ($pathParts as $key=>$part) { + foreach ($pathParts as $key => $part) { if ($part == '.' || $part == '..') { unset($pathParts[$key]); } diff --git a/app/code/core/Mage/Core/Model/Design/Source/Apply.php b/app/code/core/Mage/Core/Model/Design/Source/Apply.php index 663f5964e0f..4a546225a9d 100644 --- a/app/code/core/Mage/Core/Model/Design/Source/Apply.php +++ b/app/code/core/Mage/Core/Model/Design/Source/Apply.php @@ -29,6 +29,9 @@ */ class Mage_Core_Model_Design_Source_Apply extends Mage_Eav_Model_Entity_Attribute_Source_Abstract { + /** + * @return array + */ public function getAllOptions() { if (!$this->_options) { @@ -39,7 +42,7 @@ public function getAllOptions() 2 => Mage::helper('core')->__('This category only') ); - foreach ($optionArray as $k=>$label) { + foreach ($optionArray as $k => $label) { $this->_options[] = array('value'=>$k, 'label'=>$label); } } diff --git a/app/code/core/Mage/Core/Model/Design/Source/Design.php b/app/code/core/Mage/Core/Model/Design/Source/Design.php index 1ce90d04ba0..41e6109f8c3 100644 --- a/app/code/core/Mage/Core/Model/Design/Source/Design.php +++ b/app/code/core/Mage/Core/Model/Design/Source/Design.php @@ -63,7 +63,7 @@ public function getAllOptions($withEmpty = true) if (is_null($this->_options)) { $design = Mage::getModel('core/design_package')->getThemeList(); $options = array(); - foreach ($design as $package => $themes){ + foreach ($design as $package => $themes) { $packageOption = array('label' => $package); $themeOptions = array(); foreach ($themes as $theme) { @@ -81,8 +81,7 @@ public function getAllOptions($withEmpty = true) if ($withEmpty) { array_unshift($options, array( 'value'=>'', - 'label'=>Mage::helper('core')->__('-- Please Select --')) - ); + 'label'=>Mage::helper('core')->__('-- Please Select --'))); } return $options; } diff --git a/app/code/core/Mage/Core/Model/Domainpolicy.php b/app/code/core/Mage/Core/Model/Domainpolicy.php index d70ce683fd0..0c40aa0f741 100644 --- a/app/code/core/Mage/Core/Model/Domainpolicy.php +++ b/app/code/core/Mage/Core/Model/Domainpolicy.php @@ -58,6 +58,11 @@ class Mage_Core_Model_Domainpolicy */ protected $_store; + /** + * Mage_Core_Model_Domainpolicy constructor. + * @param array $options + * @throws Mage_Core_Model_Store_Exception + */ public function __construct($options = array()) { $this->_store = isset($options['store']) ? $options['store'] : Mage::app()->getStore(); @@ -66,23 +71,21 @@ public function __construct($options = array()) /** * Add X-Frame-Options header to response, depends on config settings * - * @var Varien_Object $observer + * @var Varien_Event_Observer $observer * @return $this */ - public function addDomainPolicyHeader($observer) + public function addDomainPolicyHeader(Varien_Event_Observer $observer) { - /** @var Mage_Core_Controller->getCurrentAreaDomainPolicy_Varien_Action $action */ $action = $observer->getControllerAction(); $policy = null; if ('adminhtml' == $action->getLayout()->getArea()) { $policy = $this->getBackendPolicy(); - } elseif('frontend' == $action->getLayout()->getArea()) { + } elseif ('frontend' == $action->getLayout()->getArea()) { $policy = $this->getFrontendPolicy(); } if ($policy) { - /** @var Mage_Core_Controller_Response_Http $response */ $response = $action->getResponse(); $response->setHeader('X-Frame-Options', $policy, true); } @@ -110,17 +113,15 @@ public function getFrontendPolicy() return $this->_getDomainPolicyByCode((int)(string)$this->_store->getConfig(self::XML_DOMAIN_POLICY_FRONTEND)); } - - /** * Return string representation for policy code * - * @param $policyCode + * @param string $policyCode * @return string|null */ protected function _getDomainPolicyByCode($policyCode) { - switch($policyCode) { + switch ($policyCode) { case self::FRAME_POLICY_ALLOW: $policy = null; break; diff --git a/app/code/core/Mage/Core/Model/Email.php b/app/code/core/Mage/Core/Model/Email.php index bc31d1731f1..64d3af65e7c 100644 --- a/app/code/core/Mage/Core/Model/Email.php +++ b/app/code/core/Mage/Core/Model/Email.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Possible data fields: * @@ -35,10 +34,26 @@ * - template (file name) * - module (for template) * + * @method getFromEmail() + * @method $this setFromEmail(string $string) + * @method getFromName() + * @method $this setFromName(string $string) + * @method string getTemplate() + * @method $this setTemplate(string $string) + * @method string|array getToEmail() + * @method $this setToEmail(string|array $string) + * @method getToName() + * @method $this setToName(string $string) + * @method string getType() + * @method $this setType(string $string) */ class Mage_Core_Model_Email extends Varien_Object { protected $_tplVars = array(); + + /** + * @var Mage_Core_Block_Template + */ protected $_block; public function __construct() @@ -49,24 +64,34 @@ public function __construct() $this->setType('text'); } + /** + * @param string|array $var + * @param string|null $value + * @return $this + */ public function setTemplateVar($var, $value = null) { if (is_array($var)) { - foreach ($var as $index=>$value) { + foreach ($var as $index => $value) { $this->_tplVars[$index] = $value; } - } - else { + } else { $this->_tplVars[$var] = $value; } return $this; } + /** + * @return array + */ public function getTemplateVars() { return $this->_tplVars; } + /** + * @return string + */ public function getBody() { $body = $this->getData('body'); @@ -74,7 +99,7 @@ public function getBody() $this->_block = Mage::getModel('core/layout')->createBlock('core/template', 'email') ->setArea('frontend') ->setTemplate($this->getTemplate()); - foreach ($this->getTemplateVars() as $var=>$value) { + foreach ($this->getTemplateVars() as $var => $value) { $this->_block->assign($var, $value); } $this->_block->assign('_type', strtolower($this->getType())) @@ -84,6 +109,9 @@ public function getBody() return $body; } + /** + * @return string + */ public function getSubject() { $subject = $this->getData('subject'); @@ -94,6 +122,10 @@ public function getSubject() return $subject; } + /** + * @return $this + * @throws Zend_Mail_Exception + */ public function send() { if (Mage::getStoreConfigFlag('system/smtp/disable')) { @@ -104,8 +136,7 @@ public function send() if (strtolower($this->getType()) == 'html') { $mail->setBodyHtml($this->getBody()); - } - else { + } else { $mail->setBodyText($this->getBody()); } diff --git a/app/code/core/Mage/Core/Model/Email/Queue.php b/app/code/core/Mage/Core/Model/Email/Queue.php index e14473604ba..71c5880efb1 100644 --- a/app/code/core/Mage/Core/Model/Email/Queue.php +++ b/app/code/core/Mage/Core/Model/Email/Queue.php @@ -27,20 +27,23 @@ /** * Email Template Mailer Model * - * @method Mage_Core_Model_Email_Queue setEntityId(int $value) - * @method Mage_Core_Model_Email_Queue setEntityType(string $value) - * @method Mage_Core_Model_Email_Queue setEventType(string $value) - * @method Mage_Core_Model_Email_Queue setIsForceCheck(int $value) - * @method int getIsForceCheck() + * @method Mage_Core_Model_Resource_Email_Queue _getResource() + * @method $this setCreatedAt(string $value) * @method int getEntityId() + * @method $this setEntityId(int $value) * @method string getEntityType() + * @method $this setEntityType(string $value) * @method string getEventType() + * @method $this setEventType(string $value) + * @method int getIsForceCheck() + * @method $this setIsForceCheck(int $value) * @method string getMessageBodyHash() * @method string getMessageBody() - * @method Mage_Core_Model_Email_Queue setMessageBody(string $value) - * @method Mage_Core_Model_Email_Queue setMessageParameters(array $value) - * @method Mage_Core_Model_Email_Queue setProcessedAt(string $value) + * @method $this setMessageBody(string $value) + * @method $this setMessageBodyHash(array $value) * @method array getMessageParameters() + * @method $this setMessageParameters(array $value) + * @method $this setProcessedAt(string $value) * * @category Mage * @package Mage_Core @@ -77,7 +80,7 @@ protected function _construct() /** * Save bind recipients to message * - * @return $this + * @inheritDoc */ protected function _afterSave() { @@ -88,7 +91,7 @@ protected function _afterSave() /** * Validate recipients before saving * - * @return $this + * @inheritDoc */ protected function _beforeSave() { @@ -185,18 +188,16 @@ public function getRecipients() */ public function send() { - /** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */ $collection = Mage::getModel('core/email_queue')->getCollection() ->addOnlyForSendingFilter() ->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN) ->setCurPage(1) ->load(); - ini_set('SMTP', Mage::getStoreConfig('system/smtp/host')); ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port')); - /** @var $message Mage_Core_Model_Email_Queue */ + /** @var Mage_Core_Model_Email_Queue $message */ foreach ($collection as $message) { if ($message->getId()) { $parameters = new Varien_Object($message->getMessageParameters()); diff --git a/app/code/core/Mage/Core/Model/Email/Template.php b/app/code/core/Mage/Core/Model/Email/Template.php index 82a6ff3b7de..2a144fa4a55 100644 --- a/app/code/core/Mage/Core/Model/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Email/Template.php @@ -41,30 +41,43 @@ * @method Mage_Core_Model_Resource_Email_Template _getResource() * @method Mage_Core_Model_Resource_Email_Template getResource() * @method string getTemplateCode() - * @method Mage_Core_Model_Email_Template setTemplateCode(string $value) + * @method $this setTemplateCode(string $value) * @method string getTemplateText() - * @method Mage_Core_Model_Email_Template setTemplateText(string $value) + * @method $this setTemplateText(string $value) * @method string getTemplateStyles() - * @method Mage_Core_Model_Email_Template setTemplateStyles(string $value) + * @method $this setTemplateStyles(string $value) * @method int getTemplateType() - * @method Mage_Core_Model_Email_Template setTemplateType(int $value) + * @method $this setTemplateType(int $value) * @method string getTemplateSubject() - * @method Mage_Core_Model_Email_Template setTemplateSubject(string $value) + * @method $this setTemplateSubject(string $value) * @method string getTemplateSenderName() - * @method Mage_Core_Model_Email_Template setTemplateSenderName(string $value) + * @method $this setTemplateSenderName(string $value) * @method string getTemplateSenderEmail() - * @method Mage_Core_Model_Email_Template setTemplateSenderEmail(string $value) + * @method $this setTemplateSenderEmail(string $value) * @method string getAddedAt() - * @method Mage_Core_Model_Email_Template setAddedAt(string $value) + * @method $this setAddedAt(string $value) * @method string getModifiedAt() - * @method Mage_Core_Model_Email_Template setModifiedAt(string $value) + * @method $this setModifiedAt(string $value) * @method string getOrigTemplateCode() - * @method Mage_Core_Model_Email_Template setOrigTemplateCode(string $value) + * @method $this setOrigTemplateCode(string $value) * @method string getOrigTemplateVariables() - * @method Mage_Core_Model_Email_Template setOrigTemplateVariables(string $value) - * @method Mage_Core_Model_Email_Template setQueue(Mage_Core_Model_Abstract $value) + * @method $this setOrigTemplateVariables(string $value) + * @method $this setQueue(Mage_Core_Model_Abstract $value) * @method Mage_Core_Model_Email_Queue getQueue() * @method int hasQueue() + * @method bool getSentSuccess() + * @method string getSenderName() + * @method string getSenderEmail() + * @method int getTemplateId() + * @method $this setTemplateId(int $value) + * @method $this setSenderName(string $value) + * @method $this setSenderEmail(string $value) + * @method $this setSentSuccess(bool $value) + * @method $this setCreatedAt(string $value) + * @method int getTemplateActual() + * @method bool getUseAbsoluteLinks() + * @method setUseAbsoluteLinks(bool $value) + * @method $this setInlineCssFile(string $value) * * @category Mage * @package Mage_Core @@ -112,7 +125,7 @@ public function getMail() * Declare template processing filter * * @param Varien_Filter_Template $filter - * @return Mage_Core_Model_Email_Template + * @return $this */ public function setTemplateFilter(Varien_Filter_Template $filter) { @@ -139,7 +152,7 @@ public function getTemplateFilter() * Load template by code * * @param string $templateCode - * @return Mage_Core_Model_Email_Template + * @return $this */ public function loadByCode($templateCode) { @@ -152,8 +165,9 @@ public function loadByCode($templateCode) * * @param string $templateId * @param string $locale + * @return $this */ - public function loadDefault($templateId, $locale=null) + public function loadDefault($templateId, $locale = null) { $defaultTemplates = self::getDefaultTemplates(); if (!isset($defaultTemplates[$templateId])) { @@ -164,7 +178,9 @@ public function loadDefault($templateId, $locale=null) $this->setTemplateType($data['type']=='html' ? self::TYPE_HTML : self::TYPE_TEXT); $templateText = Mage::app()->getTranslator()->getTemplateFile( - $data['file'], 'email', $locale + $data['file'], + 'email', + $locale ); if (preg_match('//u', $templateText, $matches)) { @@ -178,8 +194,8 @@ public function loadDefault($templateId, $locale=null) } if (preg_match('//s', $templateText, $matches)) { - $this->setTemplateStyles($matches[1]); - $templateText = str_replace($matches[0], '', $templateText); + $this->setTemplateStyles($matches[1]); + $templateText = str_replace($matches[0], '', $templateText); } /** @@ -198,9 +214,9 @@ public function loadDefault($templateId, $locale=null) * * @return array */ - static public function getDefaultTemplates() + public static function getDefaultTemplates() { - if(is_null(self::$_defaultTemplates)) { + if (is_null(self::$_defaultTemplates)) { self::$_defaultTemplates = Mage::getConfig()->getNode(self::XML_PATH_TEMPLATE_EMAIL)->asArray(); } @@ -212,7 +228,7 @@ static public function getDefaultTemplates() * * @return array */ - static public function getDefaultTemplatesAsOptionsArray() + public static function getDefaultTemplatesAsOptionsArray() { $options = array( array('value'=>'', 'label'=> '') @@ -247,6 +263,7 @@ public function getId() /** * Set id of template * @param int $value + * @return $this */ public function setId($value) { @@ -271,7 +288,8 @@ public function isValidForSend() * * @return int|string */ - public function getType(){ + public function getType() + { return $this->getTemplateType(); } @@ -313,8 +331,7 @@ public function getProcessedTemplate(array $variables = array()) $this->setInlineCssFile($processor->getInlineCssFile()); // Now that all HTML has been assembled, run email through CSS inlining process $processedResult = $this->getPreparedTemplateText($result); - } - catch (Exception $e) { + } catch (Exception $e) { $this->_cancelDesignConfig(); throw $e; } @@ -353,8 +370,8 @@ public function getPreparedTemplateText($html = null) public function getInclude($template, array $variables) { $thisClass = __CLASS__; + /** @var Mage_Core_Model_Email_Template $includeTemplate */ $includeTemplate = new $thisClass(); - $includeTemplate->loadByCode($template); return $includeTemplate->getProcessedTemplate($variables); @@ -405,7 +422,7 @@ public function send($email, $name = null, array $variables = array()) } if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) { - /** @var $emailQueue Mage_Core_Model_Email_Queue */ + /** @var Mage_Core_Model_Email_Queue $emailQueue */ $emailQueue = $this->getQueue(); $emailQueue->clearRecipients(); $emailQueue->setMessageBody($text); @@ -451,8 +468,7 @@ public function send($email, $name = null, array $variables = array()) try { $mail->send(); $this->_mail = null; - } - catch (Exception $e) { + } catch (Exception $e) { $this->_mail = null; Mage::logException($e); return false; @@ -464,18 +480,18 @@ public function send($email, $name = null, array $variables = array()) /** * Send transactional email to recipient * - * @param int $templateId - * @param string|array $sender sender information, can be declared as part of config path + * @param string|int $templateId + * @param array|string $sender sender information, can be declared as part of config path * @param string $email recipient email - * @param string $name recipient name + * @param array|string|null $name recipient name * @param array $vars variables which can be used in template * @param int|null $storeId * * @throws Mage_Core_Exception * - * @return Mage_Core_Model_Email_Template + * @return $this */ - public function sendTransactional($templateId, $sender, $email, $name, $vars=array(), $storeId=null) + public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null) { $this->setSentSuccess(false); if (($storeId === null) && $this->getDesignConfig()->getStore()) { @@ -520,17 +536,16 @@ public function getProcessedTemplateSubject(array $variables) { $processor = $this->getTemplateFilter(); - if(!$this->_preprocessFlag) { + if (!$this->_preprocessFlag) { $variables['this'] = $this; } $processor->setVariables($variables); $this->_applyDesignConfig(); - try{ + try { $processedResult = $processor->filter($this->getTemplateSubject()); - } - catch (Exception $e) { + } catch (Exception $e) { $this->_cancelDesignConfig(); throw $e; } @@ -538,6 +553,10 @@ public function getProcessedTemplateSubject(array $variables) return $processedResult; } + /** + * @param array|string $bcc + * @return $this + */ public function addBcc($bcc) { if (is_array($bcc)) { @@ -545,8 +564,7 @@ public function addBcc($bcc) $this->_bccEmails[] = $email; $this->getMail()->addBcc($email); } - } - elseif ($bcc) { + } elseif ($bcc) { $this->_bccEmails[] = $bcc; $this->getMail()->addBcc($bcc); } @@ -559,7 +577,7 @@ public function addBcc($bcc) * @param string $email * @return $this */ - public function setReturnPath($email) + public function setReturnPath($email) { $this->getMail()->setReturnPath($email); return $this; @@ -623,7 +641,7 @@ public function getVariablesOptionArray($withGroup = false) /** * Validate email template code * - * @return $this + * {@inheritDoc} */ protected function _beforeSave() { @@ -631,7 +649,7 @@ protected function _beforeSave() if (empty($code)) { Mage::throwException(Mage::helper('core')->__('The template Name must not be empty.')); } - if($this->_getResource()->checkCodeUsage($this)) { + if ($this->_getResource()->checkCodeUsage($this)) { Mage::throwException(Mage::helper('core')->__('Duplicate Of Template Name')); } return parent::_beforeSave(); diff --git a/app/code/core/Mage/Core/Model/Email/Template/Abstract.php b/app/code/core/Mage/Core/Model/Email/Template/Abstract.php index 917ac4de6c4..4e2cfba7c80 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Abstract.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Abstract.php @@ -30,6 +30,12 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getInlineCssFile() + * @method $this setTemplateType(int $value) + * @method getTemplateText() + * @method $this setTemplateText(string $value) + * @method string getTemplateStyles() */ abstract class Mage_Core_Model_Email_Template_Abstract extends Mage_Core_Model_Template { @@ -62,7 +68,7 @@ public function getTemplateByConfigPath($configPath, array $variables) * * @param string $configPath The path to the config setting that defines which global/template/email/* node * should be used to load the email template - * @return Mage_Core_Model_Email_Template + * @return $this|null */ public function loadByConfigPath($configPath) { @@ -84,7 +90,9 @@ public function loadByConfigPath($configPath) $localeCode = Mage::getStoreConfig('general/locale/code', $storeId); $templateText = Mage::app()->getTranslator()->getTemplateFile( - $data['file'], 'email', $localeCode + $data['file'], + 'email', + $localeCode ); $this->setTemplateText($templateText); @@ -142,8 +150,8 @@ protected function _getLogoAlt($store) /** * Add variables that are used by transactional emails and newsletter emails * - * @param $variables - * @param $storeId + * @param array $variables + * @param int $storeId * @return mixed */ protected function _addEmailVariables($variables, $storeId) @@ -183,7 +191,7 @@ protected function _addEmailVariables($variables, $storeId) * Merge HTML and CSS and returns HTML that has CSS styles applied "inline" to the HTML tags. This is necessary * in order to support all email clients. * - * @param $html + * @param string $html * @return string */ protected function _applyInlineCss($html) @@ -251,7 +259,7 @@ protected function _getCssFileContent($filename) * Accepts a path to a System Config setting that contains a comma-delimited list of files to load. Loads those * files and then returns the concatenated content. * - * @param $configPath + * @param string $configPath * @return string */ protected function _getCssByConfig($configPath) @@ -264,7 +272,7 @@ protected function _getCssByConfig($configPath) $files = array_map('trim', explode(",", $filesToLoad)); $css = ''; - foreach($files as $fileName) { + foreach ($files as $fileName) { $css .= $this->_getCssFileContent($fileName) . "\n"; } $this->_cssFileCache[$configPath] = $css; diff --git a/app/code/core/Mage/Core/Model/Email/Template/Filter.php b/app/code/core/Mage/Core/Model/Email/Template/Filter.php index 2ff985765e8..9330a0a0c7b 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Filter.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Filter.php @@ -220,11 +220,10 @@ public function layoutDirective($construction) $params = $this->_getIncludeParameters($construction[2]); $layout = Mage::getModel('core/layout'); - /* @var $layout Mage_Core_Model_Layout */ + /* @var Mage_Core_Model_Layout $layout */ if (isset($params['area'])) { $layout->setArea($params['area']); - } - else { + } else { $layout->setArea(Mage::app()->getLayout()->getArea()); } @@ -235,7 +234,7 @@ public function layoutDirective($construction) $layout->generateBlocks(); foreach ($layout->getAllBlocks() as $blockName => $block) { - /* @var $block Mage_Core_Block_Abstract */ + /* @var Mage_Core_Block_Abstract $block */ foreach ($params as $k => $v) { if (in_array($k, $skipParams)) { continue; @@ -329,8 +328,7 @@ public function storeDirective($construction) $path = ''; $params['_direct'] = $params['direct_url']; unset($params['direct_url']); - } - else { + } else { $path = isset($params['url']) ? $params['url'] : ''; unset($params['url']); } @@ -456,8 +454,7 @@ public function protocolDirective($construction) $protocol = $isSecure ? 'https' : 'http'; if (isset($params['url'])) { return $protocol . '://' . $params['url']; - } - elseif (isset($params['http']) && isset($params['https'])) { + } elseif (isset($params['http']) && isset($params['https'])) { if ($isSecure) { return $params['https']; } diff --git a/app/code/core/Mage/Core/Model/Email/Template/Mailer.php b/app/code/core/Mage/Core/Model/Email/Template/Mailer.php index 2513e8dfe68..7af8b8c6b47 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Mailer.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Mailer.php @@ -64,7 +64,7 @@ public function addEmailInfo(Mage_Core_Model_Email_Info $emailInfo) */ public function send() { - /** @var $emailTemplate Mage_Core_Model_Email_Template */ + /** @var Mage_Core_Model_Email_Template $emailTemplate */ $emailTemplate = Mage::getModel('core/email_template'); // Send all emails from corresponding list while (!empty($this->_emailInfos)) { @@ -81,7 +81,7 @@ public function send() $emailInfo->getToNames(), $this->getTemplateParams(), $this->getStoreId() - ); + ); } return $this; } diff --git a/app/code/core/Mage/Core/Model/File/Storage.php b/app/code/core/Mage/Core/Model/File/Storage.php index 433bfa36a75..dce1c7cf363 100644 --- a/app/code/core/Mage/Core/Model/File/Storage.php +++ b/app/code/core/Mage/Core/Model/File/Storage.php @@ -65,7 +65,8 @@ class Mage_Core_Model_File_Storage extends Mage_Core_Model_Abstract * @param Mage_Core_Model_Abstract $destinationModel * @return bool */ - protected function _synchronizeHasErrors(Mage_Core_Model_Abstract $sourceModel, + protected function _synchronizeHasErrors( + Mage_Core_Model_Abstract $sourceModel, Mage_Core_Model_Abstract $destinationModel ) { if (!$sourceModel || !$destinationModel) { @@ -96,7 +97,7 @@ public function getSyncFlag() * * @param int|null $storage * @param array $params - * @return Mage_Core_Model_Abstract|bool + * @return Mage_Core_Model_File_Storage_File|Mage_Core_Model_File_Storage_Database|false */ public function getStorageModel($storage = null, $params = array()) { diff --git a/app/code/core/Mage/Core/Model/File/Storage/Abstract.php b/app/code/core/Mage/Core/Model/File/Storage/Abstract.php index 6b63831b698..b1659db05cf 100644 --- a/app/code/core/Mage/Core/Model/File/Storage/Abstract.php +++ b/app/code/core/Mage/Core/Model/File/Storage/Abstract.php @@ -49,7 +49,7 @@ abstract class Mage_Core_Model_File_Storage_Abstract extends Mage_Core_Model_Abs public function getMediaBaseDirectory() { if (null === $this->_mediaBaseDirectory) { - /** @var $helper Mage_Core_Helper_File_Storage_Database */ + /** @var Mage_Core_Helper_File_Storage_Database $helper */ $helper = Mage::helper('core/file_storage_database'); $this->_mediaBaseDirectory = $helper->getMediaBaseDir(); } diff --git a/app/code/core/Mage/Core/Model/File/Storage/Database.php b/app/code/core/Mage/Core/Model/File/Storage/Database.php index 989726a489d..2e2aa460fc6 100644 --- a/app/code/core/Mage/Core/Model/File/Storage/Database.php +++ b/app/code/core/Mage/Core/Model/File/Storage/Database.php @@ -30,6 +30,8 @@ * * @method Mage_Core_Model_Resource_File_Storage_Database _getResource() * @method Mage_Core_Model_Resource_File_Storage_Database getResource() + * @method string getConnectionName() + * @method $this setDirectoryId(int $value) * * @category Mage * @package Mage_Core @@ -80,7 +82,8 @@ public function getDirectoryModel() if (is_null($this->_directoryModel)) { $this->_directoryModel = Mage::getModel( 'core/file_storage_directory_database', - array('connection' => $this->getConnectionName())); + array('connection' => $this->getConnectionName()) + ); } return $this->_directoryModel; @@ -152,7 +155,8 @@ public function clear() * @param int $count * @return bool|array */ - public function exportDirectories($offset = 0, $count = 100) { + public function exportDirectories($offset = 0, $count = 100) + { return $this->getDirectoryModel()->exportDirectories($offset, $count); } @@ -162,7 +166,8 @@ public function exportDirectories($offset = 0, $count = 100) { * @param array $dirs * @return Mage_Core_Model_File_Storage_Directory_Database */ - public function importDirectories($dirs) { + public function importDirectories($dirs) + { return $this->getDirectoryModel()->importDirectories($dirs); } @@ -209,7 +214,8 @@ public function importFiles($files) $file['directory_id'] = (isset($file['directory']) && strlen($file['directory'])) ? Mage::getModel( 'core/file_storage_directory_database', - array('connection' => $this->getConnectionName())) + array('connection' => $this->getConnectionName()) + ) ->loadByPath($file['directory'])->getId() : null; diff --git a/app/code/core/Mage/Core/Model/File/Storage/Database/Abstract.php b/app/code/core/Mage/Core/Model/File/Storage/Database/Abstract.php index 7868d7ccdf4..77b18a81143 100644 --- a/app/code/core/Mage/Core/Model/File/Storage/Database/Abstract.php +++ b/app/code/core/Mage/Core/Model/File/Storage/Database/Abstract.php @@ -24,20 +24,21 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Abstract database storage model class * * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getConnectionName() */ abstract class Mage_Core_Model_File_Storage_Database_Abstract extends Mage_Core_Model_File_Storage_Abstract { /** * Class construct * - * @param string $databaseConnection + * @param array $params */ public function __construct($params = array()) { @@ -68,10 +69,11 @@ public function getConfigConnectionName() /** * Get resource instance * - * @return Mage_Core_Model_Mysql4_Abstract + * @return Mage_Core_Model_Resource_File_Storage_Database */ protected function _getResource() { + /** @var Mage_Core_Model_Resource_File_Storage_Database $resource */ $resource = parent::_getResource(); $resource->setConnectionName($this->getConnectionName()); @@ -81,7 +83,7 @@ protected function _getResource() /** * Prepare data storage * - * @return Mage_Core_Model_File_Storage_Database + * @return $this */ public function prepareStorage() { @@ -93,8 +95,8 @@ public function prepareStorage() /** * Specify connection name * - * @param $connectionName - * @return Mage_Core_Model_File_Storage_Database + * @param string $connectionName + * @return $this */ public function setConnectionName($connectionName) { diff --git a/app/code/core/Mage/Core/Model/File/Storage/Directory/Database.php b/app/code/core/Mage/Core/Model/File/Storage/Directory/Database.php index f71c6e09172..408a3ae5c0c 100644 --- a/app/code/core/Mage/Core/Model/File/Storage/Directory/Database.php +++ b/app/code/core/Mage/Core/Model/File/Storage/Directory/Database.php @@ -24,13 +24,20 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Directory database storage model class * * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method Mage_Core_Model_Resource_File_Storage_Directory_Database _getResource() + * @method string getConnectionName() + * @method $this setName(string $value) + * @method string getPath() + * @method $this setPath(string $value) + * @method $this setParentId(string $value) + * @method $this setUploadTime(string $value) */ class Mage_Core_Model_File_Storage_Directory_Database extends Mage_Core_Model_File_Storage_Database_Abstract { @@ -51,7 +58,7 @@ class Mage_Core_Model_File_Storage_Directory_Database extends Mage_Core_Model_Fi /** * Class construct * - * @param string $databaseConnection + * @param string $connectionName */ public function __construct($connectionName = null) { @@ -119,7 +126,7 @@ public function getParentId() * Create directories recursively * * @param string $path - * @return $this + * @return Mage_Core_Model_File_Storage_Directory_Database */ public function createRecursive($path) { @@ -235,7 +242,7 @@ public function getSubdirectories($directory) /** * Delete directory from database * - * @param string $path + * @param string $dirPath * @return $this */ public function deleteDirectory($dirPath) diff --git a/app/code/core/Mage/Core/Model/File/Storage/File.php b/app/code/core/Mage/Core/Model/File/Storage/File.php index 7c033289b58..4383424feca 100644 --- a/app/code/core/Mage/Core/Model/File/Storage/File.php +++ b/app/code/core/Mage/Core/Model/File/Storage/File.php @@ -251,7 +251,7 @@ public function saveDir($dir) * * @param array|Mage_Core_Model_File_Storage_Database $file * @param bool $overwrite - * @return bool|int + * @return bool */ public function saveFile($file, $overwrite = true) { diff --git a/app/code/core/Mage/Core/Model/File/Uploader.php b/app/code/core/Mage/Core/Model/File/Uploader.php index 9390c35b4ec..9c942d66878 100644 --- a/app/code/core/Mage/Core/Model/File/Uploader.php +++ b/app/code/core/Mage/Core/Model/File/Uploader.php @@ -60,14 +60,14 @@ protected function _afterSave($result) return $this; } - /** @var $helper Mage_Core_Helper_File_Storage */ + /** @var Mage_Core_Helper_File_Storage $helper */ $helper = Mage::helper('core/file_storage'); if ($helper->isInternalStorage() || $this->skipDbProcessing()) { return $this; } - /** @var $dbHelper Mage_Core_Helper_File_Storage_Database */ + /** @var Mage_Core_Helper_File_Storage_Database $dbHelper */ $dbHelper = Mage::helper('core/file_storage_database'); $this->_result['file'] = $dbHelper->saveUploadedFile($result); @@ -98,7 +98,7 @@ public function skipDbProcessing($flag = null) public function checkAllowedExtension($extension) { //validate with protected file types - /** @var $validator Mage_Core_Model_File_Validator_NotProtectedExtension */ + /** @var Mage_Core_Model_File_Validator_NotProtectedExtension $validator */ $validator = Mage::getSingleton('core/file_validator_notProtectedExtension'); if (!$validator->isValid($extension)) { return false; diff --git a/app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php b/app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php index 7f88cd7f719..9ef06bcd178 100644 --- a/app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php +++ b/app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php @@ -82,7 +82,7 @@ protected function _initMessageTemplates() protected function _initProtectedFileExtensions() { if (!$this->_protectedFileExtensions) { - /** @var $helper Mage_Core_Helper_Data */ + /** @var Mage_Core_Helper_Data $helper */ $helper = Mage::helper('core'); $extensions = $helper->getProtectedFileExtensions(); if (is_string($extensions)) { diff --git a/app/code/core/Mage/Core/Model/Flag.php b/app/code/core/Mage/Core/Model/Flag.php index 2a5487e0155..716e0144702 100644 --- a/app/code/core/Mage/Core/Model/Flag.php +++ b/app/code/core/Mage/Core/Model/Flag.php @@ -31,11 +31,12 @@ * @method Mage_Core_Model_Resource_Flag _getResource() * @method Mage_Core_Model_Resource_Flag getResource() * @method string getFlagCode() - * @method Mage_Core_Model_Flag setFlagCode(string $value) + * @method $this setFlagCode(string $value) * @method int getState() - * @method Mage_Core_Model_Flag setState(int $value) + * @method $this setState(int $value) * @method string getLastUpdate() - * @method Mage_Core_Model_Flag setLastUpdate(string $value) + * @method $this setLastUpdate(string $value) + * @method bool hasFlagData() * * @category Mage * @package Mage_Core @@ -64,9 +65,7 @@ protected function _construct() } /** - * Processing object before save data - * - * @return $this + * @inheritDoc */ protected function _beforeSave() { diff --git a/app/code/core/Mage/Core/Model/Input/Filter.php b/app/code/core/Mage/Core/Model/Input/Filter.php index b3685f8df1f..a079ac761ac 100644 --- a/app/code/core/Mage/Core/Model/Input/Filter.php +++ b/app/code/core/Mage/Core/Model/Input/Filter.php @@ -30,7 +30,7 @@ * Model for multi-filtering all data which set to models * Example: * - * /** @var $filter Mage_Core_Model_Input_Filter {@*} + * /** @var Mage_Core_Model_Input_Filter $filter {@*} * $filter = Mage::getModel('core/input_filter'); * $filter->setFilters(array( * 'list_values' => array( @@ -304,7 +304,7 @@ protected function _getZendFilter($filterData) { $zendFilter = false; if (is_object($filterData) && $filterData instanceof Zend_Filter_Interface) { - /** @var $zendFilter Zend_Filter_Interface */ + /** @var Zend_Filter_Interface $zendFilter */ $zendFilter = $filterData; } elseif (isset($filterData['model'])) { $zendFilter = $this->_createCustomZendFilter($filterData); diff --git a/app/code/core/Mage/Core/Model/Language.php b/app/code/core/Mage/Core/Model/Language.php index 5ec4644a54a..4147e2dd2e4 100644 --- a/app/code/core/Mage/Core/Model/Language.php +++ b/app/code/core/Mage/Core/Model/Language.php @@ -25,7 +25,7 @@ */ -class Mage_Core_Model_Language extends Mage_Core_Model_Abstract +class Mage_Core_Model_Language extends Mage_Core_Model_Abstract { protected function _construct() { diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php index ca726021cf0..f15142739e3 100644 --- a/app/code/core/Mage/Core/Model/Layout.php +++ b/app/code/core/Mage/Core/Model/Layout.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Layout model * @@ -33,7 +32,6 @@ */ class Mage_Core_Model_Layout extends Varien_Simplexml_Config { - /** * Layout Update module * @@ -81,7 +79,7 @@ class Mage_Core_Model_Layout extends Varien_Simplexml_Config * * @param array $data */ - public function __construct($data=array()) + public function __construct($data = array()) { $this->_elementClass = Mage::getConfig()->getModelClassName('core/layout_element'); $this->setXml(simplexml_load_string('', $this->_elementClass)); @@ -188,9 +186,9 @@ public function generateXml() /** * Create layout blocks hierarchy from layout xml configuration * - * @param Mage_Core_Layout_Element|null $parent + * @param Mage_Core_Model_Layout_Element|null $parent */ - public function generateBlocks($parent=null) + public function generateBlocks($parent = null) { if (empty($parent)) { $parent = $this->getNode(); @@ -221,7 +219,7 @@ public function generateBlocks($parent=null) * Add block object to layout based on xml node data * * @param Varien_Simplexml_Element $node - * @param Varien_Simplexml_Element $parent + * @param Mage_Core_Model_Layout_Element $parent * @return $this */ protected function _generateBlock($node, $parent) @@ -284,7 +282,7 @@ protected function _generateBlock($node, $parent) * Enter description here... * * @param Varien_Simplexml_Element $node - * @param Varien_Simplexml_Element $parent + * @param Mage_Core_Model_Layout_Element $parent * @return $this */ protected function _generateAction($node, $parent) @@ -309,7 +307,6 @@ protected function _generateAction($node, $parent) $block = $this->getBlock($parentName); } if (!empty($block)) { - $args = (array)$node->children(); unset($args['@attributes']); @@ -327,7 +324,11 @@ protected function _generateAction($node, $parent) * if there is no helper we hope that this is assoc array */ $arr = array(); - foreach($arg as $subkey => $value) { + /** + * @var string $subkey + * @var Mage_Core_Model_Layout_Element $value + */ + foreach ($arg as $subkey => $value) { $arr[(string)$subkey] = $value->asArray(); } if (!empty($arr)) { @@ -404,6 +405,7 @@ protected function _translateLayoutNode($node, &$args) * * @param string $name * @param Mage_Core_Model_Layout $block + * @return $this */ public function setBlock($name, $block) { @@ -415,6 +417,7 @@ public function setBlock($name, $block) * Remove block from registry * * @param string $name + * @return $this */ public function unsetBlock($name) { @@ -429,9 +432,9 @@ public function unsetBlock($name) * @param string $type * @param string $name * @param array $attributes - * @return Mage_Core_Block_Abstract + * @return Mage_Core_Block_Abstract|false */ - public function createBlock($type, $name='', array $attributes = array()) + public function createBlock($type, $name = '', array $attributes = array()) { try { $block = $this->_getBlockInstance($type, $attributes); @@ -463,7 +466,7 @@ public function createBlock($type, $name='', array $attributes = array()) /** * Add a block to registry, create new object if needed * - * @param string|Mage_Core_Block_Abstract $blockClass + * @param string|Mage_Core_Block_Abstract $block * @param string $blockName * @return Mage_Core_Block_Abstract */ @@ -479,7 +482,7 @@ public function addBlock($block, $blockName) * @param array $attributes * @return Mage_Core_Block_Abstract */ - protected function _getBlockInstance($block, array $attributes=array()) + protected function _getBlockInstance($block, array $attributes = array()) { if (is_string($block)) { if (strpos($block, '/')!==false) { @@ -497,7 +500,6 @@ protected function _getBlockInstance($block, array $attributes=array()) return $block; } - /** * Retrieve all blocks from registry as array * @@ -512,7 +514,7 @@ public function getAllBlocks() * Get block object by name * * @param string $name - * @return Mage_Core_Block_Abstract + * @return Mage_Core_Block_Abstract|false */ public function getBlock($name) { @@ -528,14 +530,19 @@ public function getBlock($name) * * @param string $blockName * @param string $method + * @return $this */ - public function addOutputBlock($blockName, $method='toHtml') + public function addOutputBlock($blockName, $method = 'toHtml') { //$this->_output[] = array($blockName, $method); $this->_output[$blockName] = array($blockName, $method); return $this; } + /** + * @param string $blockName + * @return $this + */ public function removeOutputBlock($blockName) { unset($this->_output[$blockName]); @@ -577,7 +584,7 @@ public function getMessagesBlock() * Enter description here... * * @param string $type - * @return Mage_Core_Helper_Abstract + * @return Mage_Core_Block_Abstract */ public function getBlockSingleton($type) { @@ -602,7 +609,7 @@ public function getBlockSingleton($type) * Retrieve helper object * * @param string $name - * @return Mage_Core_Helper_Abstract + * @return Mage_Core_Helper_Abstract|false */ public function helper($name) { @@ -630,6 +637,7 @@ public static function findTranslationModuleName(Varien_Simplexml_Element $node) if ($result) { return (string)$result; } + /** @var Varien_Simplexml_Element $element */ foreach (array_reverse($node->xpath('ancestor::*[@module]')) as $element) { $result = $element->getAttribute('module'); if ($result) { diff --git a/app/code/core/Mage/Core/Model/Layout/Element.php b/app/code/core/Mage/Core/Model/Layout/Element.php index 9e0c15f2dcb..2beafbf2b84 100644 --- a/app/code/core/Mage/Core/Model/Layout/Element.php +++ b/app/code/core/Mage/Core/Model/Layout/Element.php @@ -24,9 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Layout_Element extends Varien_Simplexml_Element { + /** + * @param array $args + * @return $this + */ public function prepare($args) { switch ($this->getName()) { @@ -65,6 +68,9 @@ public function prepare($args) return $this; } + /** + * @return false|string + */ public function getBlockName() { $tagName = (string)$this->getName(); @@ -74,6 +80,10 @@ public function getBlockName() return (string)$this['name']; } + /** + * @param array $args + * @return $this + */ public function prepareBlock($args) { $type = (string)$this['type']; @@ -93,11 +103,19 @@ public function prepareBlock($args) return $this; } + /** + * @param array $args + * @return $this + */ public function prepareReference($args) { return $this; } + /** + * @param array $args + * @return $this + */ public function prepareAction($args) { $parent = $this->getParent(); @@ -106,9 +124,12 @@ public function prepareAction($args) return $this; } + /** + * @param array $args + * @return $this + */ public function prepareActionArgument($args) { return $this; } - } diff --git a/app/code/core/Mage/Core/Model/Layout/Update.php b/app/code/core/Mage/Core/Model/Layout/Update.php index 640159e0831..0d715cb0192 100644 --- a/app/code/core/Mage/Core/Model/Layout/Update.php +++ b/app/code/core/Mage/Core/Model/Layout/Update.php @@ -45,7 +45,7 @@ class Mage_Core_Model_Layout_Update protected $_elementClass; /** - * @var Simplexml_Element + * @var SimpleXMLElement */ protected $_packageLayout; @@ -87,12 +87,15 @@ class Mage_Core_Model_Layout_Update public function __construct() { $subst = Mage::getConfig()->getPathVars(); - foreach ($subst as $k=>$v) { + foreach ($subst as $k => $v) { $this->_subst['from'][] = '{{'.$k.'}}'; $this->_subst['to'][] = $v; } } + /** + * @return string + */ public function getElementClass() { if (!$this->_elementClass) { @@ -101,34 +104,54 @@ public function getElementClass() return $this->_elementClass; } + /** + * @return $this + */ public function resetUpdates() { $this->_updates = array(); return $this; } + /** + * @param string $update + * @return $this + */ public function addUpdate($update) { $this->_updates[] = $update; return $this; } + /** + * @return array + */ public function asArray() { return $this->_updates; } + /** + * @return string + */ public function asString() { return implode('', $this->_updates); } + /** + * @return $this + */ public function resetHandles() { $this->_handles = array(); return $this; } + /** + * @param string $handle + * @return $this + */ public function addHandle($handle) { if (is_array($handle)) { @@ -141,12 +164,19 @@ public function addHandle($handle) return $this; } + /** + * @param string $handle + * @return $this + */ public function removeHandle($handle) { unset($this->_handles[$handle]); return $this; } + /** + * @return array + */ public function getHandles() { return array_keys($this->_handles); @@ -177,6 +207,9 @@ public function setCacheId($cacheId) return $this; } + /** + * @return bool + */ public function loadCache() { if (!Mage::app()->useCache('layout')) { @@ -199,6 +232,9 @@ public function loadCache() return true; } + /** + * @return bool + */ public function saveCache() { if (!Mage::app()->useCache('layout')) { @@ -213,10 +249,10 @@ public function saveCache() Mage::app()->saveCache($hash, $this->getCacheId(), $tags, null); // Only save actual XML to cache if it doesn't already exist - if ( ! Mage::app()->testCache(self::XML_KEY_PREFIX . $hash)) { + if (!Mage::app()->testCache(self::XML_KEY_PREFIX . $hash)) { Mage::app()->saveCache($str, self::XML_KEY_PREFIX . $hash, $tags, null); } - return TRUE; + return true; } /** @@ -225,7 +261,7 @@ public function saveCache() * @param array|string $handles * @return $this */ - public function load($handles=array()) + public function load($handles = array()) { if (is_string($handles)) { $handles = array($handles); @@ -249,6 +285,9 @@ public function load($handles=array()) return $this; } + /** + * @return SimpleXMLElement + */ public function asSimplexml() { $updates = trim($this->asString()); @@ -275,6 +314,10 @@ public function merge($handle) return $this; } + /** + * @return $this + * @throws Mage_Core_Model_Store_Exception + */ public function fetchFileLayoutUpdates() { $storeId = Mage::app()->getStore()->getId(); @@ -360,6 +403,11 @@ public function fetchFileLayoutUpdates() return $this; } + /** + * @param string $handle + * @return bool + * @throws Mage_Core_Model_Store_Exception + */ public function fetchPackageLayoutUpdates($handle) { $_profilerKey = 'layout/package_update: '.$handle; @@ -367,6 +415,7 @@ public function fetchPackageLayoutUpdates($handle) if (empty($this->_packageLayout)) { $this->fetchFileLayoutUpdates(); } + /** @var Varien_Simplexml_Element $updateXml */ foreach ($this->_packageLayout->$handle as $updateXml) { #echo ''; $this->fetchRecursiveUpdates($updateXml); @@ -377,6 +426,10 @@ public function fetchPackageLayoutUpdates($handle) return true; } + /** + * @param string $handle + * @return bool + */ public function fetchDbLayoutUpdates($handle) { $_profilerKey = 'layout/db_update: '.$handle; @@ -388,6 +441,7 @@ public function fetchDbLayoutUpdates($handle) } $updateStr = '' . $updateStr . ''; $updateStr = str_replace($this->_subst['from'], $this->_subst['to'], $updateStr); + /** @var Varien_Simplexml_Element $updateXml */ $updateXml = simplexml_load_string($updateStr, $this->getElementClass()); $this->fetchRecursiveUpdates($updateXml); $this->addUpdate($updateXml->innerXml()); @@ -407,6 +461,10 @@ protected function _getUpdateString($handle) return Mage::getResourceModel('core/layout')->fetchUpdatesByHandle($handle); } + /** + * @param SimpleXMLElement $updateXml + * @return $this + */ public function fetchRecursiveUpdates($updateXml) { foreach ($updateXml->children() as $child) { @@ -426,14 +484,14 @@ public function fetchRecursiveUpdates($updateXml) * @param string $package * @param string $theme * @param integer|null $storeId - * @return Mage_Core_Model_Layout_Element + * @return SimpleXMLElement */ public function getFileLayoutUpdatesXml($area, $package, $theme, $storeId = null) { if (null === $storeId) { $storeId = Mage::app()->getStore()->getId(); } - /* @var $design Mage_Core_Model_Design_Package */ + /* @var Mage_Core_Model_Design_Package $design */ $design = Mage::getSingleton('core/design_package'); $layoutXml = null; $elementClass = $this->getElementClass(); @@ -469,6 +527,7 @@ public function getFileLayoutUpdatesXml($area, $package, $theme, $storeId = null } $fileStr = file_get_contents($filename); $fileStr = str_replace($this->_subst['from'], $this->_subst['to'], $fileStr); + /** @var Varien_Simplexml_Element $fileXml */ $fileXml = simplexml_load_string($fileStr, $elementClass); if (!$fileXml instanceof SimpleXMLElement) { continue; diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php index 848e8f64448..c0ab8b77a4d 100644 --- a/app/code/core/Mage/Core/Model/Locale.php +++ b/app/code/core/Mage/Core/Model/Locale.php @@ -89,6 +89,10 @@ class Mage_Core_Model_Locale protected static $_currencyCache = array(); + /** + * Mage_Core_Model_Locale constructor. + * @param string|null $locale + */ public function __construct($locale = null) { $this->setLocale($locale); @@ -229,7 +233,7 @@ public function getTranslatedOptionLocales() * @param bool $translatedName translation flag * @return array */ - protected function _getOptionLocales($translatedName=false) + protected function _getOptionLocales($translatedName = false) { $options = array(); $zendLocales = $this->getLocale()->getLocaleList(); @@ -288,7 +292,7 @@ public function getOptionTimezones() $options= array(); $zones = $this->getTranslationList('windowstotimezone'); ksort($zones); - foreach ($zones as $code=>$name) { + foreach ($zones as $code => $name) { $name = trim($name); $zonesList = explode(' ', $code); if (count($zonesList) == 1) { @@ -340,7 +344,7 @@ public function getOptionCountries() $options = array(); $countries = $this->getCountryTranslationList(); - foreach ($countries as $code=>$name) { + foreach ($countries as $code => $name) { $options[] = array( 'label' => $name, 'value' => $code, @@ -352,7 +356,7 @@ public function getOptionCountries() /** * Retrieve currency option list * - * @return unknown + * @return array */ public function getOptionCurrencies() { @@ -360,7 +364,7 @@ public function getOptionCurrencies() $options = array(); $allowed = $this->getAllowCurrencies(); - foreach ($currencies as $name=>$code) { + foreach ($currencies as $name => $code) { if (!in_array($code, $allowed)) { continue; } @@ -376,13 +380,13 @@ public function getOptionCurrencies() /** * Retrieve all currency option list * - * @return unknown + * @return array */ public function getOptionAllCurrencies() { $currencies = $this->getTranslationList('currencytoname'); $options = array(); - foreach ($currencies as $name=>$code) { + foreach ($currencies as $name => $code) { $options[] = array( 'label' => $name, 'value' => $code, @@ -391,6 +395,10 @@ public function getOptionAllCurrencies() return $this->_sortOptionArray($options); } + /** + * @param array $option + * @return array + */ protected function _sortOptionArray($option) { $data = array(); @@ -421,7 +429,7 @@ public function getAllowLocales() /** * Retrieve array of allowed currencies * - * @return unknown + * @return array */ public function getAllowCurrencies() { @@ -442,7 +450,7 @@ public function getAllowCurrencies() * @param string $type * @return string */ - public function getDateFormat($type=null) + public function getDateFormat($type = null) { return preg_replace('/(?getTranslation($type, 'date')); } @@ -454,8 +462,11 @@ public function getDateFormat($type=null) */ public function getDateFormatWithLongYear() { - return preg_replace('/(?getTranslation(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, 'date')); + return preg_replace( + '/(?getTranslation(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, 'date') + ); } /** @@ -464,7 +475,7 @@ public function getDateFormatWithLongYear() * @param string $type * @return string */ - public function getTimeFormat($type=null) + public function getTimeFormat($type = null) { return $this->getTranslation($type, 'time'); } @@ -534,13 +545,13 @@ public function date($date = null, $part = null, $locale = null, $useTimezone = /** * Create Zend_Date object with date converted to store timezone and store Locale * - * @param mixed $store Information about store + * @param null|string|bool|int|Mage_Core_Model_Store $store Information about store * @param string|integer|Zend_Date|array|null $date date in UTC * @param boolean $includeTime flag for including time to date * @param string|null $format * @return Zend_Date */ - public function storeDate($store=null, $date=null, $includeTime=false, $format = null) + public function storeDate($store = null, $date = null, $includeTime = false, $format = null) { $timezone = Mage::app()->getStore($store)->getConfig(self::XML_PATH_DEFAULT_TIMEZONE); $date = new Zend_Date($date, $format, $this->getLocale()); @@ -564,7 +575,7 @@ public function storeDate($store=null, $date=null, $includeTime=false, $format = * @param null|string $format * @return Zend_Date */ - public function utcDate($store=null, $date, $includeTime = false, $format = null) + public function utcDate($store = null, $date, $includeTime = false, $format = null) { $dateObj = $this->storeDate($store, $date, $includeTime); $dateObj->set($date, $format); @@ -579,7 +590,7 @@ public function utcDate($store=null, $date, $includeTime = false, $format = null * @param mixed $store * @return int */ - public function storeTimeStamp($store=null) + public function storeTimeStamp($store = null) { $timezone = Mage::app()->getStore($store)->getConfig(self::XML_PATH_DEFAULT_TIMEZONE); $currentTimezone = @date_default_timezone_get(); @@ -667,12 +678,10 @@ public function getNumber($value) if ($separatorComa > $separatorDot) { $value = str_replace('.', '', $value); $value = str_replace(',', '.', $value); - } - else { + } else { $value = str_replace(',', '', $value); } - } - elseif ($separatorComa !== false) { + } elseif ($separatorComa !== false) { $value = str_replace(',', '.', $value); } @@ -691,7 +700,7 @@ public function getJsPriceFormat() $symbols = Zend_Locale_Data::getList($this->getLocaleCode(), 'symbols'); $pos = strpos($format, ';'); - if ($pos !== false){ + if ($pos !== false) { $format = substr($format, 0, $pos); } $format = preg_replace("/[^0\#\.,]/", "", $format); @@ -705,7 +714,7 @@ public function getJsPriceFormat() $requiredPrecision = $totalPrecision; $t = substr($format, $decimalPoint); $pos = strpos($t, '#'); - if ($pos !== false){ + if ($pos !== false) { $requiredPrecision = strlen($t) - $pos - $totalPrecision; } $group = 0; @@ -742,8 +751,7 @@ public function emulate($storeId) $this->_locale = new Zend_Locale(Mage::getStoreConfig(self::XML_PATH_DEFAULT_LOCALE, $storeId)); $this->_localeCode = $this->_locale->toString(); Mage::getSingleton('core/translate')->setLocale($this->_locale)->init('frontend', true); - } - else { + } else { $this->_emulatedLocales[] = false; } } @@ -791,7 +799,7 @@ public function getTranslation($value = null, $path = null) /** * Replace all yy date format to yyyy * - * @param $currentFormat + * @param string $currentFormat * @return mixed */ protected function _convertYearTwoDigitTo4($currentFormat) @@ -802,8 +810,8 @@ protected function _convertYearTwoDigitTo4($currentFormat) /** * Returns the localized country name * - * @param string $value Name to get detailed information about - * @return array + * @param string $value Name to get detailed information about + * @return false|string */ public function getCountryTranslation($value) { @@ -844,10 +852,8 @@ public function isStoreDateInInterval($store, $dateFrom = null, $dateTo = null) $result = false; if (!is_empty_date($dateFrom) && $storeTimeStamp < $fromTimeStamp) { - } - elseif (!is_empty_date($dateTo) && $storeTimeStamp > $toTimeStamp) { - } - else { + } elseif (!is_empty_date($dateTo) && $storeTimeStamp > $toTimeStamp) { + } else { $result = true; } diff --git a/app/code/core/Mage/Core/Model/Log/Adapter.php b/app/code/core/Mage/Core/Model/Log/Adapter.php index 2305cb3ef7b..42f33e009ed 100644 --- a/app/code/core/Mage/Core/Model/Log/Adapter.php +++ b/app/code/core/Mage/Core/Model/Log/Adapter.php @@ -75,8 +75,7 @@ public function log($data = null) { if ($data === null) { $data = $this->_data; - } - else { + } else { if (!is_array($data)) { $data = array($data); } @@ -97,10 +96,9 @@ public function log($data = null) */ public function setData($key, $value = null) { - if(is_array($key)) { + if (is_array($key)) { $this->_data = $key; - } - else { + } else { $this->_data[$key] = $value; } return $this; @@ -133,8 +131,7 @@ protected function _filterDebugData($debugData) foreach ($debugData as $key => $value) { if (in_array($key, $this->_debugReplacePrivateDataKeys)) { $debugData[$key] = '****'; - } - else { + } else { if (is_array($debugData[$key])) { $debugData[$key] = $this->_filterDebugData($debugData[$key]); } diff --git a/app/code/core/Mage/Core/Model/Message.php b/app/code/core/Mage/Core/Model/Message.php index 8b441f44be5..242a98ae751 100644 --- a/app/code/core/Mage/Core/Model/Message.php +++ b/app/code/core/Mage/Core/Model/Message.php @@ -37,17 +37,24 @@ class Mage_Core_Model_Message const WARNING = 'warning'; const NOTICE = 'notice'; const SUCCESS = 'success'; - - protected function _factory($code, $type, $class='', $method='') + + /** + * @param string $code + * @param string $type + * @param string $class + * @param string $method + * @return Mage_Core_Model_Message_Error|Mage_Core_Model_Message_Notice|Mage_Core_Model_Message_Success|Mage_Core_Model_Message_Warning + */ + protected function _factory($code, $type, $class = '', $method = '') { switch (strtolower($type)) { - case self::ERROR : + case self::ERROR: $message = new Mage_Core_Model_Message_Error($code); break; - case self::WARNING : + case self::WARNING: $message = new Mage_Core_Model_Message_Warning($code); break; - case self::SUCCESS : + case self::SUCCESS: $message = new Mage_Core_Model_Message_Success($code); break; default: @@ -59,23 +66,47 @@ protected function _factory($code, $type, $class='', $method='') return $message; } - - public function error($code, $class='', $method='') + + /** + * @param string $code + * @param string $class + * @param string $method + * @return Mage_Core_Model_Message_Error|Mage_Core_Model_Message_Notice|Mage_Core_Model_Message_Success|Mage_Core_Model_Message_Warning + */ + public function error($code, $class = '', $method = '') { return $this->_factory($code, self::ERROR, $class, $method); } - public function warning($code, $class='', $method='') + /** + * @param string $code + * @param string $class + * @param string $method + * @return Mage_Core_Model_Message_Error|Mage_Core_Model_Message_Notice|Mage_Core_Model_Message_Success|Mage_Core_Model_Message_Warning + */ + public function warning($code, $class = '', $method = '') { return $this->_factory($code, self::WARNING, $class, $method); } - public function notice($code, $class='', $method='') + /** + * @param string $code + * @param string $class + * @param string $method + * @return Mage_Core_Model_Message_Error|Mage_Core_Model_Message_Notice|Mage_Core_Model_Message_Success|Mage_Core_Model_Message_Warning + */ + public function notice($code, $class = '', $method = '') { return $this->_factory($code, self::NOTICE, $class, $method); } - public function success($code, $class='', $method='') + /** + * @param string $code + * @param string $class + * @param string $method + * @return Mage_Core_Model_Message_Error|Mage_Core_Model_Message_Notice|Mage_Core_Model_Message_Success|Mage_Core_Model_Message_Warning + */ + public function success($code, $class = '', $method = '') { return $this->_factory($code, self::SUCCESS, $class, $method); } diff --git a/app/code/core/Mage/Core/Model/Message/Abstract.php b/app/code/core/Mage/Core/Model/Message/Abstract.php index aa00cd11836..802c3b889d3 100644 --- a/app/code/core/Mage/Core/Model/Message/Abstract.php +++ b/app/code/core/Mage/Core/Model/Message/Abstract.php @@ -40,37 +40,64 @@ abstract class Mage_Core_Model_Message_Abstract protected $_identifier; protected $_isSticky = false; - public function __construct($type, $code='') + /** + * Mage_Core_Model_Message_Abstract constructor. + * @param string $type + * @param string $code + */ + public function __construct($type, $code = '') { $this->_type = $type; $this->_code = $code; } + /** + * @return string + */ public function getCode() { return $this->_code; } + /** + * @return string + */ public function getText() { return $this->getCode(); } + /** + * @return string + */ public function getType() { return $this->_type; } + /** + * @param string $class + * @return $this + */ public function setClass($class) { $this->_class = $class; + return $this; } + /** + * @param string $method + * @return $this + */ public function setMethod($method) { $this->_method = $method; + return $this; } + /** + * @return string + */ public function toString() { $out = $this->getType().': '.$this->getText(); diff --git a/app/code/core/Mage/Core/Model/Message/Collection.php b/app/code/core/Mage/Core/Model/Message/Collection.php index 76f83637b2b..aadece075c8 100644 --- a/app/code/core/Mage/Core/Model/Message/Collection.php +++ b/app/code/core/Mage/Core/Model/Message/Collection.php @@ -115,6 +115,9 @@ public function getMessageByIdentifier($identifier) } } + /** + * @param string $identifier + */ public function deleteMessageByIdentifier($identifier) { foreach ($this->_messages as $type => $messages) { @@ -135,7 +138,7 @@ public function deleteMessageByIdentifier($identifier) * @param string $type * @return array */ - public function getItems($type=null) + public function getItems($type = null) { if ($type) { return isset($this->_messages[$type]) ? $this->_messages[$type] : array(); @@ -170,6 +173,9 @@ public function getErrors() return $this->getItemsByType(Mage_Core_Model_Message::ERROR); } + /** + * @return string + */ public function toString() { $out = ''; @@ -184,9 +190,10 @@ public function toString() /** * Retrieve messages count * + * @param string|null $type * @return int */ - public function count($type=null) + public function count($type = null) { if ($type) { if (isset($this->_messages[$type])) { diff --git a/app/code/core/Mage/Core/Model/Message/Error.php b/app/code/core/Mage/Core/Model/Message/Error.php index 84e8e24c011..04da921142a 100644 --- a/app/code/core/Mage/Core/Model/Message/Error.php +++ b/app/code/core/Mage/Core/Model/Message/Error.php @@ -24,9 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Message_Error extends Mage_Core_Model_Message_Abstract { + /** + * @param string $code + */ public function __construct($code) { parent::__construct(Mage_Core_Model_Message::ERROR, $code); diff --git a/app/code/core/Mage/Core/Model/Message/Notice.php b/app/code/core/Mage/Core/Model/Message/Notice.php index c5d93016f16..f5d074032be 100644 --- a/app/code/core/Mage/Core/Model/Message/Notice.php +++ b/app/code/core/Mage/Core/Model/Message/Notice.php @@ -24,9 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Message_Notice extends Mage_Core_Model_Message_Abstract { + /** + * Mage_Core_Model_Message_Notice constructor. + * @param string $code + */ public function __construct($code) { parent::__construct(Mage_Core_Model_Message::NOTICE, $code); diff --git a/app/code/core/Mage/Core/Model/Message/Success.php b/app/code/core/Mage/Core/Model/Message/Success.php index 2f7b4e02b76..621d6d04d93 100644 --- a/app/code/core/Mage/Core/Model/Message/Success.php +++ b/app/code/core/Mage/Core/Model/Message/Success.php @@ -24,9 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Message_Success extends Mage_Core_Model_Message_Abstract { + /** + * @param string $code + */ public function __construct($code) { parent::__construct(Mage_Core_Model_Message::SUCCESS, $code); diff --git a/app/code/core/Mage/Core/Model/Message/Warning.php b/app/code/core/Mage/Core/Model/Message/Warning.php index 71b0836ec2f..2121652cf59 100644 --- a/app/code/core/Mage/Core/Model/Message/Warning.php +++ b/app/code/core/Mage/Core/Model/Message/Warning.php @@ -24,9 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Message_Warning extends Mage_Core_Model_Message_Abstract { + /** + * @param string $code + */ public function __construct($code) { parent::__construct(Mage_Core_Model_Message::WARNING, $code); diff --git a/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php index 361c109d652..6b691c61052 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php @@ -24,8 +24,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -class Mage_Core_Model_Mysql4_Design_Theme extends Varien_Directory_Collection +/** + * @method array getData(string $value) + * @method $this setData(string $value, array $value) + */ +class Mage_Core_Model_Mysql4_Design_Theme_Collection extends Varien_Directory_Collection { + /** + * @return $this + */ public function load() { $packages = $this->getData('themes'); @@ -37,6 +44,9 @@ public function load() return $this; } + /** + * @return array + */ public function toOptionArray() { $options = array(); diff --git a/app/code/core/Mage/Core/Model/Mysql4/File/Storage/Abstract.php b/app/code/core/Mage/Core/Model/Mysql4/File/Storage/Abstract.php index 65dd45abf25..7f9407a2c7a 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/File/Storage/Abstract.php +++ b/app/code/core/Mage/Core/Model/Mysql4/File/Storage/Abstract.php @@ -26,7 +26,7 @@ /** - * Abstract storage resourse model + * Abstract storage resource model * * @category Mage * @package Mage_Core diff --git a/app/code/core/Mage/Core/Model/Observer.php b/app/code/core/Mage/Core/Model/Observer.php index cdf9c243b38..69b5d60d93b 100644 --- a/app/code/core/Mage/Core/Model/Observer.php +++ b/app/code/core/Mage/Core/Model/Observer.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core Observer model * @@ -115,7 +114,7 @@ public function cleanCache(Mage_Cron_Model_Schedule $schedule) */ public function cleanCacheByTags(Varien_Event_Observer $observer) { - /** @var $tags array */ + /** @var array $tags */ $tags = $observer->getEvent()->getTags(); if (empty($tags)) { Mage::app()->cleanCache(); diff --git a/app/code/core/Mage/Core/Model/Resource.php b/app/code/core/Mage/Core/Model/Resource.php index a343a69870e..3a872a989b7 100644 --- a/app/code/core/Mage/Core/Model/Resource.php +++ b/app/code/core/Mage/Core/Model/Resource.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Resources and connections registry and factory * @@ -50,7 +49,7 @@ class Mage_Core_Model_Resource /** * Instances of actual connections * - * @var array + * @var Varien_Db_Adapter_Interface[]|false */ protected $_connections = array(); @@ -79,7 +78,7 @@ class Mage_Core_Model_Resource * Creates a connection to resource whenever needed * * @param string $name - * @return Varien_Db_Adapter_Interface + * @return Varien_Db_Adapter_Interface|false */ public function getConnection($name) { @@ -91,6 +90,7 @@ public function getConnection($name) } return $connection; } + /** @var Mage_Core_Model_Config_Element $connConfig */ $connConfig = Mage::getConfig()->getResourceConnectionConfig($name); if (!$connConfig) { @@ -127,7 +127,7 @@ public function getConnection($name) /** * Get Instances of actual connections * - * @return array + * @return Varien_Db_Adapter_Interface[]|false */ public function getConnections() { @@ -232,7 +232,7 @@ public function getConnectionTypeInstance($type) * * @param string $model * @param string $entity - * @return Varien_Simplexml_Config + * @return SimpleXMLElement|Varien_Simplexml_Config */ public function getEntity($model, $entity) { @@ -344,7 +344,7 @@ public function cleanDbRow(&$row) { $zeroDate = $this->getConnection(self::DEFAULT_READ_RESOURCE)->getSuggestedZeroDate(); if (!empty($row) && is_array($row)) { - foreach ($row as $key=>&$value) { + foreach ($row as $key => &$value) { if (is_string($value) && $value === $zeroDate) { $value = ''; } @@ -359,7 +359,7 @@ public function cleanDbRow(&$row) * @param string $name * @param string $type * @param array $config - * @return unknown + * @return Varien_Db_Adapter_Interface */ public function createConnection($name, $type, $config) { @@ -378,12 +378,19 @@ public function checkDbConnection() } } + /** + * @return int + */ public function getAutoUpdate() { return self::AUTO_UPDATE_ALWAYS; #return Mage::app()->loadCache(self::AUTO_UPDATE_CACHE_KEY); } + /** + * @param mixed $value + * @return $this + */ public function setAutoUpdate($value) { #Mage::app()->saveCache($value, self::AUTO_UPDATE_CACHE_KEY); @@ -415,7 +422,11 @@ public function getIdxName($tableName, $fields, $indexType = Varien_Db_Adapter_I public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName) { return $this->getConnection(self::DEFAULT_READ_RESOURCE) - ->getForeignKeyName($this->getTableName($priTableName), $priColumnName, - $this->getTableName($refTableName), $refColumnName); + ->getForeignKeyName( + $this->getTableName($priTableName), + $priColumnName, + $this->getTableName($refTableName), + $refColumnName + ); } } diff --git a/app/code/core/Mage/Core/Model/Resource/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Abstract.php index 58021d754e9..c87a7028172 100644 --- a/app/code/core/Mage/Core/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Abstract.php @@ -58,18 +58,20 @@ abstract protected function _construct(); /** * Retrieve connection for read data + * @return Varien_Db_Adapter_Interface */ abstract protected function _getReadAdapter(); /** * Retrieve connection for write data + * @return Varien_Db_Adapter_Interface */ abstract protected function _getWriteAdapter(); /** * Start resource transaction * - * @return Mage_Core_Model_Resource_Abstract + * @return $this */ public function beginTransaction() { @@ -80,8 +82,8 @@ public function beginTransaction() /** * Subscribe some callback to transaction commit * - * @param callback $callback - * @return Mage_Core_Model_Resource_Abstract + * @param callable $callback + * @return $this */ public function addCommitCallback($callback) { @@ -93,7 +95,7 @@ public function addCommitCallback($callback) /** * Commit resource transaction * - * @return Mage_Core_Model_Resource_Abstract + * @return $this */ public function commit() { @@ -117,7 +119,7 @@ public function commit() /** * Roll back resource transaction * - * @return Mage_Core_Model_Resource_Abstract + * @return $this */ public function rollBack() { @@ -134,11 +136,11 @@ public function rollBack() /** * Format date to internal format * - * @param string|Zend_Date $date + * @param string|Zend_Date|true|null $date * @param bool $includeTime - * @return string + * @return string|null */ - public function formatDate($date, $includeTime=true) + public function formatDate($date, $includeTime = true) { return Varien_Date::formatDate($date, $includeTime); } @@ -161,7 +163,7 @@ public function mktime($str) * @param string $field * @param mixed $defaultValue * @param bool $unsetEmpty - * @return Mage_Core_Model_Resource_Abstract + * @return $this */ protected function _serializeField(Varien_Object $object, $field, $defaultValue = null, $unsetEmpty = false) { @@ -185,7 +187,7 @@ protected function _serializeField(Varien_Object $object, $field, $defaultValue /** * Unserialize Varien_Object field in an object * - * @param Mage_Core_Model_Abstract $object + * @param Varien_Object $object * @param string $field * @param mixed $defaultValue */ @@ -219,7 +221,7 @@ protected function _prepareDataForTable(Varien_Object $object, $table) if (null !== $fieldValue) { $fieldValue = $this->_prepareTableValueForSave($fieldValue, $fields[$field]['DATA_TYPE']); $data[$field] = $this->_getWriteAdapter()->prepareColumnValue($fields[$field], $fieldValue); - } else if (!empty($fields[$field]['NULLABLE'])) { + } elseif (!empty($fields[$field]['NULLABLE'])) { $data[$field] = null; } } diff --git a/app/code/core/Mage/Core/Model/Resource/Config.php b/app/code/core/Mage/Core/Model/Resource/Config.php index 1467f0424b0..ff517bf8634 100644 --- a/app/code/core/Mage/Core/Model/Resource/Config.php +++ b/app/code/core/Mage/Core/Model/Resource/Config.php @@ -107,7 +107,7 @@ public function loadToXml(Mage_Core_Model_Config $xmlConfig, $condition = null) // inherit default config values to all websites $extendSource = $xmlConfig->getNode('default'); - foreach ($websites as $id=>$w) { + foreach ($websites as $id => $w) { $websiteNode = $xmlConfig->getNode('websites/' . $w['code']); $websiteNode->extend($extendSource); } diff --git a/app/code/core/Mage/Core/Model/Resource/Config/Data.php b/app/code/core/Mage/Core/Model/Resource/Config/Data.php index b2e794f367c..408e4fbd5b6 100644 --- a/app/code/core/Mage/Core/Model/Resource/Config/Data.php +++ b/app/code/core/Mage/Core/Model/Resource/Config/Data.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core config data resource model * @@ -46,8 +45,8 @@ protected function _construct() /** * Convert array to comma separated value * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Config_Data $object + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { @@ -66,7 +65,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) * Set id to object if exists configuration instead of throw exception * * @param Mage_Core_Model_Config_Data $object - * @return $this + * @inheritDoc */ protected function _checkUnique(Mage_Core_Model_Abstract $object) { diff --git a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php index 5b19c652bae..7204451d9a8 100644 --- a/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Abstract resource model class * @@ -172,20 +171,20 @@ protected function _setResource($connections, $tables = null) $this->_resources = Mage::getSingleton('core/resource'); if (is_array($connections)) { - foreach ($connections as $k=>$v) { + foreach ($connections as $k => $v) { $this->_connections[$k] = $this->_resources->getConnection($v); } - } else if (is_string($connections)) { + } elseif (is_string($connections)) { $this->_resourcePrefix = $connections; } if (is_null($tables) && is_string($connections)) { $this->_resourceModel = $this->_resourcePrefix; - } else if (is_array($tables)) { + } elseif (is_array($tables)) { foreach ($tables as $k => $v) { $this->_tables[$k] = $this->_resources->getTableName($v); } - } else if (is_string($tables)) { + } elseif (is_string($tables)) { $this->_resourceModel = $tables; } return $this; @@ -197,7 +196,7 @@ protected function _setResource($connections, $tables = null) * * @param string $mainTable * @param string|null $idFieldName - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ protected function _setMainTable($mainTable, $idFieldName = null) { @@ -273,7 +272,7 @@ public function getTable($entityName) $modelEntity = $entityName; } $this->_tables[$cacheName] = $this->_resources->getTableName($modelEntity); - } else if (!empty($this->_resourceModel)) { + } elseif (!empty($this->_resourceModel)) { $entityName = sprintf('%s/%s', $this->_resourceModel, $entityName); if (!is_null($entitySuffix)) { $modelEntity = array($entityName, $entitySuffix); @@ -307,7 +306,7 @@ public function getValueTable($entityName, $valueType) * Get connection by name or type * * @param string $connectionName - * @return Zend_Db_Adapter_Abstract + * @return Magento_Db_Adapter_Pdo_Mysql */ protected function _getConnection($connectionName) { @@ -316,7 +315,8 @@ protected function _getConnection($connectionName) } if (!empty($this->_resourcePrefix)) { $this->_connections[$connectionName] = $this->_resources->getConnection( - $this->_resourcePrefix . '_' . $connectionName); + $this->_resourcePrefix . '_' . $connectionName + ); } else { $this->_connections[$connectionName] = $this->_resources->getConnection($connectionName); } @@ -327,7 +327,7 @@ protected function _getConnection($connectionName) /** * Retrieve connection for read data * - * @return Varien_Db_Adapter_Interface + * @return Magento_Db_Adapter_Pdo_Mysql */ protected function _getReadAdapter() { @@ -342,7 +342,7 @@ protected function _getReadAdapter() /** * Retrieve connection for write data * - * @return Varien_Db_Adapter_Interface + * @return Magento_Db_Adapter_Pdo_Mysql */ protected function _getWriteAdapter() { @@ -365,7 +365,7 @@ public function getReadConnection() * @param Mage_Core_Model_Abstract $object * @param mixed $value * @param string $field field to load by (defaults to model id) - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) { @@ -395,7 +395,7 @@ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) * @param string $field * @param mixed $value * @param Mage_Core_Model_Abstract $object - * @return Zend_Db_Select + * @return Varien_Db_Select */ protected function _getLoadSelect($field, $value, $object) { @@ -412,7 +412,7 @@ protected function _getLoadSelect($field, $value, $object) * Save object object data * * @param Mage_Core_Model_Abstract $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ public function save(Mage_Core_Model_Abstract $object) { @@ -472,7 +472,7 @@ public function save(Mage_Core_Model_Abstract $object) * * @deprecated * @param Mage_Core_Model_Abstract $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ public function forsedSave(Mage_Core_Model_Abstract $object) { @@ -497,8 +497,8 @@ public function forsedSave(Mage_Core_Model_Abstract $object) /** * Delete the object * - * @param Varien_Object $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Abstract $object + * @return $this */ public function delete(Mage_Core_Model_Abstract $object) { @@ -515,14 +515,14 @@ public function delete(Mage_Core_Model_Abstract $object) * Add unique field restriction * * @param array|string $field - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ public function addUniqueField($field) { if (is_null($this->_uniqueFields)) { $this->_initUniqueFields(); } - if (is_array($this->_uniqueFields) ) { + if (is_array($this->_uniqueFields)) { $this->_uniqueFields[] = $field; } return $this; @@ -531,7 +531,7 @@ public function addUniqueField($field) /** * Reset unique fields restrictions * - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ public function resetUniqueField() { @@ -555,7 +555,7 @@ public function unserializeFields(Mage_Core_Model_Abstract $object) /** * Initialize unique fields * - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this */ protected function _initUniqueFields() { @@ -626,7 +626,7 @@ protected function _prepareValueForSave($value, $type) * Check for unique values existence * * @param Mage_Core_Model_Abstract $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @return $this * @throws Mage_Core_Exception */ protected function _checkUnique(Mage_Core_Model_Abstract $object) @@ -669,7 +669,7 @@ protected function _checkUnique(Mage_Core_Model_Abstract $object) } if (!empty($existent)) { - if (count($existent) == 1 ) { + if (count($existent) == 1) { $error = Mage::helper('core')->__('%s already exists.', $existent[0]); } else { $error = Mage::helper('core')->__('%s already exist.', implode(', ', $existent)); @@ -692,8 +692,8 @@ public function afterLoad(Mage_Core_Model_Abstract $object) /** * Perform actions after object load * - * @param Varien_Object $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Abstract $object + * @return $this */ protected function _afterLoad(Mage_Core_Model_Abstract $object) { @@ -703,8 +703,8 @@ protected function _afterLoad(Mage_Core_Model_Abstract $object) /** * Perform actions before object save * - * @param Varien_Object $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Abstract $object + * @return $this */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { @@ -714,8 +714,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) /** * Perform actions after object save * - * @param Varien_Object $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Abstract $object + * @return $this */ protected function _afterSave(Mage_Core_Model_Abstract $object) { @@ -725,8 +725,8 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) /** * Perform actions before object delete * - * @param Varien_Object $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Abstract $object + * @return $this */ protected function _beforeDelete(Mage_Core_Model_Abstract $object) { @@ -736,8 +736,8 @@ protected function _beforeDelete(Mage_Core_Model_Abstract $object) /** * Perform actions after object delete * - * @param Varien_Object $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Abstract $object + * @return $this */ protected function _afterDelete(Mage_Core_Model_Abstract $object) { @@ -761,7 +761,7 @@ protected function _serializeFields(Mage_Core_Model_Abstract $object) * Retrieve table checksum * * @param string|array $table - * @return int|array + * @return array|false */ public function getChecksum($table) { @@ -774,5 +774,4 @@ public function getChecksum($table) } return $checksum; } - } diff --git a/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php index 70b38ae88d3..13a499ba42e 100644 --- a/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Abstract Core Resource Collection * @@ -141,7 +140,6 @@ public function __construct($resource = null) */ protected function _construct() { - } /** @@ -162,7 +160,7 @@ public function getMainTable() * Set main collection table * * @param string $table - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function setMainTable($table) { @@ -185,7 +183,7 @@ public function setMainTable($table) /** * Init collection select * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _initSelect() { @@ -210,7 +208,7 @@ public function getSelect() /** * Init fields for select * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _initSelectFields() { @@ -253,7 +251,6 @@ protected function _initSelectFields() $columnEntry = array('main_table', $field, $alias); array_splice($columns, $insertIndex, 0, array($columnEntry)); // Insert column $insertIndex ++; - } } else { array_unshift($columns, array('main_table', '*', null)); @@ -282,7 +279,7 @@ protected function _getInitialFieldsToSelect() /** * Initialize initial fields to select like id field * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _initInitialFieldsToSelect() { @@ -298,7 +295,7 @@ protected function _initInitialFieldsToSelect() * * @param string|array $field * @param string|null $alias - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function addFieldToSelect($field, $alias = null) { @@ -344,7 +341,7 @@ public function addFieldToSelect($field, $alias = null) * @param string $alias * @param string $expression * @param array $fields - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function addExpressionFieldToSelect($alias, $expression, $fields) { @@ -354,7 +351,7 @@ public function addExpressionFieldToSelect($alias, $expression, $fields) } $fullExpression = $expression; - foreach ($fields as $fieldKey=>$fieldItem) { + foreach ($fields as $fieldKey => $fieldItem) { $fullExpression = str_replace('{{' . $fieldKey . '}}', $fieldItem, $fullExpression); } @@ -368,7 +365,7 @@ public function addExpressionFieldToSelect($alias, $expression, $fields) * * @param string|null $field * @param boolean $isAlias Alias identifier - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function removeFieldFromSelect($field, $isAlias = false) { @@ -392,7 +389,7 @@ public function removeFieldFromSelect($field, $isAlias = false) /** * Removes all fields from select * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function removeAllFieldsFromSelect() { @@ -406,7 +403,7 @@ public function removeAllFieldsFromSelect() * * @param string $model * @param Mage_Core_Model_Resource_Db_Abstract $resourceModel - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _init($model, $resourceModel = null) { @@ -422,7 +419,7 @@ protected function _init($model, $resourceModel = null) * Set model name for collection items * * @param string $model - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function setModel($model) { @@ -437,7 +434,7 @@ public function setModel($model) * Get model instance * * @param array $args - * @return Varien_Object + * @return string */ public function getModelName($args = array()) { @@ -505,11 +502,12 @@ public function getAllIds() return $this->getConnection()->fetchCol($idsSelect); } + /** + * @return array + */ public function getData() { if ($this->_data === null) { - - $this->_renderFilters() ->_renderOrders() ->_renderLimit(); @@ -527,10 +525,13 @@ public function getData() /** * Prepare select for load * + * @param Varien_Db_Select $select * @return string + * @throws Zend_Db_Select_Exception */ protected function _prepareSelect(Varien_Db_Select $select) { + /** @var Mage_Core_Model_Resource_Helper_Mysql4 $helper */ $helper = Mage::getResourceHelper('core'); $unionParts = $select->getPart(Zend_Db_Select::UNION); @@ -550,7 +551,7 @@ protected function _prepareSelect(Varien_Db_Select $select) * @param string $table * @param string $cond * @param string $cols - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function join($table, $cond, $cols = '*') { @@ -578,7 +579,7 @@ public function join($table, $cond, $cols = '*') /** * Redeclare before load method for adding event * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _beforeLoad() { @@ -596,7 +597,7 @@ protected function _beforeLoad() * Set reset items data changed flag * * @param boolean $flag - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function setResetItemsDataChanged($flag) { @@ -607,10 +608,11 @@ public function setResetItemsDataChanged($flag) /** * Set flag data has changed to all collection items * - * @return Mage_Core_Model_Mysql4_Collection_Abstract + * @return $this */ public function resetItemsDataChanged() { + /** @var Varien_Object $item */ foreach ($this->_items as $item) { $item->setDataChanges(false); } @@ -621,11 +623,12 @@ public function resetItemsDataChanged() /** * Redeclare after load method for specifying collection items original data * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _afterLoad() { parent::_afterLoad(); + /** @var Varien_Object $item */ foreach ($this->_items as $item) { $item->setOrigData(); if ($this->_resetItemsDataChanged) { @@ -644,7 +647,7 @@ protected function _afterLoad() /** * Save all the entities in the collection * - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ public function save() { @@ -681,7 +684,7 @@ protected function _loadCache($select) * * @param array $data * @param Zend_Db_Select $select - * @return Mage_Core_Model_Resource_Db_Collection_Abstract + * @return $this */ protected function _saveCache($data, $select) { @@ -713,7 +716,4 @@ public function formatDate($date, $includeTime = true) { return Varien_Date::formatDate($date, $includeTime); } - - - } diff --git a/app/code/core/Mage/Core/Model/Resource/Design.php b/app/code/core/Mage/Core/Model/Resource/Design.php index 785ed92df3e..24340b29cfd 100644 --- a/app/code/core/Mage/Core/Model/Resource/Design.php +++ b/app/code/core/Mage/Core/Model/Resource/Design.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core Design Resource Model * @@ -44,11 +43,8 @@ protected function _construct() } /** - * Perform actions before object save - * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Core_Model_Resource_Db_Abstract - * @throws Mage_Core_Exception + * @param Mage_Core_Model_Design $object + * @inheritDoc */ public function _beforeSave(Mage_Core_Model_Abstract $object) { @@ -73,7 +69,8 @@ public function _beforeSave(Mage_Core_Model_Abstract $object) if ($check) { Mage::throwException( - Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.')); + Mage::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range.') + ); } parent::_beforeSave($object); @@ -84,10 +81,10 @@ public function _beforeSave(Mage_Core_Model_Abstract $object) * Check intersections * * @param int $storeId - * @param date $dateFrom - * @param date $dateTo + * @param string $dateFrom + * @param string $dateTo * @param int $currentId - * @return Array + * @return string */ protected function _checkIntersection($storeId, $dateFrom, $dateTo, $currentId) { diff --git a/app/code/core/Mage/Core/Model/Resource/Design/Collection.php b/app/code/core/Mage/Core/Model/Resource/Design/Collection.php index 33b8089db54..58a3a8fd365 100644 --- a/app/code/core/Mage/Core/Model/Resource/Design/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Design/Collection.php @@ -50,10 +50,11 @@ protected function _construct() */ public function joinStore() { - return $this->join( + return $this->join( array('cs' => 'core/store'), 'cs.store_id = main_table.store_id', - array('cs.name')); + array('cs.name') + ); } /** diff --git a/app/code/core/Mage/Core/Model/Resource/Email/Queue.php b/app/code/core/Mage/Core/Model/Resource/Email/Queue.php index 857827661c6..5636fdbc97a 100644 --- a/app/code/core/Mage/Core/Model/Resource/Email/Queue.php +++ b/app/code/core/Mage/Core/Model/Resource/Email/Queue.php @@ -37,9 +37,8 @@ protected function _construct() /** * Load recipients, unserialize message parameters * - * @param Mage_Core_Model_Abstract $object - * - * @return $this + * @param Mage_Core_Model_Email_Queue $object + * @inheritDoc */ protected function _afterLoad(Mage_Core_Model_Abstract $object) { @@ -51,8 +50,8 @@ protected function _afterLoad(Mage_Core_Model_Abstract $object) /** * Prepare object data for saving * - * @param Mage_Core_Model_Email_Queue|Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Email_Queue $object + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { diff --git a/app/code/core/Mage/Core/Model/Resource/Email/Template.php b/app/code/core/Mage/Core/Model/Resource/Email/Template.php index e217f7b2bca..1f704859ef4 100644 --- a/app/code/core/Mage/Core/Model/Resource/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Resource/Email/Template.php @@ -96,7 +96,7 @@ public function checkCodeUsage(Mage_Core_Model_Email_Template $template) * Set template type, added at and modified at time * * @param Mage_Core_Model_Email_Template $object - * @return $this + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { diff --git a/app/code/core/Mage/Core/Model/Resource/Email/Template/Collection.php b/app/code/core/Mage/Core/Model/Resource/Email/Template/Collection.php index cdc730c05f1..20956327282 100644 --- a/app/code/core/Mage/Core/Model/Resource/Email/Template/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Email/Template/Collection.php @@ -32,7 +32,7 @@ * @package Mage_Core * @author Magento Core Team */ -class Mage_Core_Model_Resource_Email_Template_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract +class Mage_Core_Model_Resource_Email_Template_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract { /** * Template table name diff --git a/app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php b/app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php index 11c706df799..f3dfd20706b 100644 --- a/app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php +++ b/app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php @@ -81,13 +81,24 @@ public function createDatabaseScheme() ->addColumn('directory', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array( 'default' => null ), 'Directory Path') - ->addIndex($adapter->getIndexName($table, array('filename', 'directory_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('filename', 'directory_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) + ->addIndex( + $adapter->getIndexName( + $table, + array('filename', 'directory_id'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('filename', 'directory_id'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) ->addIndex($adapter->getIndexName($table, array('directory_id')), array('directory_id')) - ->addForeignKey($adapter->getForeignKeyName($table, 'directory_id', $dirStorageTable, 'directory_id'), - 'directory_id', $dirStorageTable, 'directory_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addForeignKey( + $adapter->getForeignKeyName($table, 'directory_id', $dirStorageTable, 'directory_id'), + 'directory_id', + $dirStorageTable, + 'directory_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('File Storage'); $adapter->createTable($ddlTable); @@ -298,7 +309,7 @@ public function deleteFolder($folderName = '') return; } - /* @var $resHelper Mage_Core_Model_Resource_Helper_Abstract */ + /* @var Mage_Core_Model_Resource_Helper_Abstract $resHelper */ $resHelper = Mage::getResourceHelper('core'); $likeExpression = $resHelper->addLikeEscape($folderName . '/', array('position' => 'start')); $this->_getWriteAdapter() diff --git a/app/code/core/Mage/Core/Model/Resource/File/Storage/Directory/Database.php b/app/code/core/Mage/Core/Model/Resource/File/Storage/Directory/Database.php index 3b7e747857c..99c01f82abe 100644 --- a/app/code/core/Mage/Core/Model/Resource/File/Storage/Directory/Database.php +++ b/app/code/core/Mage/Core/Model/Resource/File/Storage/Directory/Database.php @@ -45,7 +45,7 @@ protected function _construct() /** * Create database scheme for storing files * - * @return Mage_Core_Model_Mysql4_File_Storage_Database + * @return $this */ public function createDatabaseScheme() { @@ -76,13 +76,24 @@ public function createDatabaseScheme() 'default' => null, 'unsigned' => true ), 'Parent Directory Id') - ->addIndex($adapter->getIndexName($table, array('name', 'parent_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('name', 'parent_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) + ->addIndex( + $adapter->getIndexName( + $table, + array('name', 'parent_id'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('name', 'parent_id'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) ->addIndex($adapter->getIndexName($table, array('parent_id')), array('parent_id')) - ->addForeignKey($adapter->getForeignKeyName($table, 'parent_id', $table, 'directory_id'), - 'parent_id', $table, 'directory_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addForeignKey( + $adapter->getForeignKeyName($table, 'parent_id', $table, 'directory_id'), + 'parent_id', + $table, + 'directory_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Directory Storage'); $adapter->createTable($ddlTable); @@ -94,7 +105,7 @@ public function createDatabaseScheme() * * @param Mage_Core_Model_File_Storage_Directory_Database $object * @param string $path - * @return Mage_Core_Model_Mysql4_File_Storage_Directory_Database + * @return $this */ public function loadByPath(Mage_Core_Model_File_Storage_Directory_Database $object, $path) { @@ -150,7 +161,7 @@ public function getParentId($path) /** * Delete all directories from storage * - * @return Mage_Core_Model_Mysql4_File_Storage_Database + * @return $this */ public function clearDirectories() { diff --git a/app/code/core/Mage/Core/Model/Resource/File/Storage/File.php b/app/code/core/Mage/Core/Model/Resource/File/Storage/File.php index f2ea5c2b74d..7353e60db6f 100644 --- a/app/code/core/Mage/Core/Model/Resource/File/Storage/File.php +++ b/app/code/core/Mage/Core/Model/Resource/File/Storage/File.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Model for synchronization from DB to filesystem * @@ -109,7 +108,7 @@ public function getStorageData($dir = '') * Clear files and directories in storage * * @param string $dir - * @return Mage_Core_Model_Mysql4_File_Storage_File + * @return $this */ public function clear($dir = '') { @@ -193,7 +192,7 @@ public function saveDir($dir) public function saveFile($filePath, $content, $overwrite = false) { $filename = basename($filePath); - $path = $this->getMediaBaseDirectory() . DS . str_replace('/', DS ,dirname($filePath)); + $path = $this->getMediaBaseDirectory() . DS . str_replace('/', DS, dirname($filePath)); if (!is_dir($path)) { @mkdir($path, 0777, true); @@ -210,9 +209,8 @@ public function saveFile($filePath, $content, $overwrite = false) if (@fwrite($fp, $content) !== false && @fclose($fp)) { return true; } - } - // If overwrite is required, throw exception on failure to write file - else if (@file_put_contents($fullPath, $content, LOCK_EX) !== false) { + } // If overwrite is required, throw exception on failure to write file + elseif (@file_put_contents($fullPath, $content, LOCK_EX) !== false) { return true; } diff --git a/app/code/core/Mage/Core/Model/Resource/Helper/Abstract.php b/app/code/core/Mage/Core/Model/Resource/Helper/Abstract.php index 0334f96d6f1..a3425280193 100644 --- a/app/code/core/Mage/Core/Model/Resource/Helper/Abstract.php +++ b/app/code/core/Mage/Core/Model/Resource/Helper/Abstract.php @@ -101,7 +101,7 @@ protected function _getWriteAdapter() protected function _getConnection($name) { $connection = sprintf('%s_%s', $this->_modulePrefix, $name); - /** @var $resource Mage_Core_Model_Resource */ + /** @var Mage_Core_Model_Resource $resource */ $resource = Mage::getSingleton('core/resource'); return $resource->getConnection($connection); diff --git a/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php index 1b74a82d44f..92d25929432 100644 --- a/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/Core/Model/Resource/Helper/Mysql4.php @@ -37,7 +37,7 @@ class Mage_Core_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Resource_He * Returns expresion for field unification * * @param string $field - * @return Zend_Db_Expr + * @return string */ public function castField($field) { @@ -73,7 +73,7 @@ public function getQueryUsingAnalyticFunction(Varien_Db_Select $select) * * @param Varien_Db_Select $select * @param string $table - * @param array $table + * @param array $fields * @return string */ public function getInsertFromSelectUsingAnalytic(Varien_Db_Select $select, $table, $fields) @@ -261,7 +261,7 @@ protected function _assembleLimit($query, $limitCount, $limitOffset, $columnList * Prepare select column list * * @param Varien_Db_Select $select - * @param $groupByCondition OPTIONAL + * @param string $groupByCondition * @return array * @throws Zend_Db_Exception */ @@ -292,7 +292,7 @@ public function prepareColumnsList(Varien_Db_Select $select, $groupByCondition = throw new Zend_Db_Exception("Can't prepare expression when tableName is instance of Zend_Db_Expr"); } $tableColumns = $this->_getReadAdapter()->describeTable($tables[$correlationName]['tableName']); - foreach(array_keys($tableColumns) as $col) { + foreach (array_keys($tableColumns) as $col) { $preparedColumns[strtoupper($col)] = array($correlationName, $col, null); } } else { @@ -331,7 +331,7 @@ public function addGroupConcatColumn($select, $fieldAlias, $fields, $groupConcat } $separator = ''; if ($groupConcatDelimiter) { - $separator = sprintf(" SEPARATOR '%s'", $groupConcatDelimiter); + $separator = sprintf(" SEPARATOR '%s'", $groupConcatDelimiter); } $select->columns(array($fieldAlias => new Zend_Db_Expr(sprintf('GROUP_CONCAT(%s%s)', $fieldExpr, $separator)))); diff --git a/app/code/core/Mage/Core/Model/Resource/Iterator.php b/app/code/core/Mage/Core/Model/Resource/Iterator.php index f646e89282b..f0effd2bb36 100644 --- a/app/code/core/Mage/Core/Model/Resource/Iterator.php +++ b/app/code/core/Mage/Core/Model/Resource/Iterator.php @@ -40,7 +40,7 @@ class Mage_Core_Model_Resource_Iterator extends Varien_Object * @param Varien_Db_Adapter_Interface $adapter * @return $this */ - public function walk($query, array $callbacks, array $args=array(), $adapter = null) + public function walk($query, array $callbacks, array $args = array(), $adapter = null) { $stmt = $this->_getStatement($query, $adapter); $args['idx'] = 0; diff --git a/app/code/core/Mage/Core/Model/Resource/Layout.php b/app/code/core/Mage/Core/Model/Resource/Layout.php index 8219ba08568..285f8b0d57d 100644 --- a/app/code/core/Mage/Core/Model/Resource/Layout.php +++ b/app/code/core/Mage/Core/Model/Resource/Layout.php @@ -71,9 +71,11 @@ public function fetchUpdatesByHandle($handle, $params = array()) if ($readAdapter) { $select = $readAdapter->select() ->from(array('layout_update' => $this->getMainTable()), array('xml')) - ->join(array('link'=>$this->getTable('core/layout_link')), - 'link.layout_update_id=layout_update.layout_update_id', - '') + ->join( + array('link'=>$this->getTable('core/layout_link')), + 'link.layout_update_id=layout_update.layout_update_id', + '' + ) ->where('link.store_id IN (0, :store_id)') ->where('link.area = :area') ->where('link.package = :package') diff --git a/app/code/core/Mage/Core/Model/Resource/Resource.php b/app/code/core/Mage/Core/Model/Resource/Resource.php index c9e30aa0ad0..3c6a4313777 100644 --- a/app/code/core/Mage/Core/Model/Resource/Resource.php +++ b/app/code/core/Mage/Core/Model/Resource/Resource.php @@ -125,9 +125,11 @@ public function setDbVersion($resName, $version) if ($this->getDbVersion($resName)) { self::$_versions[$resName] = $version; - return $this->_getWriteAdapter()->update($this->getMainTable(), - $dbModuleInfo, - array('code = ?' => $resName)); + return $this->_getWriteAdapter()->update( + $this->getMainTable(), + $dbModuleInfo, + array('code = ?' => $resName) + ); } else { self::$_versions[$resName] = $version; return $this->_getWriteAdapter()->insert($this->getMainTable(), $dbModuleInfo); diff --git a/app/code/core/Mage/Core/Model/Resource/Setup.php b/app/code/core/Mage/Core/Model/Resource/Setup.php index 43a71808025..1fb4aebd457 100644 --- a/app/code/core/Mage/Core/Model/Resource/Setup.php +++ b/app/code/core/Mage/Core/Model/Resource/Setup.php @@ -54,21 +54,21 @@ class Mage_Core_Model_Resource_Setup /** * Setup resource configuration object * - * @var Varien_Simplexml_Object + * @var Mage_Core_Model_Config_Element */ protected $_resourceConfig; /** * Connection configuration object * - * @var Varien_Simplexml_Object + * @var Mage_Core_Model_Config_Element */ protected $_connectionConfig; /** * Setup module configuration object * - * @var Varien_Simplexml_Object + * @var Mage_Core_Model_Config_Element */ protected $_moduleConfig; @@ -151,7 +151,7 @@ public function __construct($resourceName) /** * Get connection object * - * @return Varien_Db_Adapter_Interface + * @return Varien_Db_Adapter_Interface|Varien_Db_Adapter_Pdo_Mysql */ public function getConnection() { @@ -196,7 +196,6 @@ protected function _getTableCacheName($tableName) { if (is_array($tableName)) { return join('_', $tableName); - } return $tableName; } @@ -216,7 +215,7 @@ protected function _getResource() * * @return boolean */ - static public function applyAllUpdates() + public static function applyAllUpdates() { Mage::app()->setUpdateMode(true); self::$_hadUpdates = false; @@ -231,6 +230,7 @@ static public function applyAllUpdates() if (isset($resource->setup->class)) { $className = $resource->setup->getClassName(); } + /** @var Mage_Core_Model_Resource_Setup $setupClass */ $setupClass = new $className($resName); $setupClass->applyUpdates(); if ($setupClass->getCallAfterApplyAllUpdates()) { @@ -251,7 +251,7 @@ static public function applyAllUpdates() * Apply database data updates whenever needed * */ - static public function applyAllDataUpdates() + public static function applyAllDataUpdates() { if (!self::$_schemaUpdatesChecked) { return; @@ -265,6 +265,7 @@ static public function applyAllDataUpdates() if (isset($resource->setup->class)) { $className = $resource->setup->getClassName(); } + /** @var Mage_Core_Model_Resource_Setup $setupClass */ $setupClass = new $className($resName); $setupClass->applyDataUpdates(); } @@ -273,7 +274,6 @@ static public function applyAllDataUpdates() /** * Apply data updates to the system after upgrading. * - * @param string $fromVersion * @return $this */ public function applyDataUpdates() @@ -282,9 +282,9 @@ public function applyDataUpdates() $configVer = (string)$this->_moduleConfig->version; if ($dataVer !== false) { $status = version_compare($configVer, $dataVer); - if ($status == self::VERSION_COMPARE_GREATER) { - $this->_upgradeData($dataVer, $configVer); - } + if ($status == self::VERSION_COMPARE_GREATER) { + $this->_upgradeData($dataVer, $configVer); + } } elseif ($configVer) { $this->_installData($configVer); } @@ -294,7 +294,7 @@ public function applyDataUpdates() /** * Apply module resource install, upgrade and data scripts * - * @return $this + * @return $this|true */ public function applyUpdates() { @@ -312,7 +312,7 @@ public function applyUpdates() // Module is installed if ($dbVer !== false) { $status = version_compare($configVer, $dbVer); - switch ($status) { + switch ($status) { case self::VERSION_COMPARE_LOWER: $this->_rollbackResourceDb($configVer, $dbVer); break; @@ -321,8 +321,8 @@ public function applyUpdates() break; default: return true; - break; - } + break; + } } elseif ($configVer) { $this->_installResourceDb($configVer); } @@ -342,7 +342,7 @@ public function applyUpdates() protected function _hookQueries() { $this->_queriesHooked = true; - /* @var $adapter Varien_Db_Adapter_Pdo_Mysql */ + /* @var Varien_Db_Adapter_Pdo_Mysql $adapter */ $adapter = $this->getConnection(); $adapter->setQueryHook(array('object' => $this, 'method' => 'callbackQueryHook')); return $this; @@ -358,7 +358,7 @@ protected function _unhookQueries() if (!$this->_queriesHooked) { return $this; } - /* @var $adapter Varien_Db_Adapter_Pdo_Mysql */ + /* @var Varien_Db_Adapter_Pdo_Mysql $adapter */ $adapter = $this->getConnection(); $adapter->setQueryHook(null); $this->_queriesHooked = false; @@ -492,7 +492,7 @@ protected function _getAvailableDbFiles($actionType, $fromVersion, $toVersion) $matches = array(); if (preg_match($regExpDb, $file, $matches)) { $dbFiles[$matches[1]] = $filesDir . DS . $file; - } else if (preg_match($regExpType, $file, $matches)) { + } elseif (preg_match($regExpType, $file, $matches)) { $typeFiles[$matches[1]] = $filesDir . DS . $file; } } @@ -531,7 +531,6 @@ protected function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) if (preg_match($regExp, $file, $matches)) { $files[$matches[1]] = $filesDir . DS . $file; } - } $handlerDir->close(); } @@ -576,7 +575,6 @@ protected function _setResourceVersion($actionType, $version) case self::TYPE_DATA_UPGRADE: $this->_getResource()->setDataVersion($this->_resourceName, $version); break; - } return $this; @@ -626,7 +624,6 @@ protected function _modifyResourceDb($actionType, $fromVersion, $toVersion) case 'sql': $sql = file_get_contents($fileName); if (!empty($sql)) { - $result = $this->run($sql); } else { $result = true; @@ -721,7 +718,7 @@ protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $ar * @param string|integer $parentId * @return mixed|boolean */ - public function getTableRow($table, $idField, $id, $field=null, $parentField=null, $parentId=0) + public function getTableRow($table, $idField, $id, $field = null, $parentField = null, $parentId = 0) { if (strpos($table, '/') !== false) { $table = $this->getTable($table); @@ -754,7 +751,7 @@ public function getTableRow($table, $idField, $id, $field=null, $parentField=nul * * @param string $table * @param string $idField - * @param string|int $id + * @param int|string $id * @param null|string $parentField * @param int|string $parentId * @return $this @@ -790,7 +787,7 @@ public function deleteTableRow($table, $idField, $id, $parentField = null, $pare * @param mixed|null $value * @param string $parentField * @param string|integer $parentId - * @return Mage_Eav_Model_Entity_Setup + * @return $this */ public function updateTableRow($table, $idField, $id, $field, $value = null, $parentField = null, $parentId = 0) { @@ -835,10 +832,12 @@ public function updateTable($table, $conditionExpr, $valueExpr) if (strpos($table, '/') !== false) { $table = $this->getTable($table); } - $query = sprintf('UPDATE %s SET %s WHERE %s', + $query = sprintf( + 'UPDATE %s SET %s WHERE %s', $this->getConnection()->quoteIdentifier($table), $conditionExpr, - $valueExpr); + $valueExpr + ); $this->getConnection()->query($query); @@ -858,7 +857,6 @@ public function tableExists($table) } return $this->getConnection()->isTableExists($table); - } /******************* CONFIG *****************/ @@ -873,7 +871,7 @@ public function tableExists($table) * @return $this * @deprecated since 1.4.0.1 */ - public function addConfigField($path, $label, array $data=array(), $default=null) + public function addConfigField($path, $label, array $data = array(), $default = null) { return $this; } @@ -888,7 +886,7 @@ public function addConfigField($path, $label, array $data=array(), $default=null * @param int $inherit * @return $this */ - public function setConfigData($path, $value, $scope = 'default', $scopeId = 0, $inherit=0) + public function setConfigData($path, $value, $scope = 'default', $scopeId = 0, $inherit = 0) { $table = $this->getTable('core/config_data'); // this is a fix for mysql 4.1 diff --git a/app/code/core/Mage/Core/Model/Resource/Setup/Query/Modifier.php b/app/code/core/Mage/Core/Model/Resource/Setup/Query/Modifier.php index a6417eb47ad..5fa2d2b2533 100644 --- a/app/code/core/Mage/Core/Model/Resource/Setup/Query/Modifier.php +++ b/app/code/core/Mage/Core/Model/Resource/Setup/Query/Modifier.php @@ -51,7 +51,7 @@ class Mage_Core_Model_Resource_Setup_Query_Modifier /** * Inits query modifier * - * @param $adapter Varien_Db_Adapter_Pdo_Mysql + * @param Varien_Db_Adapter_Pdo_Mysql|array $args * @return void */ public function __construct($args) @@ -177,7 +177,7 @@ protected function _fixColumnDefinitionInSql(&$sql, $column, $refColumnDefinitio /** * Fixes column definition in already existing table, so outgoing foreign key will be successfully set * - * @param string $sql + * @param string $table * @param string $column * @param array $refColumnDefinition * @return $this @@ -215,7 +215,7 @@ protected function _fixColumnDefinitionInTable($table, $column, $refColumnDefini /** * Returns column definition from already existing table * - * @param string $sql + * @param string $table * @param string $column * @return array|null */ diff --git a/app/code/core/Mage/Core/Model/Resource/Store.php b/app/code/core/Mage/Core/Model/Resource/Store.php index c969b7a6d49..f02782bfa17 100644 --- a/app/code/core/Mage/Core/Model/Resource/Store.php +++ b/app/code/core/Mage/Core/Model/Resource/Store.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core Store Resource Model * @@ -60,14 +59,15 @@ protected function _initUniqueFields() /** * Check store code before save * - * @param Mage_Core_Model_Abstract $model - * @return $this + * @param Mage_Core_Model_Store $model + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $model) { if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $model->getCode())) { Mage::throwException( - Mage::helper('core')->__('The store code may contain only letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter')); + Mage::helper('core')->__('The store code may contain only letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter') + ); } return $this; @@ -76,8 +76,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $model) /** * Update Store Group data after save store * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Store $object + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) { @@ -91,8 +91,8 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) /** * Remove core configuration data after delete store * - * @param Mage_Core_Model_Abstract $model - * @return $this + * @param Mage_Core_Model_Store $model + * @inheritDoc */ protected function _afterDelete(Mage_Core_Model_Abstract $model) { @@ -137,7 +137,7 @@ protected function _updateGroupDefaultStore($groupId, $storeId) /** * Change store group for store * - * @param Mage_Core_Model_Abstract $model + * @param Mage_Core_Model_Abstract|Mage_Core_Model_Store_Group $model * @return $this */ protected function _changeGroup(Mage_Core_Model_Abstract $model) diff --git a/app/code/core/Mage/Core/Model/Resource/Store/Collection.php b/app/code/core/Mage/Core/Model/Resource/Store/Collection.php index 9fd38a956d4..8b82ea7aad3 100644 --- a/app/code/core/Mage/Core/Model/Resource/Store/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Store/Collection.php @@ -154,11 +154,7 @@ public function toOptionHash() } /** - * Load collection data - * - * @param boolean $printQuery - * @param boolean $logQuery - * @return $this + * @inheritDoc */ public function load($printQuery = false, $logQuery = false) { diff --git a/app/code/core/Mage/Core/Model/Resource/Store/Group.php b/app/code/core/Mage/Core/Model/Resource/Store/Group.php index 6adf1648bda..500ce5399b9 100644 --- a/app/code/core/Mage/Core/Model/Resource/Store/Group.php +++ b/app/code/core/Mage/Core/Model/Resource/Store/Group.php @@ -46,8 +46,8 @@ protected function _construct() /** * Update default store group for website * - * @param Mage_Core_Model_Abstract $model - * @return $this + * @param Mage_Core_Model_Store_Group $model + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $model) { @@ -83,7 +83,7 @@ protected function _updateWebsiteDefaultGroup($websiteId, $groupId) /** * Change store group website * - * @param Mage_Core_Model_Abstract $model + * @param Mage_Core_Model_Abstract|Mage_Core_Model_Store_Group $model * @return $this */ protected function _changeWebsite(Mage_Core_Model_Abstract $model) diff --git a/app/code/core/Mage/Core/Model/Resource/Store/Group/Collection.php b/app/code/core/Mage/Core/Model/Resource/Store/Group/Collection.php index 9e09c5ed0b7..59f8ad6326e 100644 --- a/app/code/core/Mage/Core/Model/Resource/Store/Group/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Store/Group/Collection.php @@ -95,16 +95,14 @@ public function setWithoutStoreViewFilter() } /** - * Load collection data - * - * @return $this + * @inheritDoc */ public function _beforeLoad() { if (!$this->getLoadDefault()) { $this->setWithoutDefaultFilter(); } - $this->addOrder('main_table.name', self::SORT_ORDER_ASC); + $this->addOrder('main_table.name', self::SORT_ORDER_ASC); return parent::_beforeLoad(); } diff --git a/app/code/core/Mage/Core/Model/Resource/Transaction.php b/app/code/core/Mage/Core/Model/Resource/Transaction.php index d208a837d26..06008e8e807 100644 --- a/app/code/core/Mage/Core/Model/Resource/Transaction.php +++ b/app/code/core/Mage/Core/Model/Resource/Transaction.php @@ -24,14 +24,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Resource transaction model * * @todo need collect conection by name * @category Mage * @package Mage_Core - * @author Magento Core Team + * @author Magento Core Team */ class Mage_Core_Model_Resource_Transaction { @@ -114,7 +113,7 @@ protected function _runCallbacks() * @param string $alias * @return $this */ - public function addObject(Mage_Core_Model_Abstract $object, $alias='') + public function addObject(Mage_Core_Model_Abstract $object, $alias = '') { $this->_objects[] = $object; if (!empty($alias)) { @@ -126,7 +125,7 @@ public function addObject(Mage_Core_Model_Abstract $object, $alias='') /** * Add callback function which will be called before commit transactions * - * @param callback $callback + * @param callable $callback * @return $this */ public function addCommitCallback($callback) @@ -207,5 +206,4 @@ public function delete() } return $this; } - } diff --git a/app/code/core/Mage/Core/Model/Resource/Translate.php b/app/code/core/Mage/Core/Model/Resource/Translate.php index d7fe65c0d87..7bb13d4b1fd 100644 --- a/app/code/core/Mage/Core/Model/Resource/Translate.php +++ b/app/code/core/Mage/Core/Model/Resource/Translate.php @@ -77,14 +77,13 @@ public function getTranslationArray($storeId = null, $locale = null) ); return $adapter->fetchPairs($select, $bind); - } /** * Retrieve translations array by strings * * @param array $strings - * @param int_type $storeId + * @param int $storeId * @return array */ public function getTranslationArrayByStrings(array $strings, $storeId = null) @@ -120,7 +119,7 @@ public function getTranslationArrayByStrings(array $strings, $storeId = null) /** * Retrieve table checksum * - * @return int + * @return array|false */ public function getMainChecksum() { diff --git a/app/code/core/Mage/Core/Model/Resource/Translate/String.php b/app/code/core/Mage/Core/Model/Resource/Translate/String.php index 0feda37d15e..9a2ac7285f1 100644 --- a/app/code/core/Mage/Core/Model/Resource/Translate/String.php +++ b/app/code/core/Mage/Core/Model/Resource/Translate/String.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * String translate resource model * @@ -44,12 +43,8 @@ protected function _construct() } /** - * Load - * - * @param Mage_Core_Model_Abstract $object - * @param String $value - * @param String $field - * @return array + * @param Mage_Core_Model_Translate_String $object + * @inheritDoc */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) { @@ -84,8 +79,8 @@ protected function _getLoadSelect($field, $value, $object) /** * After translation loading * - * @param Mage_Core_Model_Abstract $object - * @return Mage_Core_Model_Resource_Db_Abstract + * @param Mage_Core_Model_Translate_String $object + * @inheritDoc */ public function _afterLoad(Mage_Core_Model_Abstract $object) { @@ -99,10 +94,8 @@ public function _afterLoad(Mage_Core_Model_Abstract $object) } /** - * Before save - * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Translate_String $object + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { @@ -122,10 +115,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) } /** - * After save - * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Translate_String $object + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) { @@ -154,9 +145,10 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) if (isset($stores[$storeId])) { $adapter->update( - $this->getMainTable(), - $data, - array('key_id = ?' => $stores[$storeId])); + $this->getMainTable(), + $data, + array('key_id = ?' => $stores[$storeId]) + ); } else { $adapter->insert($this->getMainTable(), $data); } diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db.php b/app/code/core/Mage/Core/Model/Resource/Type/Db.php index fac31084d43..2c6a7bea624 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -abstract class Mage_Core_Model_Resource_Type_Db extends Mage_Core_Model_Resource_Type_Abstract +abstract class Mage_Core_Model_Resource_Type_Db extends Mage_Core_Model_Resource_Type_Abstract { /** * Constructor diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php index 97ec4981126..b0422eb78a3 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Mysqi Resource * @@ -37,8 +36,8 @@ class Mage_Core_Model_Resource_Type_Db_Mysqli extends Mage_Core_Model_Resource_T /** * Get Connection * - * @param Array $config - * @return Varien_Db_Adapter_Mysqli + * @param array $config + * @return Varien_Db_Adapter_Mysqli */ public function getConnection($config) { diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php index fa4ae1838a0..814b6b2820c 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db/Mysqli/Setup.php @@ -24,14 +24,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Resource_Type_Db_Mysqli_Setup extends Mage_Core_Model_Resource_Type_Db { /** * Get connection - * - * @param Array $config - * @return Varien_Db_Adapter_Mysqli + * + * @param array $config + * @return Varien_Db_Adapter_Mysqli */ public function getConnection($config) { diff --git a/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php b/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php index 5af9ea7a363..403d7e1839f 100644 --- a/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - class Mage_Core_Model_Resource_Type_Db_Pdo_Mysql extends Mage_Core_Model_Resource_Type_Db { @@ -70,5 +69,4 @@ protected function _getDbAdapterClassName() { return 'Magento_Db_Adapter_Pdo_Mysql'; } - } diff --git a/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php index ce256360301..f8a158579ef 100644 --- a/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php +++ b/app/code/core/Mage/Core/Model/Resource/Url/Rewrite.php @@ -81,7 +81,7 @@ protected function _initUniqueFields() */ protected function _getLoadSelect($field, $value, $object) { - /** @var $select Varien_Db_Select */ + /** @var Varien_Db_Select $select */ $select = parent::_getLoadSelect($field, $value, $object); if (!is_null($object->getStoreId())) { @@ -109,7 +109,7 @@ public function getRequestPathByIdPath($idPath, $store) } $select = $this->_getReadAdapter()->select(); - /** @var $select Varien_Db_Select */ + /** @var Varien_Db_Select $select */ $select->from(array('main_table' => $this->getMainTable()), 'request_path') ->where('main_table.store_id = :store_id') ->where('main_table.id_path = :id_path') diff --git a/app/code/core/Mage/Core/Model/Resource/Url/Rewrite/Collection.php b/app/code/core/Mage/Core/Model/Resource/Url/Rewrite/Collection.php index b026e8d84f1..27433595e9d 100644 --- a/app/code/core/Mage/Core/Model/Resource/Url/Rewrite/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Url/Rewrite/Collection.php @@ -57,7 +57,8 @@ public function addTagsFilter($tags) $this->join( array('curt' => $this->getTable('core/url_rewrite_tag')), 'main_table.url_rewrite_id = curt.url_rewrite_id', - array()); + array() + ); $this->setFlag('tag_table_joined', true); } diff --git a/app/code/core/Mage/Core/Model/Resource/Variable.php b/app/code/core/Mage/Core/Model/Resource/Variable.php index cf2d61440ff..4fc6b9eb07f 100644 --- a/app/code/core/Mage/Core/Model/Resource/Variable.php +++ b/app/code/core/Mage/Core/Model/Resource/Variable.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Custom variable resource model * @@ -78,10 +77,8 @@ public function getVariableByCode($code, $withValue = false, $storeId = 0) } /** - * Perform actions after object save - * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Variable $object + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) { @@ -91,10 +88,12 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) * remove store value */ $this->_getWriteAdapter()->delete( - $this->getTable('core/variable_value'), array( + $this->getTable('core/variable_value'), + array( 'variable_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId() - )); + ) + ); } else { $data = array( 'variable_id' => $object->getId(), @@ -113,12 +112,8 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) } /** - * Retrieve select object for load object data - * - * @param string $field - * @param mixed $value - * @param Mage_Core_Model_Abstract $object - * @return Zend_Db_Select + * @param Mage_Core_Model_Variable $object + * @inheritDoc */ protected function _getLoadSelect($field, $value, $object) { @@ -141,13 +136,15 @@ protected function _addValueToSelect(Zend_Db_Select $select, $storeId = Mage_Cor $ifNullHtmlValue = $adapter->getCheckSql('store.html_value IS NULL', 'def.html_value', 'store.html_value'); $select->joinLeft( - array('def' => $this->getTable('core/variable_value')), - 'def.variable_id = '.$this->getMainTable().'.variable_id AND def.store_id = 0', - array()) + array('def' => $this->getTable('core/variable_value')), + 'def.variable_id = '.$this->getMainTable().'.variable_id AND def.store_id = 0', + array() + ) ->joinLeft( array('store' => $this->getTable('core/variable_value')), 'store.variable_id = def.variable_id AND store.store_id = ' . $adapter->quote($storeId), - array()) + array() + ) ->columns(array( 'plain_value' => $ifNullPlainValue, 'html_value' => $ifNullHtmlValue, diff --git a/app/code/core/Mage/Core/Model/Resource/Variable/Collection.php b/app/code/core/Mage/Core/Model/Resource/Variable/Collection.php index 047d5cc4106..040a3ef647c 100644 --- a/app/code/core/Mage/Core/Model/Resource/Variable/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Variable/Collection.php @@ -84,7 +84,8 @@ public function addValuesToResult() ->join( array('value_table' => $this->getTable('core/variable_value')), 'value_table.variable_id = main_table.variable_id', - array('value_table.plain_value', 'value_table.html_value')); + array('value_table.plain_value', 'value_table.html_value') + ); $this->addFieldToFilter('value_table.store_id', array('eq' => $this->getStoreId())); return $this; } diff --git a/app/code/core/Mage/Core/Model/Resource/Website.php b/app/code/core/Mage/Core/Model/Resource/Website.php index 50978124664..0be8cf3dc5a 100644 --- a/app/code/core/Mage/Core/Model/Resource/Website.php +++ b/app/code/core/Mage/Core/Model/Resource/Website.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core Website Resource Model * @@ -60,8 +59,8 @@ protected function _initUniqueFields() /** * Validate website code before object save * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Website $object + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { @@ -73,10 +72,8 @@ protected function _beforeSave(Mage_Core_Model_Abstract $object) } /** - * Perform actions after object save - * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @param Mage_Core_Model_Website $object + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $object) { @@ -91,8 +88,8 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) /** * Remove core configuration data after delete website * - * @param Mage_Core_Model_Abstract $model - * @return $this + * @param Mage_Core_Model_Website $model + * @inheritDoc */ protected function _afterDelete(Mage_Core_Model_Abstract $model) { @@ -104,13 +101,12 @@ protected function _afterDelete(Mage_Core_Model_Abstract $model) $this->_getWriteAdapter()->delete($this->getTable('core/config_data'), $where); return $this; - } /** * Retrieve default stores select object * Select fields website_id, store_id - * + * * @param boolean $withDefault include/exclude default admin website * @return Varien_Db_Select */ @@ -121,7 +117,8 @@ public function getDefaultStoresSelect($withDefault = false) $select = $this->_getReadAdapter()->select() ->from( array('website_table' => $this->getTable('core/website')), - array('website_id')) + array('website_id') + ) ->joinLeft( array('store_group_table' => $this->getTable('core/store_group')), 'website_table.website_id=store_group_table.website_id' diff --git a/app/code/core/Mage/Core/Model/Resource/Website/Collection.php b/app/code/core/Mage/Core/Model/Resource/Website/Collection.php index 3a4e6881db5..3e2be6f96e9 100644 --- a/app/code/core/Mage/Core/Model/Resource/Website/Collection.php +++ b/app/code/core/Mage/Core/Model/Resource/Website/Collection.php @@ -81,7 +81,7 @@ public function getLoadDefault() /** * Convert items array to array for select options * - * @return Array + * @return array */ public function toOptionArray() { @@ -91,7 +91,7 @@ public function toOptionArray() /** * Convert items array to hash for select options * - * @return Array + * @return array */ public function toOptionHash() { @@ -120,11 +120,7 @@ public function addIdFilter($ids) } /** - * Load collection data - * - * @param boolean $printQuery - * @param boolean $logQuery - * @return $this + * @inheritDoc */ public function load($printQuery = false, $logQuery = false) { @@ -135,7 +131,6 @@ public function load($printQuery = false, $logQuery = false) ->unshiftOrder('main_table.sort_order', Varien_Db_Select::SQL_ASC); // website sort order FIRST return parent::load($printQuery, $logQuery); - } /** diff --git a/app/code/core/Mage/Core/Model/Session.php b/app/code/core/Mage/Core/Model/Session.php index 41db95b5f39..87066585dc4 100644 --- a/app/code/core/Mage/Core/Model/Session.php +++ b/app/code/core/Mage/Core/Model/Session.php @@ -31,11 +31,23 @@ * @todo extend from Mage_Core_Model_Session_Abstract * * @method null|bool getCookieShouldBeReceived() - * @method Mage_Core_Model_Session setCookieShouldBeReceived(bool $flag) - * @method Mage_Core_Model_Session unsCookieShouldBeReceived() + * @method $this setCookieShouldBeReceived(bool $value) + * @method $this unsCookieShouldBeReceived() + * @method $this unsSessionHosts() + * @method string getCurrencyCode() + * @method $this setCurrencyCode(string $value) + * @method $this setFormData(array $value) + * @method int getJustVotedPoll() + * @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 { + /** + * @param array $data + */ public function __construct($data = array()) { $name = isset($data['name']) ? $data['name'] : null; diff --git a/app/code/core/Mage/Core/Model/Session/Abstract.php b/app/code/core/Mage/Core/Model/Session/Abstract.php index 5df05d532fc..b586054c12a 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract.php @@ -24,13 +24,20 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Core Session Abstract model * * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getErrorMessage() + * @method $this setErrorMessage(string $value) + * @method $this unsErrorMessage() + * @method string getSuccessMessage() + * @method $this setSuccessMessage(string $value) + * @method $this unsSuccessMessage() + * @method $this setMessages(Mage_Core_Model_Abstract|Mage_Core_Model_Message_Collection $value) */ class Mage_Core_Model_Session_Abstract extends Mage_Core_Model_Session_Abstract_Varien { @@ -79,7 +86,7 @@ class Mage_Core_Model_Session_Abstract extends Mage_Core_Model_Session_Abstract_ * @param string $sessionName * @return $this */ - public function init($namespace, $sessionName=null) + public function init($namespace, $sessionName = null) { parent::init($namespace, $sessionName); $this->addHost(true); @@ -204,7 +211,7 @@ public function getValidateHttpUserAgentSkip() * @param bool $clear * @return Mage_Core_Model_Message_Collection */ - public function getMessages($clear=false) + public function getMessages($clear = false) { if (!$this->getData('messages')) { $this->setMessages(Mage::getModel('core/message_collection')); @@ -224,15 +231,17 @@ public function getMessages($clear=false) * * @param Exception $exception * @param string $alternativeText - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addException(Exception $exception, $alternativeText) { // log exception to exceptions log - $message = sprintf('Exception message: %s%sTrace: %s', + $message = sprintf( + 'Exception message: %s%sTrace: %s', $exception->getMessage(), "\n", - $exception->getTraceAsString()); + $exception->getTraceAsString() + ); $file = Mage::getStoreConfig(self::XML_PATH_LOG_EXCEPTION_FILE); Mage::log($message, Zend_Log::DEBUG, $file); @@ -244,7 +253,7 @@ public function addException(Exception $exception, $alternativeText) * Adding new message to message collection * * @param Mage_Core_Model_Message_Abstract $message - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addMessage(Mage_Core_Model_Message_Abstract $message) { @@ -257,7 +266,7 @@ public function addMessage(Mage_Core_Model_Message_Abstract $message) * Adding new error message * * @param string $message - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addError($message) { @@ -269,7 +278,7 @@ public function addError($message) * Adding new warning message * * @param string $message - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addWarning($message) { @@ -281,7 +290,7 @@ public function addWarning($message) * Adding new notice message * * @param string $message - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addNotice($message) { @@ -293,7 +302,7 @@ public function addNotice($message) * Adding new success message * * @param string $message - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addSuccess($message) { @@ -305,7 +314,7 @@ public function addSuccess($message) * Adding messages array to message collection * * @param array $messages - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addMessages($messages) { @@ -321,7 +330,7 @@ public function addMessages($messages) * Adds messages array to message collection, but doesn't add duplicates to it * * @param array|string|Mage_Core_Model_Message_Abstract $messages - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function addUniqueMessages($messages) { @@ -337,7 +346,7 @@ public function addUniqueMessages($messages) foreach ($items as $item) { if ($item instanceof Mage_Core_Model_Message_Abstract) { $text = $item->getText(); - } else if (is_string($item)) { + } elseif (is_string($item)) { $text = $item; } else { continue; // Some unknown object, do not put it in already existing messages @@ -348,7 +357,7 @@ public function addUniqueMessages($messages) foreach ($messages as $message) { if ($message instanceof Mage_Core_Model_Message_Abstract) { $text = $message->getText(); - } else if (is_string($message)) { + } elseif (is_string($message)) { $text = $message; } else { $text = null; // Some unknown object, add it anyway @@ -370,10 +379,9 @@ public function addUniqueMessages($messages) /** * Specify session identifier * - * @param string|null $id - * @return Mage_Core_Model_Session_Abstract + * @inheritDoc */ - public function setSessionId($id=null) + public function setSessionId($id = null) { if (is_null($id) && $this->useSid()) { $_queryParam = $this->getSessionIdQueryParam(); @@ -400,6 +408,9 @@ public function getEncryptedSessionId() return self::$_encryptedSessionId; } + /** + * @return string + */ public function getSessionIdQueryParam() { $_sessionName = $this->getSessionName(); diff --git a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php index 81c3ea8e879..9927f3a6577 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php @@ -22,6 +22,8 @@ * @package Mage_Core * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * + * @method bool getSkipEmptySessionCheck() */ @@ -37,7 +39,7 @@ class Mage_Core_Model_Session_Abstract_Varien extends Varien_Object const SECURE_COOKIE_CHECK_KEY = '_secure_cookie_check'; /** @var bool Flag true if session validator data has already been evaluated */ - protected static $isValidated = FALSE; + protected static $isValidated = false; /** * Map of session enabled hosts @@ -52,7 +54,7 @@ class Mage_Core_Model_Session_Abstract_Varien extends Varien_Object * @param string $sessionName * @return $this */ - public function start($sessionName=null) + public function start($sessionName = null) { if (isset($_SESSION) && !$this->getSkipEmptySessionCheck()) { return $this; @@ -65,7 +67,7 @@ public function start($sessionName=null) * backward compatibility with db argument (option is @deprecated after 1.12.0.2) */ case 'db': - /* @var $sessionResource Mage_Core_Model_Resource_Session */ + /* @var Mage_Core_Model_Resource_Session $sessionResource */ $sessionResource = Mage::getResourceSingleton('core/session'); $sessionResource->setSaveHandler(); break; @@ -226,7 +228,7 @@ public function revalidateCookie() * @param string $sessionName * @return $this */ - public function init($namespace, $sessionName=null) + public function init($namespace, $sessionName = null) { if (!isset($_SESSION)) { $this->start($sessionName); @@ -250,7 +252,7 @@ public function init($namespace, $sessionName=null) * @param bool $clear * @return mixed */ - public function getData($key='', $clear = false) + public function getData($key = '', $clear = false) { $data = parent::getData($key); if ($clear && isset($this->_data[$key])) { @@ -275,7 +277,7 @@ public function getSessionId() * @param string $id * @return $this */ - public function setSessionId($id=null) + public function setSessionId($id = null) { if (!is_null($id) && preg_match('#^[0-9a-zA-Z,-]+$#', $id)) { session_id($id); @@ -432,9 +434,8 @@ public function validate() } if (!isset($_SESSION[self::VALIDATOR_KEY])) { $_SESSION[self::VALIDATOR_KEY] = $this->getValidatorData(); - } - else { - if ( ! self::$isValidated && ! $this->_validate()) { + } else { + if (! self::$isValidated && ! $this->_validate()) { $this->getCookie()->delete(session_name()); // throw core session exception throw new Mage_Core_Model_Session_Exception(''); @@ -458,7 +459,7 @@ protected function _validate() { $sessionData = $_SESSION[self::VALIDATOR_KEY]; $validatorData = $this->getValidatorData(); - self::$isValidated = TRUE; // Only validate once since the validator data is the same for every namespace + self::$isValidated = true; // Only validate once since the validator data is the same for every namespace if ($this->useValidateRemoteAddr() && $sessionData[self::VALIDATOR_REMOTE_ADDR_KEY] != $validatorData[self::VALIDATOR_REMOTE_ADDR_KEY]) { diff --git a/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php b/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php index a98737f209d..9091e8015b0 100644 --- a/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php +++ b/app/code/core/Mage/Core/Model/Session/Abstract/Zend.php @@ -30,6 +30,10 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method string getCookieDomain() + * @method string getCookiePath() + * @method string getCookieLifetime() */ abstract class Mage_Core_Model_Session_Abstract_Zend extends Varien_Object { @@ -40,11 +44,17 @@ abstract class Mage_Core_Model_Session_Abstract_Zend extends Varien_Object */ protected $_namespace; + /** + * @return Zend_Session_Namespace + */ public function getNamespace() { return $this->_namespace; } + /** + * @return $this + */ public function start() { Varien_Profiler::start(__METHOD__.'/setOptions'); @@ -83,6 +93,7 @@ public function start() * Initialization session namespace * * @param string $namespace + * @return $this */ public function init($namespace) { @@ -99,11 +110,12 @@ public function init($namespace) /** * Redeclaration object setter * - * @param string $key - * @param mixed $value - * @return Mage_Core_Model_Session_Abstract + * @param string $key + * @param mixed $value + * @param bool $isChanged + * @return $this */ - public function setData($key, $value='', $isChanged = false) + public function setData($key, $value = '', $isChanged = false) { if (!$this->_namespace->data) { $this->_namespace->data = new Varien_Object(); @@ -119,7 +131,7 @@ public function setData($key, $value='', $isChanged = false) * @param bool $clear * @return mixed */ - public function getData($var=null, $clear=false) + public function getData($var = null, $clear = false) { if (!$this->_namespace->data) { $this->_namespace->data = new Varien_Object(); @@ -137,7 +149,7 @@ public function getData($var=null, $clear=false) /** * Cleare session data * - * @return Mage_Core_Model_Session_Abstract + * @return $this */ public function unsetAll() { @@ -155,7 +167,11 @@ public function getSessionId() return Zend_Session::getId(); } - public function setSessionId($id=null) + /** + * @param null $id + * @return $this + */ + public function setSessionId($id = null) { if (!is_null($id)) { Zend_Session::setId($id); @@ -166,7 +182,7 @@ public function setSessionId($id=null) /** * Regenerate session Id * - * @return Mage_Core_Model_Session_Abstract_Zend + * @return $this */ public function regenerateSessionId() { diff --git a/app/code/core/Mage/Core/Model/Session/Exception.php b/app/code/core/Mage/Core/Model/Session/Exception.php index c168403c520..a454beb9c03 100644 --- a/app/code/core/Mage/Core/Model/Session/Exception.php +++ b/app/code/core/Mage/Core/Model/Session/Exception.php @@ -35,4 +35,6 @@ * @author Magento Core Team */ class Mage_Core_Model_Session_Exception extends Mage_Core_Exception -{} +{ + +} diff --git a/app/code/core/Mage/Core/Model/Store.php b/app/code/core/Mage/Core/Model/Store.php index 9fb9746c7a9..c58e23d0098 100644 --- a/app/code/core/Mage/Core/Model/Store.php +++ b/app/code/core/Mage/Core/Model/Store.php @@ -29,13 +29,25 @@ * * @method Mage_Core_Model_Resource_Store _getResource() * @method Mage_Core_Model_Resource_Store getResource() - * @method Mage_Core_Model_Store setCode(string $value) - * @method Mage_Core_Model_Store setWebsiteId(int $value) - * @method Mage_Core_Model_Store setGroupId(int $value) - * @method Mage_Core_Model_Store setName(string $value) + * @method Mage_Core_Model_Resource_Store_Collection getCollection() + * + * @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 $thissetRootCategoryPath(string $value) + * @method $this setRootCategory(Mage_Catalog_Model_Category $value) * @method int getSortOrder() - * @method Mage_Core_Model_Store setSortOrder(int $value) - * @method Mage_Core_Model_Store setIsActive(int $value) + * @method $this setSortOrder(int $value) + * @method int getStoreId() + * @method $this setStoreId(int $value) + * @method $this setWebsiteId(int $value) + * @method string getRootCategoryPath() * * @category Mage * @package Mage_Core @@ -299,7 +311,7 @@ protected function _construct() /** * Retrieve store session object * - * @return Mage_Core_Model_Session_Abstract + * @return Mage_Core_Model_Session */ protected function _getSession() { @@ -311,11 +323,7 @@ protected function _getSession() } /** - * Loading store data - * - * @param mixed $id - * @param string $field - * @return Mage_Core_Model_Store + * @inheritDoc */ public function load($id, $field = null) { @@ -330,7 +338,7 @@ public function load($id, $field = null) * Loading store configuration data * * @param string $code - * @return Mage_Core_Model_Store + * @return $this */ public function loadConfig($code) { @@ -458,7 +466,7 @@ public function setWebsite(Mage_Core_Model_Website $website) /** * Retrieve store website * - * @return Mage_Core_Model_Website + * @return Mage_Core_Model_Website|false */ public function getWebsite() { @@ -477,7 +485,7 @@ public function getWebsite() * @param string $fullPath * @param string $path * @param Varien_Simplexml_Element $node - * @return string + * @return array|string */ protected function _processConfigValue($fullPath, $path, $node) { @@ -534,7 +542,6 @@ public function processSubst($value) if (strpos($value, '{{unsecure_base_url}}') !== false) { $unsecureBaseUrl = $this->getConfig(self::XML_PATH_UNSECURE_BASE_URL); $value = str_replace('{{unsecure_base_url}}', $unsecureBaseUrl, $value); - } elseif (strpos($value, '{{secure_base_url}}') !== false) { $secureBaseUrl = $this->getConfig(self::XML_PATH_SECURE_BASE_URL); $value = str_replace('{{secure_base_url}}', $secureBaseUrl, $value); @@ -566,7 +573,7 @@ public function getDefaultBasePath() */ public function getUrl($route = '', $params = array()) { - /** @var $url Mage_Core_Model_Url */ + /** @var Mage_Core_Model_Url $url */ $url = Mage::getModel('core/url') ->setStore($this); if (Mage::app()->getStore()->getId() != $this->getId()) { @@ -747,8 +754,10 @@ public function isAdminUrlSecure() public function isFrontUrlSecure() { if ($this->_isFrontSecure === null) { - $this->_isFrontSecure = Mage::getStoreConfigFlag(Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT, - $this->getId()); + $this->_isFrontSecure = Mage::getStoreConfigFlag( + Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT, + $this->getId() + ); } return $this->_isFrontSecure; } @@ -1022,11 +1031,11 @@ public function getPriceFilter() $this->_priceFilter = $this->getCurrentCurrency()->getFilter(); $this->_priceFilter->setRate($this->getBaseCurrency()->getRate($this->getCurrentCurrency())); } - } elseif ($this->getDefaultCurrency()) { - $this->_priceFilter = $this->getDefaultCurrency()->getFilter(); - } else { - $this->_priceFilter = new Varien_Filter_Sprintf('%s', 2); - } + } elseif ($this->getDefaultCurrency()) { + $this->_priceFilter = $this->getDefaultCurrency()->getFilter(); + } else { + $this->_priceFilter = new Varien_Filter_Sprintf('%s', 2); + } return $this->_priceFilter; } @@ -1056,7 +1065,7 @@ public function setGroup($group) /** * Retrieve group model * - * @return Mage_Core_Model_Store_Group + * @return Mage_Core_Model_Store_Group|false */ public function getGroup() { @@ -1072,7 +1081,7 @@ public function getGroup() /** * Retrieve website identifier * - * @return string|int|null + * @return int|string|null */ public function getWebsiteId() { @@ -1082,7 +1091,7 @@ public function getWebsiteId() /** * Retrieve group identifier * - * @return string|int|null + * @return int|string|null */ public function getGroupId() { @@ -1092,7 +1101,7 @@ public function getGroupId() /** * Retrieve default group identifier * - * @return string|int|null + * @return int|string|null */ public function getDefaultGroupId() { @@ -1123,7 +1132,8 @@ public function getCurrentUrl($fromStore = true) { $sidQueryParam = $this->_getSession()->getSessionIdQueryParam(); $requestString = Mage::getSingleton('core/url')->escape( - ltrim(Mage::app()->getRequest()->getRequestString(), '/')); + ltrim(Mage::app()->getRequest()->getRequestString(), '/') + ); $storeUrl = Mage::app()->getStore()->isCurrentlySecure() ? $this->getUrl('', array('_secure' => true)) @@ -1184,7 +1194,7 @@ public function getName() * * Register indexing event before delete store * - * @return $this + * {@inheritDoc} */ protected function _beforeDelete() { diff --git a/app/code/core/Mage/Core/Model/Store/Api.php b/app/code/core/Mage/Core/Model/Store/Api.php index 59a717a58ec..5b1d346dc6e 100644 --- a/app/code/core/Mage/Core/Model/Store/Api.php +++ b/app/code/core/Mage/Core/Model/Store/Api.php @@ -92,5 +92,4 @@ public function info($storeId) return $result; } - } diff --git a/app/code/core/Mage/Core/Model/Store/Exception.php b/app/code/core/Mage/Core/Model/Store/Exception.php index 8c549b01f0f..4404c534171 100644 --- a/app/code/core/Mage/Core/Model/Store/Exception.php +++ b/app/code/core/Mage/Core/Model/Store/Exception.php @@ -33,4 +33,6 @@ * @author Magento Core Team */ class Mage_Core_Model_Store_Exception extends Mage_Core_Exception -{} +{ + +} diff --git a/app/code/core/Mage/Core/Model/Store/Group.php b/app/code/core/Mage/Core/Model/Store/Group.php index da1cb586d7c..92f0e1ec010 100644 --- a/app/code/core/Mage/Core/Model/Store/Group.php +++ b/app/code/core/Mage/Core/Model/Store/Group.php @@ -29,17 +29,24 @@ * * @method Mage_Core_Model_Resource_Store_Group _getResource() * @method Mage_Core_Model_Resource_Store_Group getResource() - * @method Mage_Core_Model_Store_Group setWebsiteId(int $value) + * @method Mage_Core_Model_Resource_Store_Group_Collection getCollection() + * + * @method $this setWebsiteId(int $value) * @method string getName() - * @method Mage_Core_Model_Store_Group setName(string $value) - * @method Mage_Core_Model_Store_Group setRootCategoryId(int $value) - * @method Mage_Core_Model_Store_Group setDefaultStoreId(int $value) + * @method $this setName(string $value) + * @method $this setRootCategoryId(int $value) + * @method $this setDefaultStoreId(int $value) + * @method $this setHomeUrl(string $value) + * @method bool hasDefaultStoreId() + * @method bool hasGroupId() + * @method int getGroupId() + * @method int getOriginalGroupId() + * @method int getOriginalWebsiteId() * * @category Mage * @package Mage_Core * @author Magento Core Team */ - class Mage_Core_Model_Store_Group extends Mage_Core_Model_Abstract { const ENTITY = 'store_group'; @@ -115,12 +122,12 @@ protected function _construct() /** * Load store collection and set internal data - * */ protected function _loadStores() { $this->_stores = array(); $this->_storesCount = 0; + /** @var Mage_Core_Model_Store $store */ foreach ($this->getStoreCollection() as $store) { $this->_stores[$store->getId()] = $store; $this->_storeIds[$store->getId()] = $store->getId(); @@ -155,7 +162,7 @@ public function setStores($stores) /** * Retrieve new (not loaded) Store collection object with group filter * - * @return Mage_Core_Model_Mysql4_Store_Collection + * @return Mage_Core_Model_Resource_Store_Collection */ public function getStoreCollection() { @@ -167,7 +174,7 @@ public function getStoreCollection() /** * Retrieve wersite store objects * - * @return array + * @return Mage_Core_Model_Store[] */ public function getStores() { @@ -203,6 +210,9 @@ public function getStoreCodes() return $this->_storeCodes; } + /** + * @return int + */ public function getStoresCount() { if (is_null($this->_stores)) { @@ -214,7 +224,7 @@ public function getStoresCount() /** * Retrieve default store model * - * @return Mage_Core_Model_Store + * @return Mage_Core_Model_Store|false */ public function getDefaultStore() { @@ -252,14 +262,13 @@ public function getDefaultStoreByLocale($locale) /** * Retrieve list of stores with given locale * - * @param $locale + * @param string $locale * @return array */ public function getStoresByLocale($locale) { $stores = array(); foreach ($this->getStores() as $store) { - /* @var $store Mage_Core_Model_Store */ if ($store->getLocaleCode() == $locale) { array_push($stores, $store); } @@ -280,7 +289,7 @@ public function setWebsite(Mage_Core_Model_Website $website) /** * Retrieve website model * - * @return Mage_Core_Model_Website + * @return Mage_Core_Model_Website|false */ public function getWebsite() { @@ -307,21 +316,33 @@ public function isCanDelete() return $this->getWebsite()->getDefaultGroupId() != $this->getId(); } + /** + * @return int + */ public function getDefaultStoreId() { return $this->_getData('default_store_id'); } + /** + * @return int + */ public function getRootCategoryId() { return $this->_getData('root_category_id'); } + /** + * @return int + */ public function getWebsiteId() { return $this->_getData('website_id'); } + /** + * @inheritDoc + */ protected function _beforeDelete() { $this->_protectFromNonAdmin(); diff --git a/app/code/core/Mage/Core/Model/Template.php b/app/code/core/Mage/Core/Model/Template.php index 6f0d7bec210..23f74bcc191 100644 --- a/app/code/core/Mage/Core/Model/Template.php +++ b/app/code/core/Mage/Core/Model/Template.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Template model class * @@ -56,7 +55,7 @@ abstract class Mage_Core_Model_Template extends Mage_Core_Model_Abstract /** * Configuration of emulated desing package. * - * @var Varien_Object|boolean + * @var Varien_Object */ protected $_emulatedDesignConfig = false; @@ -64,14 +63,14 @@ abstract class Mage_Core_Model_Template extends Mage_Core_Model_Abstract * Initial environment information * @see self::_applyDesignConfig() * - * @var Varien_Object|null + * @var Varien_Object */ protected $_initialEnvironmentInfo = null; /** * Applying of design config * - * @return Mage_Core_Model_Template + * @return $this */ protected function _applyDesignConfig() { @@ -89,7 +88,7 @@ protected function _applyDesignConfig() /** * Revert design settings to previous * - * @return Mage_Core_Model_Template + * @return $this */ protected function _cancelDesignConfig() { @@ -108,7 +107,7 @@ protected function _cancelDesignConfig() */ protected function getDesignConfig() { - if(is_null($this->_designConfig)) { + if (is_null($this->_designConfig)) { $store = Mage::getDesign()->getStore(); $storeId = is_object($store) ? $store->getId() : $store; $this->_designConfig = new Varien_Object(array( @@ -123,7 +122,7 @@ protected function getDesignConfig() * Initialize design information for template processing * * @param array $config - * @return Mage_Core_Model_Template + * @return $this */ public function setDesignConfig(array $config) { @@ -138,7 +137,7 @@ public function setDesignConfig(array $config) * @param int|string $storeId * @param string $area */ - public function emulateDesign($storeId, $area=self::DEFAULT_DESIGN_AREA) + public function emulateDesign($storeId, $area = self::DEFAULT_DESIGN_AREA) { if ($storeId) { // save current design settings @@ -154,7 +153,6 @@ public function emulateDesign($storeId, $area=self::DEFAULT_DESIGN_AREA) /** * Revert to last design config, used before emulation - * */ public function revertDesign() { diff --git a/app/code/core/Mage/Core/Model/Translate.php b/app/code/core/Mage/Core/Model/Translate.php index 144e84741ca..b3a5927044a 100644 --- a/app/code/core/Mage/Core/Model/Translate.php +++ b/app/code/core/Mage/Core/Model/Translate.php @@ -56,7 +56,7 @@ class Mage_Core_Model_Translate /** * Translation object * - * @var Zend_Translate_Adapter + * @var Zend_Translate */ protected $_translate; @@ -111,8 +111,9 @@ public function __construct() /** * Initialization translation data * - * @param string $area - * @return Mage_Core_Model_Translate + * @param string $area + * @param bool $forceReload + * @return $this */ public function init($area, $forceReload = false) { @@ -133,7 +134,7 @@ public function init($area, $forceReload = false) $this->_data = array(); - foreach ($this->getModulesConfig() as $moduleName=>$info) { + foreach ($this->getModulesConfig() as $moduleName => $info) { $info = $info->asArray(); $this->_loadModuleTranslation($moduleName, $info['files'], $forceReload); } @@ -151,7 +152,7 @@ public function init($area, $forceReload = false) /** * Retrieve modules configuration by translation * - * @return Mage_Core_Model_Config_Element + * @return array|SimpleXMLElement */ public function getModulesConfig() { @@ -170,7 +171,7 @@ public function getModulesConfig() * Initialize configuration * * @param array $config - * @return Mage_Core_Model_Translate + * @return $this */ public function setConfig($config) { @@ -207,11 +208,12 @@ public function getConfig($key) /** * Loading data from module translation files * - * @param string $moduleName - * @param string $files - * @return Mage_Core_Model_Translate + * @param string $moduleName + * @param string $files + * @param bool $forceReload + * @return $this */ - protected function _loadModuleTranslation($moduleName, $files, $forceReload=false) + protected function _loadModuleTranslation($moduleName, $files, $forceReload = false) { foreach ($files as $file) { $file = $this->_getModuleFilePath($moduleName, $file); @@ -225,9 +227,10 @@ protected function _loadModuleTranslation($moduleName, $files, $forceReload=fals * * @param array $data * @param string $scope + * @param bool $forceReload * @return $this */ - protected function _addData($data, $scope, $forceReload=false) + protected function _addData($data, $scope, $forceReload = false) { foreach ($data as $key => $value) { if ($key === $value) { @@ -235,7 +238,7 @@ protected function _addData($data, $scope, $forceReload=false) } $key = $this->_prepareDataString($key); $value = $this->_prepareDataString($value); - if ($scope && isset($this->_dataScope[$key]) && !$forceReload ) { + if ($scope && isset($this->_dataScope[$key]) && !$forceReload) { /** * Checking previos value */ @@ -253,8 +256,7 @@ protected function _addData($data, $scope, $forceReload=false) } $scopeKey = $scope . self::SCOPE_SEPARATOR . $key; $this->_data[$scopeKey] = $value; - } - else { + } else { $this->_data[$key] = $value; $this->_dataScope[$key]= $scope; } @@ -262,6 +264,10 @@ protected function _addData($data, $scope, $forceReload=false) return $this; } + /** + * @param string $string + * @return string + */ protected function _prepareDataString($string) { return str_replace('""', '"', $string); @@ -270,6 +276,7 @@ protected function _prepareDataString($string) /** * Loading current theme translation * + * @param bool $forceReload * @return $this */ protected function _loadThemeTranslation($forceReload = false) @@ -282,6 +289,7 @@ protected function _loadThemeTranslation($forceReload = false) /** * Loading current store translation from DB * + * @param bool $forceReload * @return $this */ protected function _loadDbTranslation($forceReload = false) @@ -294,8 +302,9 @@ protected function _loadDbTranslation($forceReload = false) /** * Retrieve translation file for module * - * @param string $module - * @return string + * @param string $module + * @param string $fileName + * @return string */ protected function _getModuleFilePath($module, $fileName) { @@ -349,7 +358,11 @@ public function getLocale() return $this->_locale; } - public function setLocale( $locale ) + /** + * @param string $locale + * @return $this + */ + public function setLocale($locale) { $this->_locale = $locale; return $this; @@ -358,7 +371,7 @@ public function setLocale( $locale ) /** * Retrieve DB resource model * - * @return unknown + * @return Mage_Core_Model_Resource_Translate */ public function getResource() { @@ -368,7 +381,7 @@ public function getResource() /** * Retrieve translation object * - * @return Zend_Translate_Adapter + * @return Zend_Translate */ public function getTranslate() { @@ -399,8 +412,7 @@ public function translate($args) $module = $text->getModule(); $text = $text->getText(); $translated = $this->_getTranslatedString($text, $code); - } - else { + } else { if (!empty($_REQUEST['theme'])) { $module = 'frontend/default/'.$_REQUEST['theme']; } else { @@ -433,7 +445,7 @@ public function translate($args) * @param bool $flag * @return $this */ - public function setTranslateInline($flag=null) + public function setTranslateInline($flag = null) { $this->_canUseInline = (bool) $flag; return $this; @@ -457,7 +469,7 @@ public function getTranslateInline() * @param string $localeCode * @return string */ - public function getTemplateFile($file, $type, $localeCode=null) + public function getTemplateFile($file, $type, $localeCode = null) { if (is_null($localeCode) || preg_match('/[^a-zA-Z_]/', $localeCode)) { $localeCode = $this->getLocale(); @@ -515,8 +527,7 @@ public function getCacheId() /** * Loading data cache * - * @param string $area - * @return array | false + * @return array|false */ protected function _loadCache() { @@ -531,8 +542,7 @@ protected function _loadCache() /** * Saving data cache * - * @param string $area - * @return Mage_Core_Model_Translate + * @return $this */ protected function _saveCache() { @@ -546,7 +556,7 @@ protected function _saveCache() /** * Check cache usage availability * - * @return bool + * @return false|array */ protected function _canUseCache() { @@ -565,11 +575,9 @@ protected function _getTranslatedString($text, $code) $translated = ''; if (array_key_exists($code, $this->getData())) { $translated = $this->_data[$code]; - } - elseif (array_key_exists($text, $this->getData())) { + } elseif (array_key_exists($text, $this->getData())) { $translated = $this->_data[$text]; - } - else { + } else { $translated = $text; } return $translated; diff --git a/app/code/core/Mage/Core/Model/Translate/Expr.php b/app/code/core/Mage/Core/Model/Translate/Expr.php index 2150162ae01..9c051707418 100644 --- a/app/code/core/Mage/Core/Model/Translate/Expr.php +++ b/app/code/core/Mage/Core/Model/Translate/Expr.php @@ -33,19 +33,31 @@ class Mage_Core_Model_Translate_Expr { protected $_text; protected $_module; - - public function __construct($text='', $module='') + + /** + * @param string $text + * @param string $module + */ + public function __construct($text = '', $module = '') { $this->_text = $text; $this->_module = $module; } - + + /** + * @param string $text + * @return $this + */ public function setText($text) { $this->_text = $text; return $this; } - + + /** + * @param string $module + * @return $this + */ public function setModule($module) { $this->_module = $module; @@ -78,7 +90,7 @@ public function getModule() * @param string $separator * @return string */ - public function getCode($separator='::') + public function getCode($separator = '::') { return $this->getModule().$separator.$this->getText(); } diff --git a/app/code/core/Mage/Core/Model/Translate/Inline.php b/app/code/core/Mage/Core/Model/Translate/Inline.php index 49fbcf345e9..a77e8f33f96 100644 --- a/app/code/core/Mage/Core/Model/Translate/Inline.php +++ b/app/code/core/Mage/Core/Model/Translate/Inline.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Inline Translations PHP part * @@ -155,7 +154,7 @@ public function isAllowed($store = null) $this->_isAllowed = $active && Mage::helper('core')->isDevAllowed($store); } - /* @var $translate Mage_Core_Model_Translate */ + /* @var Mage_Core_Model_Translate $translate */ $translate = Mage::getSingleton('core/translate'); return $translate->getTranslateInline() && $this->_isAllowed; @@ -173,12 +172,12 @@ public function processAjaxPost($translate) return $this; } - /* @var $resource Mage_Core_Model_Mysql4_Translate_String */ + /* @var Mage_Core_Model_Mysql4_Translate_String $resource */ $resource = Mage::getResourceModel('core/translate_string'); foreach ($translate as $t) { if (Mage::getDesign()->getArea() == 'adminhtml') { $storeId = 0; - } else if (empty($t['perstore'])) { + } elseif (empty($t['perstore'])) { $resource->deleteTranslate($t['original'], null, false); $storeId = 0; } else { @@ -203,7 +202,7 @@ public function stripInlineTranslations(&$body) foreach ($body as &$part) { $this->stripInlineTranslations($part); } - } else if (is_string($body)) { + } elseif (is_string($body)) { $body = preg_replace('#' . $this->_tokenRegex . '#', '$1', $body); } return $this; @@ -228,7 +227,7 @@ public function processResponseBody(&$body) foreach ($body as &$part) { $this->processResponseBody($part); } - } else if (is_string($body)) { + } elseif (is_string($body)) { $this->_content = $body; $this->_specialTags(); @@ -253,8 +252,10 @@ protected function _insertInlineScriptsHtml() $baseJsUrl = Mage::getBaseUrl('js'); $url_prefix = Mage::app()->getStore()->isAdmin() ? 'adminhtml' : 'core'; - $ajaxUrl = Mage::getUrl($url_prefix . '/ajax/translate', - array('_secure'=>Mage::app()->getStore()->isCurrentlySecure())); + $ajaxUrl = Mage::getUrl( + $url_prefix . '/ajax/translate', + array('_secure'=>Mage::app()->getStore()->isCurrentlySecure()) + ); $trigImg = Mage::getDesign()->getSkinUrl('images/fam_book_open.png'); ob_start(); @@ -391,7 +392,7 @@ protected function _prepareTagAttributesForContent(&$content) $trAttr = ' data-translate=' . $quoteHtml . htmlspecialchars('[' . join(',', $trArr) . ']') . $quoteHtml; } - $tagHtml = substr_replace($tagHtml , $trAttr, strlen($tagMatch[1][0])+1, 1); + $tagHtml = substr_replace($tagHtml, $trAttr, strlen($tagMatch[1][0])+1, 1); $content = substr_replace($content, $tagHtml, $tagMatch[0][1], strlen($tagMatch[0][0])); } $nextTag = $tagMatch[0][1] + strlen($tagHtml); @@ -415,7 +416,8 @@ protected function _getHtmlQuote() /** * Prepare special tags */ - protected function _specialTags() { + protected function _specialTags() + { $this->_translateTags($this->_content, $this->_allowedTagsGlobal, '_applySpecialTagsFormat', false); $this->_translateTags($this->_content, $this->_allowedTagsSimple, '_applySimpleTagsFormat', true); } @@ -450,7 +452,7 @@ protected function _applySimpleTagsFormat($tagHtml, $tagName, $trArr) { return substr($tagHtml, 0, strlen($tagName) + 1) . ' data-translate=' - . $this->_getHtmlQuote() . htmlspecialchars( '[' . join(',', $trArr) . ']') + . $this->_getHtmlQuote() . htmlspecialchars('[' . join(',', $trArr) . ']') . $this->_getHtmlQuote() . substr($tagHtml, strlen($tagName) + 1); } @@ -514,10 +516,10 @@ protected function _translateTags(&$content, $tagsList, $formatCallback, $isNeed /** * Find end of tag * - * @param $body - * @param $tagName - * @param $from - * @return bool|int return false if end of tag is not found + * @param string $body + * @param string $tagName + * @param int $from + * @return false|int return false if end of tag is not found */ private function findEndOfTag($body, $tagName, $from) { @@ -567,7 +569,6 @@ protected function _otherText() $this->_content = substr_replace($this->_content, $spanHtml, $m[0][1], strlen($m[0][0])); $next = $m[0][1] + strlen($spanHtml) - 1; } - } /** diff --git a/app/code/core/Mage/Core/Model/Translate/String.php b/app/code/core/Mage/Core/Model/Translate/String.php index ddb9f3008ba..00fdff82401 100644 --- a/app/code/core/Mage/Core/Model/Translate/String.php +++ b/app/code/core/Mage/Core/Model/Translate/String.php @@ -30,11 +30,13 @@ * @method Mage_Core_Model_Resource_Translate_String _getResource() * @method Mage_Core_Model_Resource_Translate_String getResource() * @method int getStoreId() - * @method Mage_Core_Model_Translate_String setStoreId(int $value) + * @method $this setStoreId(int $value) * @method string getTranslate() - * @method Mage_Core_Model_Translate_String setTranslate(string $value) + * @method $this setTranslate(string $value) + * @method array getStoreTranslations() + * @method $this setStoreTranslations(array $value) * @method string getLocale() - * @method Mage_Core_Model_Translate_String setLocale(string $value) + * @method $this setLocale(string $value) * * @category Mage * @package Mage_Core @@ -46,7 +48,11 @@ protected function _construct() { $this->_init('core/translate_string'); } - + + /** + * @param string $string + * @return $this + */ public function setString($string) { $this->setData('string', $string); diff --git a/app/code/core/Mage/Core/Model/Url.php b/app/code/core/Mage/Core/Model/Url.php index fcefe8b0734..845a440517c 100644 --- a/app/code/core/Mage/Core/Model/Url.php +++ b/app/code/core/Mage/Core/Model/Url.php @@ -75,6 +75,14 @@ * @category Mage * @package Mage_Core * @author Magento Core Team + * + * @method $this setType(string $value) + * @method $this setSecure(bool $value) + * @method $this setSecureIsForced(bool $value) + * @method string getScheme() + * @method string getHost() + * @method string getPort() + * @method string getPath() */ class Mage_Core_Model_Url extends Varien_Object { @@ -294,7 +302,7 @@ public function setRequest(Zend_Controller_Request_Http $request) /** * Zend request object * - * @return Zend_Controller_Request_Http + * @return Mage_Core_Controller_Request_Http */ public function getRequest() { @@ -487,7 +495,7 @@ public function getActionPath() /** * Retrieve route path * - * @param array $routParams + * @param array $routeParams * @return string */ public function getRoutePath($routeParams = array()) @@ -1062,13 +1070,13 @@ protected function _prepareSessionUrlWithParams($url, array $params) return $this; } - /** @var $session Mage_Core_Model_Session */ + /** @var Mage_Core_Model_Session $session */ $session = Mage::getSingleton('core/session', $params); $sessionId = $session->getSessionIdForHost($url); if (Mage::app()->getUseSessionVar() && !$sessionId) { $this->setQueryParam('___SID', $this->getSecure() ? 'S' : 'U'); // Secure/Unsecure - } else if ($sessionId) { + } elseif ($sessionId) { $this->setQueryParam($session->getSessionIdQueryParam(), $sessionId); } return $this; @@ -1128,7 +1136,8 @@ public function escape($value) * @param array $params * @return string */ - public function getDirectUrl($url, $params = array()) { + public function getDirectUrl($url, $params = array()) + { $params['_direct'] = $url; return $this->getUrl('', $params); } @@ -1144,8 +1153,11 @@ public function sessionUrlVar($html) if (strpos($html, '__SID') === false) { return $html; } else { - return preg_replace_callback('#(\?|&|&)___SID=([SU])(&|&)?#', - array($this, "sessionVarCallback"), $html); + return preg_replace_callback( + '#(\?|&|&)___SID=([SU])(&|&)?#', + array($this, "sessionVarCallback"), + $html + ); } } @@ -1160,8 +1172,10 @@ public function useSessionIdForUrl($secure = false) $key = 'use_session_id_for_url_' . (int) $secure; if (is_null($this->getData($key))) { $httpHost = Mage::app()->getFrontController()->getRequest()->getHttpHost(); - $urlHost = parse_url(Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $secure), - PHP_URL_HOST); + $urlHost = parse_url( + Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $secure), + PHP_URL_HOST + ); if ($httpHost != $urlHost) { $this->setData($key, true); @@ -1182,7 +1196,7 @@ public function sessionVarCallback($match) { if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) { $session = Mage::getSingleton('core/session'); - /* @var $session Mage_Core_Model_Session */ + /* @var Mage_Core_Model_Session $session */ return $match[1] . $session->getSessionIdQueryParam() . '=' . $session->getEncryptedSessionId() diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Url/Rewrite.php index 66c95ced2eb..f21e351df10 100644 --- a/app/code/core/Mage/Core/Model/Url/Rewrite.php +++ b/app/code/core/Mage/Core/Model/Url/Rewrite.php @@ -24,29 +24,33 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Url rewrite model class * * @method Mage_Core_Model_Resource_Url_Rewrite _getResource() * @method Mage_Core_Model_Resource_Url_Rewrite getResource() - * @method Mage_Core_Model_Url_Rewrite setStoreId(int $value) + * @method Mage_Core_Model_Resource_Url_Rewrite_Collection getResourceCollection() + * + * @method $this setStoreId(int $value) * @method int getCategoryId() - * @method Mage_Core_Model_Url_Rewrite setCategoryId(int $value) + * @method $this setCategoryId(int $value) * @method int getProductId() - * @method Mage_Core_Model_Url_Rewrite setProductId(int $value) + * @method $this setProductId(int $value) * @method string getIdPath() - * @method Mage_Core_Model_Url_Rewrite setIdPath(string $value) + * @method $this setIdPath(string $value) * @method string getRequestPath() - * @method Mage_Core_Model_Url_Rewrite setRequestPath(string $value) + * @method $this setRequestPath(string $value) * @method string getTargetPath() - * @method Mage_Core_Model_Url_Rewrite setTargetPath(string $value) + * @method $this setTargetPath(string $value) * @method int getIsSystem() - * @method Mage_Core_Model_Url_Rewrite setIsSystem(int $value) + * @method $this setIsSystem(int $value) * @method string getOptions() - * @method Mage_Core_Model_Url_Rewrite setOptions(string $value) + * @method $this setOptions(string $value) * @method string getDescription() - * @method Mage_Core_Model_Url_Rewrite setDescription(string $value) + * @method $this setDescription(string $value) + * @method string|array getTags() + * @method $this setTags(string|array $value) + * @method bool hasCategoryId() * * @category Mage * @package Mage_Core @@ -104,12 +108,20 @@ public function loadByRequestPath($path) return $this; } + /** + * @param string $path + * @return $this + */ public function loadByIdPath($path) { $this->setId(null)->load($path, 'id_path'); return $this; } + /** + * @param string|array $tags + * @return $this + */ public function loadByTags($tags) { $this->setId(null); @@ -117,7 +129,7 @@ public function loadByTags($tags) $loadTags = is_array($tags) ? $tags : explode(',', $tags); $search = $this->getResourceCollection(); - foreach ($loadTags as $k=>$t) { + foreach ($loadTags as $k => $t) { if (!is_numeric($k)) { $t = $k.'='.$t; } @@ -130,6 +142,7 @@ public function loadByTags($tags) $search->setPageSize(1)->load(); if ($search->getSize()>0) { + /** @var Mage_Core_Model_Url_Rewrite $rewrite */ foreach ($search as $rewrite) { $this->setData($rewrite->getData()); } @@ -138,6 +151,10 @@ public function loadByTags($tags) return $this; } + /** + * @param string $key + * @return bool + */ public function hasOption($key) { $optArr = explode(',', $this->getOptions()); @@ -145,13 +162,17 @@ public function hasOption($key) return array_search($key, $optArr) !== false; } + /** + * @param string|array $tags + * @return $this + */ public function addTag($tags) { $curTags = $this->getTags(); $addTags = is_array($tags) ? $tags : explode(',', $tags); - foreach ($addTags as $k=>$t) { + foreach ($addTags as $k => $t) { if (!is_numeric($k)) { $t = $k.'='.$t; } @@ -165,13 +186,17 @@ public function addTag($tags) return $this; } + /** + * @param string|array $tags + * @return $this + */ public function removeTag($tags) { $curTags = $this->getTags(); $removeTags = is_array($tags) ? $tags : explode(',', $tags); - foreach ($removeTags as $k=>$t) { + foreach ($removeTags as $k => $t) { if (!is_numeric($k)) { $t = $k.'='.$t; } @@ -188,12 +213,13 @@ public function removeTag($tags) /** * Implement logic of custom rewrites * - * @param Zend_Controller_Request_Http $request - * @param Zend_Controller_Response_Http $response - * @return Mage_Core_Model_Url + * @param Zend_Controller_Request_Http $request + * @param Zend_Controller_Response_Http $response + * @return bool + * @throws Mage_Core_Model_Store_Exception * @deprecated since 1.7.0.2. Refactored and moved to Mage_Core_Controller_Request_Rewrite */ - public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Controller_Response_Http $response=null) + public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null) { if (!Mage::isInstalled()) { return false; @@ -237,8 +263,7 @@ public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Control if (!$this->getId() && isset($_GET['___from_store'])) { try { $fromStoreId = Mage::app()->getStore($_GET['___from_store'])->getId(); - } - catch (Exception $e) { + } catch (Exception $e) { return false; } @@ -282,7 +307,7 @@ public function rewrite(Zend_Controller_Request_Http $request=null, Zend_Control if (Mage::getStoreConfig('web/url/use_store') && $storeCode = Mage::app()->getStore()->getCode()) { $targetUrl = $request->getBaseUrl(). '/' . $storeCode . '/' .$this->getTargetPath(); - } + } $queryString = $this->_getQueryString(); if ($queryString) { @@ -307,7 +332,7 @@ protected function _getQueryString() $queryParams = array(); parse_str($_SERVER['QUERY_STRING'], $queryParams); $hasChanges = false; - foreach ($queryParams as $key=>$value) { + foreach ($queryParams as $key => $value) { if (substr($key, 0, 3) === '___') { unset($queryParams[$key]); $hasChanges = true; @@ -315,14 +340,16 @@ protected function _getQueryString() } if ($hasChanges) { return http_build_query($queryParams); - } - else { + } else { return $_SERVER['QUERY_STRING']; } } return false; } + /** + * @return int + */ public function getStoreId() { return $this->_getData('store_id'); diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php b/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php index a99da8e56ae..54e88a439e2 100644 --- a/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php +++ b/app/code/core/Mage/Core/Model/Url/Rewrite/Request.php @@ -36,7 +36,7 @@ class Mage_Core_Model_Url_Rewrite_Request /** * Instance of request * - * @var Zend_Controller_Request_Http + * @var Mage_Core_Controller_Request_Http */ protected $_request; @@ -142,7 +142,7 @@ protected function _rewriteDb() if (!$this->_rewrite->getId() && $fromStore) { $stores = $this->_app->getStores(false, true); if (!empty($stores[$fromStore])) { - /** @var $store Mage_Core_Model_Store */ + /** @var Mage_Core_Model_Store $store */ $store = $stores[$fromStore]; $fromStoreId = $store->getId(); } else { @@ -168,8 +168,10 @@ protected function _rewriteDb() return false; } - $this->_request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, - $this->_rewrite->getRequestPath()); + $this->_request->setAlias( + Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, + $this->_rewrite->getRequestPath() + ); $this->_processRedirectOptions(); return true; @@ -357,7 +359,7 @@ protected function _processRewriteUrl($url) * Retrieve router by name * * @param string $name - * @return Mage_Core_Controller_Varien_Router_Abstract|bool + * @return Mage_Core_Controller_Varien_Router_Abstract|false */ protected function _getRouter($name) { diff --git a/app/code/core/Mage/Core/Model/Variable.php b/app/code/core/Mage/Core/Model/Variable.php index 546b588a371..edd1c071b57 100644 --- a/app/code/core/Mage/Core/Model/Variable.php +++ b/app/code/core/Mage/Core/Model/Variable.php @@ -30,9 +30,12 @@ * @method Mage_Core_Model_Resource_Variable _getResource() * @method Mage_Core_Model_Resource_Variable getResource() * @method string getCode() - * @method Mage_Core_Model_Variable setCode(string $value) + * @method $this setCode(string $value) * @method string getName() - * @method Mage_Core_Model_Variable setName(string $value) + * @method $this setName(string $value) + * @method bool getUseDefaultValue() + * @method string getHtmlValue() + * @method string getPlainValue() * * @category Mage * @package Mage_Core @@ -130,12 +133,12 @@ public function validate() /** * Retrieve variables option array * - * @param boolean $withValues + * @param boolean $withGroup * @return array */ public function getVariablesOptionArray($withGroup = false) { - /* @var $collection Mage_Core_Model_Mysql4_Variable_Collection */ + /* @var Mage_Core_Model_Mysql4_Variable_Collection $collection */ $collection = $this->getCollection(); $variables = array(); foreach ($collection->toOptionArray() as $variable) { @@ -143,8 +146,8 @@ public function getVariablesOptionArray($withGroup = false) 'value' => '{{customVar code=' . $variable['value'] . '}}', 'label' => Mage::helper('core')->__( '%s', - Mage::helper('core')->escapeHtml($variable['label'] - )) + Mage::helper('core')->escapeHtml($variable['label']) + ) ); } if ($withGroup && $variables) { @@ -155,5 +158,4 @@ public function getVariablesOptionArray($withGroup = false) } return $variables; } - } diff --git a/app/code/core/Mage/Core/Model/Website.php b/app/code/core/Mage/Core/Model/Website.php index 81e9e9fc27d..e6177f6a93d 100644 --- a/app/code/core/Mage/Core/Model/Website.php +++ b/app/code/core/Mage/Core/Model/Website.php @@ -29,14 +29,23 @@ * * @method Mage_Core_Model_Resource_Website _getResource() * @method Mage_Core_Model_Resource_Website getResource() - * @method Mage_Core_Model_Website setCode(string $value) + * @method Mage_Core_Model_Resource_Website_Collection getCollection() + * + * @method $this setCode(string $value) * @method string getName() - * @method Mage_Core_Model_Website setName(string $value) + * @method $this setName(string $value) * @method int getSortOrder() - * @method Mage_Core_Model_Website setSortOrder(int $value) - * @method Mage_Core_Model_Website setDefaultGroupId(int $value) + * @method $this setSortOrder(int $value) + * @method $this setDefaultGroupId(int $value) * @method int getIsDefault() - * @method Mage_Core_Model_Website setIsDefault(int $value) + * @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() * * @category Mage * @package Mage_Core @@ -151,11 +160,7 @@ protected function _construct() } /** - * Custom load - * - * @param int|string $id - * @param string $field - * @return $this + * @inheritDoc */ public function load($id, $field = null) { @@ -178,7 +183,7 @@ public function loadConfig($code) return $this; } if (is_numeric($code)) { - foreach (Mage::getConfig()->getNode('websites')->children() as $websiteCode=>$website) { + foreach (Mage::getConfig()->getNode('websites')->children() as $websiteCode => $website) { if ((int)$website->system->website->id==$code) { $code = $websiteCode; break; @@ -201,9 +206,9 @@ public function loadConfig($code) * @param string $path * @return mixed */ - public function getConfig($path) { + public function getConfig($path) + { if (!isset($this->_configCache[$path])) { - $config = Mage::getConfig()->getNode('websites/'.$this->getCode().'/'.$path); if (!$config) { return false; @@ -211,7 +216,7 @@ public function getConfig($path) { } if ($config->hasChildren()) { $value = array(); - foreach ($config->children() as $k=>$v) { + foreach ($config->children() as $k => $v) { $value[$k] = $v; } } else { @@ -244,6 +249,7 @@ protected function _loadGroups() * Set website groups * * @param array $groups + * @return $this */ public function setGroups($groups) { @@ -263,7 +269,7 @@ public function setGroups($groups) /** * Retrieve new (not loaded) Group collection object with website filter * - * @return Mage_Core_Model_Mysql4_Store_Group_Collection + * @return Mage_Core_Model_Resource_Store_Group_Collection */ public function getGroupCollection() { @@ -275,7 +281,7 @@ public function getGroupCollection() /** * Retrieve website groups * - * @return array + * @return Mage_Core_Model_Store_Group[] */ public function getGroups() { @@ -314,7 +320,7 @@ public function getGroupsCount() /** * Retrieve default group model * - * @return Mage_Core_Model_Store_Group + * @return Mage_Core_Model_Store_Group|false */ public function getDefaultGroup() { @@ -369,7 +375,7 @@ public function setStores($stores) /** * Retrieve new (not loaded) Store collection object with website filter * - * @return Mage_Core_Model_Mysql4_Store_Collection + * @return Mage_Core_Model_Resource_Store_Collection */ public function getStoreCollection() { @@ -381,7 +387,7 @@ public function getStoreCollection() /** * Retrieve wersite store objects * - * @return array + * @return Mage_Core_Model_Store[] */ public function getStores() { @@ -457,16 +463,25 @@ public function getWebsiteGroupStore() return join('-', array($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 + */ protected function _beforeDelete() { $this->_protectFromNonAdmin(); @@ -534,7 +549,7 @@ public function getDefaultStore() * Retrieve default stores select object * Select fields website_id, store_id * - * @param $withDefault include/exclude default admin website + * @param bool $withDefault include/exclude default admin website * @return Varien_Db_Select */ public function getDefaultStoresSelect($withDefault = false) diff --git a/app/code/core/Mage/Core/controllers/AjaxController.php b/app/code/core/Mage/Core/controllers/AjaxController.php index a4db05f8900..dfcb8162675 100644 --- a/app/code/core/Mage/Core/controllers/AjaxController.php +++ b/app/code/core/Mage/Core/controllers/AjaxController.php @@ -35,15 +35,14 @@ class Mage_Core_AjaxController extends Mage_Core_Controller_Front_Action { /** * Ajax action for inline translation - * */ - public function translateAction () + public function translateAction() { $translation = $this->getRequest()->getPost('translate'); $area = $this->getRequest()->getPost('area'); //filtering - /** @var $filter Mage_Core_Model_Input_Filter_MaliciousCode */ + /** @var Mage_Core_Model_Input_Filter_MaliciousCode $filter */ $filter = Mage::getModel('core/input_filter_maliciousCode'); foreach ($translation as &$item) { $item['custom'] = $filter->filter($item['custom']); diff --git a/app/code/core/Mage/Core/controllers/IndexController.php b/app/code/core/Mage/Core/controllers/IndexController.php index 592f0a9adcf..293a0d3c616 100644 --- a/app/code/core/Mage/Core/controllers/IndexController.php +++ b/app/code/core/Mage/Core/controllers/IndexController.php @@ -25,7 +25,8 @@ */ -class Mage_Core_IndexController extends Mage_Core_Controller_Front_Action { +class Mage_Core_IndexController extends Mage_Core_Controller_Front_Action +{ public function indexAction() { diff --git a/app/code/core/Mage/Core/functions.php b/app/code/core/Mage/Core/functions.php index c2f91f3bd17..29e308d1b67 100644 --- a/app/code/core/Mage/Core/functions.php +++ b/app/code/core/Mage/Core/functions.php @@ -42,9 +42,8 @@ function destruct($object) /** * Translator function * + * @return string * @deprecated 1.3 - * @param string $text the text to translate - * @param mixed optional parameters to use in sprintf */ function __() { @@ -61,7 +60,7 @@ function __() * @param string $srcSep * @return string */ -function uc_words($str, $destSep='_', $srcSep='_') +function uc_words($str, $destSep = '_', $srcSep = '_') { return str_replace(' ', $destSep, ucwords(str_replace($srcSep, ' ', $str))); } @@ -69,10 +68,10 @@ function uc_words($str, $destSep='_', $srcSep='_') /** * Simple sql format date * - * @param string $format + * @param bool $dayOnly * @return string */ -function now($dayOnly=false) +function now($dayOnly = false) { return date($dayOnly ? 'Y-m-d' : 'Y-m-d H:i:s'); } @@ -88,6 +87,10 @@ function is_empty_date($date) return preg_replace('#[ 0:-]#', '', $date)===''; } +/** + * @param string $class + * @return bool|string + */ function mageFindClassFile($class) { $classFile = uc_words($class, DIRECTORY_SEPARATOR).'.php'; @@ -109,8 +112,10 @@ function mageFindClassFile($class) * @param string $errstr * @param string $errfile * @param integer $errline + * @return bool */ -function mageCoreErrorHandler($errno, $errstr, $errfile, $errline){ +function mageCoreErrorHandler($errno, $errstr, $errfile, $errline) +{ if (strpos($errstr, 'DateTimeZone::__construct')!==false) { // there's no way to distinguish between caught system exceptions and warnings return false; @@ -149,7 +154,7 @@ function mageCoreErrorHandler($errno, $errstr, $errfile, $errline){ $errorMessage = ''; - switch($errno){ + switch ($errno) { case E_ERROR: $errorMessage .= "Error"; break; @@ -205,19 +210,29 @@ function mageCoreErrorHandler($errno, $errstr, $errfile, $errline){ } } -function mageDebugBacktrace($return=false, $html=true, $showFirst=false) +/** + * @param bool $return + * @param bool $html + * @param bool $showFirst + * @return string + */ +function mageDebugBacktrace($return = false, $html = true, $showFirst = false) { $d = debug_backtrace(); $out = ''; - if ($html) $out .= "
";
-    foreach ($d as $i=>$r) {
+    if ($html) {
+        $out .= "
";
+    }
+    foreach ($d as $i => $r) {
         if (!$showFirst && $i==0) {
             continue;
         }
         // sometimes there is undefined index 'file'
         @$out .= "[$i] {$r['file']}:{$r['line']}\n";
     }
-    if ($html) $out .= "
"; + if ($html) { + $out .= "
"; + } if ($return) { return $out; } else { @@ -245,7 +260,11 @@ function mageSendErrorFooter() exit; } -function mageDelTree($path) { +/** + * @param string $path + */ +function mageDelTree($path) +{ if (is_dir($path)) { $entries = scandir($path); foreach ($entries as $entry) { @@ -259,7 +278,14 @@ function mageDelTree($path) { } } -function mageParseCsv($string, $delimiter=",", $enclosure='"', $escape='\\') +/** + * @param string $string + * @param string $delimiter + * @param string $enclosure + * @param string $escape + * @return array + */ +function mageParseCsv($string, $delimiter = ",", $enclosure = '"', $escape = '\\') { $elements = explode($delimiter, $string); for ($i = 0; $i < count($elements); $i++) { @@ -268,8 +294,12 @@ function mageParseCsv($string, $delimiter=",", $enclosure='"', $escape='\\') for ($j = $i+1; $j < count($elements); $j++) { if (substr_count($elements[$j], $enclosure) > 0) { // Put the quoted string's pieces back together again - array_splice($elements, $i, $j-$i+1, - implode($delimiter, array_slice($elements, $i, $j-$i+1))); + array_splice( + $elements, + $i, + $j-$i+1, + implode($delimiter, array_slice($elements, $i, $j-$i+1)) + ); break; } } @@ -285,6 +315,10 @@ function mageParseCsv($string, $delimiter=",", $enclosure='"', $escape='\\') return $elements; } +/** + * @param string $dir + * @return bool + */ function is_dir_writeable($dir) { if (is_dir($dir) && is_writable($dir)) { @@ -306,28 +340,31 @@ function is_dir_writeable($dir) return false; } -if ( !function_exists('sys_get_temp_dir') ) { +if (!function_exists('sys_get_temp_dir')) { // Based on http://www.phpit.net/ // article/creating-zip-tar-archives-dynamically-php/2/ + /** + * @return bool|string + */ function sys_get_temp_dir() { // Try to get from environment variable - if ( !empty($_ENV['TMP']) ) { - return realpath( $_ENV['TMP'] ); - } else if ( !empty($_ENV['TMPDIR']) ) { - return realpath( $_ENV['TMPDIR'] ); - } else if ( !empty($_ENV['TEMP']) ) { - return realpath( $_ENV['TEMP'] ); + if (!empty($_ENV['TMP'])) { + return realpath($_ENV['TMP']); + } elseif (!empty($_ENV['TMPDIR'])) { + return realpath($_ENV['TMPDIR']); + } elseif (!empty($_ENV['TEMP'])) { + return realpath($_ENV['TEMP']); } else { // Try to use system's temporary directory // as random name shouldn't exist - $temp_file = tempnam( md5(uniqid(rand(), TRUE)), '' ); - if ( $temp_file ) { - $temp_dir = realpath( dirname($temp_file) ); - unlink( $temp_file ); + $temp_file = tempnam(md5(uniqid(rand(), true)), ''); + if ($temp_file) { + $temp_dir = realpath(dirname($temp_file)); + unlink($temp_file); return $temp_dir; } else { - return FALSE; + return false; } } } diff --git a/app/code/core/Mage/Core/sql/core_setup/install-1.6.0.0.php b/app/code/core/Mage/Core/sql/core_setup/install-1.6.0.0.php index a72758232b6..8bb78f63127 100644 --- a/app/code/core/Mage/Core/sql/core_setup/install-1.6.0.0.php +++ b/app/code/core/Mage/Core/sql/core_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); @@ -75,12 +75,19 @@ 'unsigned' => true, 'default' => '0', ), 'Defines Is Website Default') - ->addIndex($installer->getIdxName('core/website', array('code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('code'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/website', array('sort_order')), - array('sort_order')) - ->addIndex($installer->getIdxName('core/website', array('default_group_id')), - array('default_group_id')) + ->addIndex( + $installer->getIdxName('core/website', array('code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + array('code'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/website', array('sort_order')), + array('sort_order') + ) + ->addIndex( + $installer->getIdxName('core/website', array('default_group_id')), + array('default_group_id') + ) ->setComment('Websites'); $installer->getConnection()->createTable($table); @@ -113,13 +120,22 @@ 'nullable' => false, 'default' => '0', ), 'Default Store Id') - ->addIndex($installer->getIdxName('core/store_group', array('website_id')), - array('website_id')) - ->addIndex($installer->getIdxName('core/store_group', array('default_store_id')), - array('default_store_id')) - ->addForeignKey($installer->getFkName('core/store_group', 'website_id', 'core/website', 'website_id'), - 'website_id', $installer->getTable('core/website'), 'website_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName('core/store_group', array('website_id')), + array('website_id') + ) + ->addIndex( + $installer->getIdxName('core/store_group', array('default_store_id')), + array('default_store_id') + ) + ->addForeignKey( + $installer->getFkName('core/store_group', 'website_id', 'core/website', 'website_id'), + 'website_id', + $installer->getTable('core/website'), + 'website_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Store Groups'); $installer->getConnection()->createTable($table); @@ -159,20 +175,39 @@ 'nullable' => false, 'default' => '0', ), 'Store Activity') - ->addIndex($installer->getIdxName('core/store', array('code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('code'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/store', array('website_id')), - array('website_id')) - ->addIndex($installer->getIdxName('core/store', array('is_active', 'sort_order')), - array('is_active', 'sort_order')) - ->addIndex($installer->getIdxName('core/store', array('group_id')), - array('group_id')) - ->addForeignKey($installer->getFkName('core/store', 'group_id', 'core/store_group', 'group_id'), - 'group_id', $installer->getTable('core/store_group'), 'group_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('core/store', 'website_id', 'core/website', 'website_id'), - 'website_id', $installer->getTable('core/website'), 'website_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName('core/store', array('code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + array('code'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/store', array('website_id')), + array('website_id') + ) + ->addIndex( + $installer->getIdxName('core/store', array('is_active', 'sort_order')), + array('is_active', 'sort_order') + ) + ->addIndex( + $installer->getIdxName('core/store', array('group_id')), + array('group_id') + ) + ->addForeignKey( + $installer->getFkName('core/store', 'group_id', 'core/store_group', 'group_id'), + 'group_id', + $installer->getTable('core/store_group'), + 'group_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('core/store', 'website_id', 'core/website', 'website_id'), + 'website_id', + $installer->getTable('core/website'), + 'website_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Stores'); $installer->getConnection()->createTable($table); @@ -200,9 +235,15 @@ 'default' => 'general', ), 'Config Path') ->addColumn('value', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(), 'Config Value') - ->addIndex($installer->getIdxName('core/config_data', array('scope', 'scope_id', 'path'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('scope', 'scope_id', 'path'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) + ->addIndex( + $installer->getIdxName( + 'core/config_data', + array('scope', 'scope_id', 'path'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('scope', 'scope_id', 'path'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) ->setComment('Config Data'); $installer->getConnection()->createTable($table); @@ -243,13 +284,23 @@ ), 'Original Template Code') ->addColumn('orig_template_variables', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array( ), 'Original Template Variables') - ->addIndex($installer->getIdxName('core/email_template', array('template_code'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('template_code'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/email_template', array('added_at')), - array('added_at')) - ->addIndex($installer->getIdxName('core/email_template', array('modified_at')), - array('modified_at')) + ->addIndex( + $installer->getIdxName( + 'core/email_template', + array('template_code'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('template_code'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/email_template', array('added_at')), + array('added_at') + ) + ->addIndex( + $installer->getIdxName('core/email_template', array('modified_at')), + array('modified_at') + ) ->setComment('Email Templates'); $installer->getConnection()->createTable($table); @@ -272,8 +323,10 @@ 'nullable' => false, 'default' => '0', ), 'Sort Order') - ->addIndex($installer->getIdxName('core/layout_update', array('handle')), - array('handle')) + ->addIndex( + $installer->getIdxName('core/layout_update', array('handle')), + array('handle') + ) ->setComment('Layout Updates'); $installer->getConnection()->createTable($table); @@ -304,19 +357,34 @@ 'nullable' => false, 'default' => '0', ), 'Layout Update Id') - ->addIndex($installer->getIdxName('core/layout_link', array('store_id', 'package', 'theme', 'layout_update_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + ->addIndex( + $installer->getIdxName( + 'core/layout_link', + array('store_id', 'package', 'theme', 'layout_update_id'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), array('store_id', 'package', 'theme', 'layout_update_id'), - array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/layout_link', array('layout_update_id')), - array('layout_update_id')) - ->addForeignKey($installer->getFkName('core/layout_link', 'store_id', 'core/store', 'store_id'), - 'store_id', $installer->getTable('core/store'), 'store_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/layout_link', array('layout_update_id')), + array('layout_update_id') + ) + ->addForeignKey( + $installer->getFkName('core/layout_link', 'store_id', 'core/store', 'store_id'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->addForeignKey( $installer->getFkName('core/layout_link', 'layout_update_id', 'core/layout_update', 'layout_update_id'), - 'layout_update_id', $installer->getTable('core/layout_update'), 'layout_update_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE + 'layout_update_id', + $installer->getTable('core/layout_update'), + 'layout_update_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE ) ->setComment('Layout Link'); $installer->getConnection()->createTable($table); @@ -367,14 +435,27 @@ 'nullable' => false, 'default' => 'en_US', ), 'Locale') - ->addIndex($installer->getIdxName('core/translate', array('store_id', 'locale', 'string'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('store_id', 'locale', 'string'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/translate', array('store_id')), - array('store_id')) - ->addForeignKey($installer->getFkName('core/translate', 'store_id', 'core/store', 'store_id'), - 'store_id', $installer->getTable('core/store'), 'store_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName( + 'core/translate', + array('store_id', 'locale', 'string'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('store_id', 'locale', 'string'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/translate', array('store_id')), + array('store_id') + ) + ->addForeignKey( + $installer->getFkName('core/translate', 'store_id', 'core/store', 'store_id'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Translations'); $installer->getConnection()->createTable($table); @@ -409,21 +490,44 @@ ), 'Options') ->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array( ), 'Deascription') - ->addIndex($installer->getIdxName('core/url_rewrite', array('request_path', 'store_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('request_path', 'store_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/url_rewrite', array('id_path', 'is_system', 'store_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('id_path', 'is_system', 'store_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/url_rewrite', array('target_path', 'store_id')), - array('target_path', 'store_id')) - ->addIndex($installer->getIdxName('core/url_rewrite', array('id_path')), - array('id_path')) - ->addIndex($installer->getIdxName('core/url_rewrite', array('store_id')), - array('store_id')) - ->addForeignKey($installer->getFkName('core/url_rewrite', 'store_id', 'core/store', 'store_id'), - 'store_id', $installer->getTable('core/store'), 'store_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName( + 'core/url_rewrite', + array('request_path', 'store_id'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('request_path', 'store_id'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName( + 'core/url_rewrite', + array('id_path', 'is_system', 'store_id'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('id_path', 'is_system', 'store_id'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/url_rewrite', array('target_path', 'store_id')), + array('target_path', 'store_id') + ) + ->addIndex( + $installer->getIdxName('core/url_rewrite', array('id_path')), + array('id_path') + ) + ->addIndex( + $installer->getIdxName('core/url_rewrite', array('store_id')), + array('store_id') + ) + ->addForeignKey( + $installer->getFkName('core/url_rewrite', 'store_id', 'core/store', 'store_id'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Url Rewrites'); $installer->getConnection()->createTable($table); @@ -448,11 +552,18 @@ ), 'First Date of Design Activity') ->addColumn('date_to', Varien_Db_Ddl_Table::TYPE_DATE, null, array( ), 'Last Date of Design Activity') - ->addIndex($installer->getIdxName('core/design_change', array('store_id')), - array('store_id')) - ->addForeignKey($installer->getFkName('core/design_change', 'store_id', 'core/store', 'store_id'), - 'store_id', $installer->getTable('core/store'), 'store_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName('core/design_change', array('store_id')), + array('store_id') + ) + ->addForeignKey( + $installer->getFkName('core/design_change', 'store_id', 'core/store', 'store_id'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Design Changes'); $installer->getConnection()->createTable($table); @@ -471,8 +582,11 @@ ), 'Variable Code') ->addColumn('name', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array( ), 'Variable Name') - ->addIndex($installer->getIdxName('core/variable', array('code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('code'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) + ->addIndex( + $installer->getIdxName('core/variable', array('code'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + array('code'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) ->setComment('Variables'); $installer->getConnection()->createTable($table); @@ -501,19 +615,39 @@ ), 'Plain Text Value') ->addColumn('html_value', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array( ), 'Html Value') - ->addIndex($installer->getIdxName('core/variable_value', array('variable_id', 'store_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('variable_id', 'store_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addIndex($installer->getIdxName('core/variable_value', array('variable_id')), - array('variable_id')) - ->addIndex($installer->getIdxName('core/variable_value', array('store_id')), - array('store_id')) - ->addForeignKey($installer->getFkName('core/variable_value', 'store_id', 'core/store', 'store_id'), - 'store_id', $installer->getTable('core/store'), 'store_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) - ->addForeignKey($installer->getFkName('core/variable_value', 'variable_id', 'core/variable', 'variable_id'), - 'variable_id', $installer->getTable('core/variable'), 'variable_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addIndex( + $installer->getIdxName( + 'core/variable_value', + array('variable_id', 'store_id'), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), + array('variable_id', 'store_id'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addIndex( + $installer->getIdxName('core/variable_value', array('variable_id')), + array('variable_id') + ) + ->addIndex( + $installer->getIdxName('core/variable_value', array('store_id')), + array('store_id') + ) + ->addForeignKey( + $installer->getFkName('core/variable_value', 'store_id', 'core/store', 'store_id'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('core/variable_value', 'variable_id', 'core/variable', 'variable_id'), + 'variable_id', + $installer->getTable('core/variable'), + 'variable_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Variable Value'); $installer->getConnection()->createTable($table); @@ -534,8 +668,10 @@ ), 'Time of Cache Updating') ->addColumn('expire_time', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( ), 'Cache Expiration Time') - ->addIndex($installer->getIdxName('core/cache', array('expire_time')), - array('expire_time')) + ->addIndex( + $installer->getIdxName('core/cache', array('expire_time')), + array('expire_time') + ) ->setComment('Caches'); $installer->getConnection()->createTable($table); @@ -552,8 +688,10 @@ 'nullable' => false, 'primary' => true, ), 'Cache Id') - ->addIndex($installer->getIdxName('core/cache_tag', array('cache_id')), - array('cache_id')) + ->addIndex( + $installer->getIdxName('core/cache_tag', array('cache_id')), + array('cache_id') + ) ->setComment('Tag Caches'); $installer->getConnection()->createTable($table); @@ -596,8 +734,10 @@ 'nullable' => false, 'default' => Varien_Db_Ddl_Table::TIMESTAMP_INIT_UPDATE, ), 'Date of Last Flag Update') - ->addIndex($installer->getIdxName('core/flag', array('last_update')), - array('last_update')) + ->addIndex( + $installer->getIdxName('core/flag', array('last_update')), + array('last_update') + ) ->setComment('Flag'); $installer->getConnection()->createTable($table); @@ -663,4 +803,3 @@ )); $installer->endSetup(); - diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-data-upgrade-1.6.0.2-1.6.0.3.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-data-upgrade-1.6.0.2-1.6.0.3.php index 85a9232f038..0151c6c9ed7 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-data-upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-data-upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $connection = $installer->getConnection(); $connection->update($installer->getTable('core/translate'), array( diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.7.0.php index 71bf7d5348e..4a6e2f5fb2d 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.7.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php index 717434dfa56..e47e0d47282 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-install-0.8.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.6.26-0.7.0.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.6.26-0.7.0.php index 72756fcb3d2..32b0998f072 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.6.26-0.7.0.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.6.26-0.7.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.1-0.7.2.php index f6a046deb18..6bbf49fe385 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.2-0.7.3.php index f166a5fd1e6..fc009abf33d 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php index ee884f491f9..3ee07afbc30 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.4-0.7.5.php index 3db845d4d4d..8aeb821ca9a 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); @@ -93,8 +93,7 @@ $rootCategoryId = 2; if (isset($rootCategoryIds['website'][$websiteRow['website_id']])) { $rootCategoryId = $rootCategoryIds['website'][$websiteRow['website_id']]; - } - elseif (isset($rootCategoryIds['default'][0])) { + } elseif (isset($rootCategoryIds['default'][0])) { $rootCategoryId = $rootCategoryIds['default'][0]; } $defaultStoreId = (int)$installer->getConnection() @@ -114,13 +113,15 @@ $groupId = $installer->getConnection()->lastInsertId(); // set group for store(s) $installer->getConnection() - ->update($this->getTable('core_store'), + ->update( + $this->getTable('core_store'), array('group_id'=>$groupId), $installer->getConnection()->quoteInto('website_id=?', $websiteRow['website_id']) ); // set created group as default for website $installer->getConnection() - ->update($this->getTable('core_website'), + ->update( + $this->getTable('core_website'), array('default_group_id'=>$groupId), $installer->getConnection()->quoteInto('website_id=?', $websiteRow['website_id']) ); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.5-0.7.6.php index d53367ad7cc..f7bc2cb52e0 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.6-0.7.7.php index e5856ba8827..e9cc63af1ec 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.7-0.7.8.php index 71bce573712..8fa372f33ee 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php index 75c9ef3792e..23f86f02221 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $configValuesMap = array( 'catalog/productalert/email_stock_template' => 'catalog_productalert_email_stock_template', @@ -51,6 +51,6 @@ 'wishlist/email/email_template' => 'wishlist_email_email_template', ); -foreach ($configValuesMap as $configPath=>$configValue) { +foreach ($configValuesMap as $configPath => $configValue) { $installer->setConfigData($configPath, $configValue); } diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.0-0.8.1.php index 0e7f10a48ec..6753f742ae6 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.1-0.8.2.php index 78d28831442..d897c714eb2 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.1-0.8.2.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.1-0.8.2.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php index 468096079a6..b7993cf44a0 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.10-0.8.11.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); @@ -42,8 +42,10 @@ $installer->getConnection()->addConstraint( 'FK_DESIGN_CHANGE_STORE', - $installer->getTable('design_change'), 'store_id', - $installer->getTable('core_store'), 'store_id' + $installer->getTable('design_change'), + 'store_id', + $installer->getTable('core_store'), + 'store_id' ); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php index f761b02adb7..af38536a442 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.11-0.8.12.php @@ -26,16 +26,24 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->getConnection()->changeColumn( - $installer->getTable('core_store'), 'name', 'name', 'varchar(255) not null', true + $installer->getTable('core_store'), + 'name', + 'name', + 'varchar(255) not null', + true ); $installer->getConnection()->changeColumn( - $installer->getTable('core_store_group'), 'name', 'name', 'varchar(255) not null', true + $installer->getTable('core_store_group'), + 'name', + 'name', + 'varchar(255) not null', + true ); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.12-0.8.13.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.12-0.8.13.php index 63f6da37bdc..18a3bb33a97 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.12-0.8.13.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.12-0.8.13.php @@ -26,11 +26,17 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); -$installer->getConnection()->addConstraint('FK_CORE_URL_REWRITE_STORE', - $installer->getTable('core/url_rewrite'), 'store_id', - $installer->getTable('core/store'), 'store_id', - 'CASCADE', 'CASCADE', true); +$installer->getConnection()->addConstraint( + 'FK_CORE_URL_REWRITE_STORE', + $installer->getTable('core/url_rewrite'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + 'CASCADE', + 'CASCADE', + true +); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.13-0.8.14.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.13-0.8.14.php index a2ee12054a6..a3c6137ff61 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.13-0.8.14.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.13-0.8.14.php @@ -26,7 +26,7 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->getConnection()->addColumn($installer->getTable('core/layout_update'), 'sort_order', "smallint(5) NOT NULL DEFAULT '0'"); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.14-0.8.15.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.14-0.8.15.php index 34235673c9b..e5ec2c59101 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.14-0.8.15.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.14-0.8.15.php @@ -26,7 +26,7 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->getConnection()->addColumn($installer->getTable('core/email_template'), 'orig_template_code', "VARCHAR(200) DEFAULT NULL"); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.15-0.8.16.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.15-0.8.16.php index 54af9ac86b9..4084225432b 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.15-0.8.16.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.15-0.8.16.php @@ -24,10 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); $installer->getConnection()->addColumn( - $installer->getTable('core_email_template'), 'template_styles', "text AFTER `template_text`" + $installer->getTable('core_email_template'), + 'template_styles', + "text AFTER `template_text`" ); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.16-0.8.17.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.16-0.8.17.php index 4193565bbeb..6cc98361078 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.16-0.8.17.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.16-0.8.17.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.17-0.8.18.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.17-0.8.18.php index e6a67d7f1ef..389d59b17ec 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.17-0.8.18.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.17-0.8.18.php @@ -24,12 +24,19 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); -$installer->getConnection()->addColumn($installer->getTable('core_email_variable'), - 'is_html', "tinyint(1) NOT NULL DEFAULT '0'"); -$installer->getConnection()->changeColumn($installer->getTable('core_email_variable_value'), - 'value', 'value', 'TEXT NOT NULL'); +$installer->getConnection()->addColumn( + $installer->getTable('core_email_variable'), + 'is_html', + "tinyint(1) NOT NULL DEFAULT '0'" +); +$installer->getConnection()->changeColumn( + $installer->getTable('core_email_variable_value'), + 'value', + 'value', + 'TEXT NOT NULL' +); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php index b3ca20bc3dd..f790247ab39 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.18-0.8.19.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); @@ -36,9 +36,19 @@ $installer->getConnection()->dropForeignKey($installer->getTable('core/variable_value'), 'FK_CORE_EMAIL_VARIABLE_VALUE_STORE_ID'); $installer->getConnection()->dropForeignKey($installer->getTable('core/variable_value'), 'FK_CORE_EMAIL_VARIABLE_VALUE_VARIABLE_ID'); -$installer->getConnection()->addConstraint('FK_CORE_VARIABLE_VALUE_STORE_ID', $installer->getTable('core/variable_value'), - 'store_id', $installer->getTable('core/store'), 'store_id'); -$installer->getConnection()->addConstraint('FK_CORE_VARIABLE_VALUE_VARIABLE_ID', $installer->getTable('core/variable_value'), - 'variable_id', $installer->getTable('core/variable'), 'variable_id'); +$installer->getConnection()->addConstraint( + 'FK_CORE_VARIABLE_VALUE_STORE_ID', + $installer->getTable('core/variable_value'), + 'store_id', + $installer->getTable('core/store'), + 'store_id' +); +$installer->getConnection()->addConstraint( + 'FK_CORE_VARIABLE_VALUE_VARIABLE_ID', + $installer->getTable('core/variable_value'), + 'variable_id', + $installer->getTable('core/variable'), + 'variable_id' +); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.19-0.8.20.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.19-0.8.20.php index bcbef989355..3c07eaad531 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.19-0.8.20.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.19-0.8.20.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); @@ -34,8 +34,11 @@ $select = $installer->getConnection()->select() ->from(array('main_table' => $installer->getTable('core/variable')), array()) - ->join(array('value_table' => $installer->getTable('core/variable_value')), - 'value_table.variable_id = main_table.variable_id', array()) + ->join( + array('value_table' => $installer->getTable('core/variable_value')), + 'value_table.variable_id = main_table.variable_id', + array() + ) ->columns(array('main_table.variable_id', 'main_table.is_html', 'value_table.value')); $data = array(); @@ -49,8 +52,11 @@ } foreach ($data as $variableId => $value) { - $installer->getConnection()->update($installer->getTable('core/variable_value'), $value, - array('variable_id = ?' => $variableId)); + $installer->getConnection()->update( + $installer->getTable('core/variable_value'), + $value, + array('variable_id = ?' => $variableId) + ); } $installer->getConnection()->dropColumn($installer->getTable('core/variable'), 'is_html'); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.2-0.8.3.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.2-0.8.3.php index 9dfe6c46320..eb0c775f522 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.2-0.8.3.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.2-0.8.3.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.20-0.8.21.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.20-0.8.21.php index a2a1d2d0685..75be77c4480 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.20-0.8.21.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.20-0.8.21.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->getConnection()->addColumn($installer->getTable('core/resource'), 'data_version', 'varchar(50)'); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.21-0.8.22.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.21-0.8.22.php index 8fb00ccd4cf..3a5fa87e583 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.21-0.8.22.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.21-0.8.22.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->run(" CREATE TABLE IF NOT EXISTS `{$installer->getTable('core/cache')}` ( diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.22-0.8.23.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.22-0.8.23.php index 74d7a75b3a7..2d604ea3898 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.22-0.8.23.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.22-0.8.23.php @@ -24,15 +24,20 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); -$installer->getConnection()->addColumn($installer->getTable('core/layout_link'), - 'area', "VARCHAR(64) NOT NULL DEFAULT '' AFTER `store_id`"); +$installer->getConnection()->addColumn( + $installer->getTable('core/layout_link'), + 'area', + "VARCHAR(64) NOT NULL DEFAULT '' AFTER `store_id`" +); -$installer->getConnection()->update($installer->getTable('core/layout_link'), - array('area' => Mage::getSingleton('core/design_package')->getArea())); +$installer->getConnection()->update( + $installer->getTable('core/layout_link'), + array('area' => Mage::getSingleton('core/design_package')->getArea()) +); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.23-0.8.24.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.23-0.8.24.php index 4dcb3535c79..b15c962c513 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.23-0.8.24.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.23-0.8.24.php @@ -25,7 +25,7 @@ */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.24-0.8.25.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.24-0.8.25.php index 3fbef1d2d93..9f99b13404b 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.24-0.8.25.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.24-0.8.25.php @@ -24,13 +24,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var Mage_Core_Model_Resource_Setup */ +/** @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); $installer->getConnection()->modifyColumn( - $this->getTable('core/flag'), 'flag_id', 'INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT' + $this->getTable('core/flag'), + 'flag_id', + 'INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT' ); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.26-0.8.27.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.26-0.8.27.php index f328977a0ff..687df772868 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.26-0.8.27.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.26-0.8.27.php @@ -24,6 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->getConnection()->dropForeignKey($installer->getTable('core/cache_tag'), 'FK_CORE_CACHE_TAG'); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.27-0.8.28.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.27-0.8.28.php index 043d5772ec3..1e482ce1ca7 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.27-0.8.28.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.27-0.8.28.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $tagsTableName = $installer->getTable('core/cache_tag'); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.3-0.8.4.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.3-0.8.4.php index 23d6ab09e91..bff9a17282e 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.3-0.8.4.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.3-0.8.4.php @@ -33,7 +33,7 @@ * @author Magento Core Team */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->run(" diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php index 94ab390f076..e63a77548e5 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php @@ -26,7 +26,7 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $conn = $installer->getConnection(); $table = $this->getTable('design_change'); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.5-0.8.6.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.5-0.8.6.php index 23574b89808..74b2325eecd 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.5-0.8.6.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.5-0.8.6.php @@ -33,7 +33,7 @@ * @author Magento Core Team */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); @@ -47,7 +47,8 @@ if ($row) { $whereBind = $installer->getConnection()->quoteInto('website_id=?', $row['website_id']); - $installer->getConnection()->update($installer->getTable('core_website'), + $installer->getConnection()->update( + $installer->getTable('core_website'), array('is_default' => 1), $whereBind ); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.6-0.8.7.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.6-0.8.7.php index a9ecb2ce91f..a085a61cad7 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.6-0.8.7.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.6-0.8.7.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.7-0.8.8.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.7-0.8.8.php index 87d8dc64f2d..2653d50c5a6 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.7-0.8.8.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.7-0.8.8.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php index 281e282bf05..7b04bd3cdbf 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.8-0.8.9.php @@ -25,12 +25,15 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->getConnection()->changeColumn( - $this->getTable('core_session'), 'session_data', 'session_data', 'MEDIUMBLOB NOT NULL' + $this->getTable('core_session'), + 'session_data', + 'session_data', + 'MEDIUMBLOB NOT NULL' ); $installer->endSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.9-0.8.10.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.9-0.8.10.php index 101df54db48..c6db19e3ee5 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.9-0.8.10.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.9-0.8.10.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php index 46807531869..4d6594ba20c 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php index dc891f802be..69c25dc3192 100644 --- a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php index bad2bd33c20..8eaccf58b0c 100644 --- a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php index 60b096feef4..3c1df4516c2 100644 --- a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php +++ b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php index 7098395c94e..d7f2b3357e1 100644 --- a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php +++ b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); @@ -65,7 +65,8 @@ 'core/email_queue', array('entity_id', 'entity_type', 'event_type', 'message_body_hash') ), - array('entity_id', 'entity_type', 'event_type', 'message_body_hash')) + array('entity_id', 'entity_type', 'event_type', 'message_body_hash') + ) ->setComment('Email Queue'); $installer->getConnection()->createTable($table); @@ -94,10 +95,14 @@ 'nullable' => false, 'default' => '0', ), 'Email Type') - ->addIndex($installer->getIdxName('core/email_recipients', array('recipient_email')), - array('recipient_email')) - ->addIndex($installer->getIdxName('core/email_recipients', array('email_type')), - array('email_type')) + ->addIndex( + $installer->getIdxName('core/email_recipients', array('recipient_email')), + array('recipient_email') + ) + ->addIndex( + $installer->getIdxName('core/email_recipients', array('email_type')), + array('email_type') + ) ->addIndex( $installer->getIdxName( 'core/email_recipients', @@ -105,12 +110,17 @@ Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE ), array('message_id', 'recipient_email', 'email_type'), - array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addForeignKey($installer->getFkName('core/email_recipients', 'message_id', 'core/email_queue', 'message_id'), - 'message_id', $installer->getTable('core/email_queue'), 'message_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addForeignKey( + $installer->getFkName('core/email_recipients', 'message_id', 'core/email_queue', 'message_id'), + 'message_id', + $installer->getTable('core/email_queue'), + 'message_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Email Queue'); $installer->getConnection()->createTable($table); $installer->endSetup(); - diff --git a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php index 09d799d8d7a..3aa60095abb 100644 --- a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php +++ b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php index b4f73e37378..0351e84e881 100644 --- a/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php +++ b/app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup();
Code ProfilerTimeCntEmallocRealMem
'.$name.''.number_format($sum,4).''.number_format($sum, 4).''.$count.''.number_format($emalloc).''.number_format($realmem).'