From c76ec23f731fca0e20b9a0430156593988be9181 Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 24 May 2019 00:49:12 +0200 Subject: [PATCH 01/11] Mage_Api - IDE improvements - added/fixed missing DOCs - changed @return to $this for methods - use @inheritdoc for methods that return parent call - added class check (instanceof) for those methods (instead adding @var SomeClass) - added class check (instanceof) for mysql related methods in setup scripts - changed magic methods on Varien_Objects to setData()/getData() - flipped @var annotations --- app/code/core/Mage/Api/Controller/Action.php | 3 + app/code/core/Mage/Api/Exception.php | 11 +++- app/code/core/Mage/Api/Helper/Data.php | 11 ++-- .../core/Mage/Api/Model/Acl/Assert/Ip.php | 9 ++- .../core/Mage/Api/Model/Acl/Assert/Time.php | 9 ++- .../core/Mage/Api/Model/Acl/Role/Registry.php | 2 +- app/code/core/Mage/Api/Model/Config.php | 46 ++++++++++---- .../core/Mage/Api/Model/Resource/Abstract.php | 4 +- .../core/Mage/Api/Model/Resource/Acl/Role.php | 13 ++-- .../core/Mage/Api/Model/Resource/Role.php | 24 +++---- .../core/Mage/Api/Model/Resource/Roles.php | 55 +++++++--------- .../core/Mage/Api/Model/Resource/User.php | 34 +++++----- app/code/core/Mage/Api/Model/Roles.php | 34 ++++++++-- app/code/core/Mage/Api/Model/Rules.php | 19 +++++- app/code/core/Mage/Api/Model/Server.php | 6 +- .../Mage/Api/Model/Server/Adapter/Soap.php | 18 ++++-- .../Api/Model/Server/Handler/Abstract.php | 12 +++- .../Mage/Api/Model/Server/V2/Adapter/Soap.php | 4 +- .../core/Mage/Api/Model/Server/V2/Handler.php | 6 +- .../Api/Model/Server/Wsi/Adapter/Soap.php | 6 +- .../Mage/Api/Model/Server/Wsi/Handler.php | 16 ++--- app/code/core/Mage/Api/Model/Session.php | 63 ++++++++++++++++--- app/code/core/Mage/Api/Model/User.php | 34 ++++++---- app/code/core/Mage/Api/Model/Wsdl/Config.php | 26 +++++++- .../core/Mage/Api/Model/Wsdl/Config/Base.php | 17 ++++- .../Mage/Api/Model/Wsdl/Config/Element.php | 18 ++++-- .../Mage/Api/controllers/IndexController.php | 2 +- .../Mage/Api/controllers/SoapController.php | 2 +- .../Api/controllers/V2/SoapController.php | 2 +- .../Api/sql/api_setup/install-1.6.0.0.php | 2 +- .../sql/api_setup/mysql4-install-0.7.0.php | 2 +- .../api_setup/mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../api_setup/mysql4-upgrade-0.8.0-0.8.1.php | 2 +- .../mysql4-upgrade-1.5.9.9-1.6.0.0.php | 7 ++- .../mysql4-upgrade-1.6.0.0-1.6.0.1.php | 2 +- 35 files changed, 349 insertions(+), 174 deletions(-) diff --git a/app/code/core/Mage/Api/Controller/Action.php b/app/code/core/Mage/Api/Controller/Action.php index 53a2d147ffa..ab319cdd434 100644 --- a/app/code/core/Mage/Api/Controller/Action.php +++ b/app/code/core/Mage/Api/Controller/Action.php @@ -32,6 +32,9 @@ */ class Mage_Api_Controller_Action extends Mage_Core_Controller_Front_Action { + /** + * @return $this + */ public function preDispatch() { $this->getLayout()->setArea('adminhtml'); diff --git a/app/code/core/Mage/Api/Exception.php b/app/code/core/Mage/Api/Exception.php index 63d0618266c..1677643ed3e 100644 --- a/app/code/core/Mage/Api/Exception.php +++ b/app/code/core/Mage/Api/Exception.php @@ -35,7 +35,12 @@ class Mage_Api_Exception extends Mage_Core_Exception { protected $_customMessage = null; - public function __construct($faultCode, $customMessage=null) + /** + * Mage_Api_Exception constructor. + * @param string $faultCode + * @param string|null $customMessage + */ + public function __construct($faultCode, $customMessage = null) { parent::__construct($faultCode); $this->_customMessage = $customMessage; @@ -44,10 +49,10 @@ public function __construct($faultCode, $customMessage=null) /** * Custom error message, if error is not in api. * - * @return unknown + * @return string */ public function getCustomMessage() { return $this->_customMessage; } -} // Class Mage_Api_Model_Resource_Exception End +} diff --git a/app/code/core/Mage/Api/Helper/Data.php b/app/code/core/Mage/Api/Helper/Data.php index 416c12ce84e..af86c5b7038 100644 --- a/app/code/core/Mage/Api/Helper/Data.php +++ b/app/code/core/Mage/Api/Helper/Data.php @@ -57,7 +57,6 @@ public function isComplianceWSI() * Go through a WSI args array and turns it to correct state. * * @param Object $obj - Link to Object - * @return Object */ public function wsiArrayUnpacker(&$obj) { @@ -90,7 +89,7 @@ public function wsiArrayUnpacker(&$obj) * Go through an object parameters and unpack associative object to array. * * @param Object $obj - Link to Object - * @return Object + * @return bool */ public function v2AssociativeArrayUnpacker(&$obj) { @@ -167,7 +166,7 @@ public function associativeArrayUnpack(&$mixed) * Corrects data representation. * * @param Object $obj - Link to Object - * @return Object + * @return array */ public function clearWsiFootprints(&$obj) { @@ -222,10 +221,10 @@ public function wsiArrayPacker($mixed) /** * For response to the WSI, generates an object from array. * - * @param Array $arr - Link to Object - * @return Object + * @param array $arr - Link to Object + * @return stdClass */ - public function packArrayToObject(Array $arr) + public function packArrayToObject(array $arr) { $obj = new stdClass(); $obj->complexObjectArray = $arr; diff --git a/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php b/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php index 5ee6ddf99ce..f3ca99747d5 100644 --- a/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php +++ b/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php @@ -37,9 +37,9 @@ class Mage_Api_Model_Acl_Assert_Ip implements Zend_Acl_Assert_Interface /** * Check whether ip is allowed * - * @param Zend_Acl $acl - * @param Zend_Acl_Role_Interface $role - * @param Zend_Acl_Resource_Interface $resource + * @param Mage_Api_Model_Acl $acl + * @param Mage_Api_Model_Acl_Role $role + * @param Mage_Api_Model_Acl_Resource $resource * @param string $privilege * @return boolean */ @@ -49,6 +49,9 @@ public function assert(Mage_Api_Model_Acl $acl, Mage_Api_Model_Acl_Role $role = return $this->_isCleanIP(Mage::helper('core/http')->getRemoteAddr()); } + /** + * @param $ip + */ protected function _isCleanIP($ip) { // ... diff --git a/app/code/core/Mage/Api/Model/Acl/Assert/Time.php b/app/code/core/Mage/Api/Model/Acl/Assert/Time.php index 65275a74a14..b157fccc979 100644 --- a/app/code/core/Mage/Api/Model/Acl/Assert/Time.php +++ b/app/code/core/Mage/Api/Model/Acl/Assert/Time.php @@ -37,9 +37,9 @@ class Mage_Api_Model_Acl_Assert_Time implements Zend_Acl_Assert_Interface /** * Assert time * - * @param Zend_Acl $acl - * @param Zend_Acl_Role_Interface $role - * @param Zend_Acl_Resource_Interface $resource + * @param Mage_Api_Model_Acl $acl + * @param Mage_Api_Model_Acl_Role $role + * @param Mage_Api_Model_Acl_Resource $resource * @param string $privilege * @return boolean */ @@ -49,6 +49,9 @@ public function assert(Mage_Api_Model_Acl $acl, Mage_Api_Model_Acl_Role $role = return $this->_isCleanTime(time()); } + /** + * @param $time + */ protected function _isCleanTime($time) { // ... diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php index b7713795a4b..f8ff8d000b2 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php +++ b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php @@ -39,7 +39,7 @@ class Mage_Api_Model_Acl_Role_Registry extends Zend_Acl_Role_Registry * * @param Zend_Acl_Role_Interface|string $role * @param array|Zend_Acl_Role_Interface|string $parents - * @return Mage_Auth_Model_Acl_Role_Registry + * @return $this */ function addParent($role, $parents) { diff --git a/app/code/core/Mage/Api/Model/Config.php b/app/code/core/Mage/Api/Model/Config.php index 46bae65c75b..dcb85a65456 100644 --- a/app/code/core/Mage/Api/Model/Config.php +++ b/app/code/core/Mage/Api/Model/Config.php @@ -38,9 +38,10 @@ class Mage_Api_Model_Config extends Varien_Simplexml_Config /** * Constructor * + * @param null $sourceData * @see Varien_Simplexml_Config */ - public function __construct($sourceData=null) + public function __construct($sourceData = null) { $this->setCacheId('config_api'); $this->setCacheTags(array(self::CACHE_TAG)); @@ -99,7 +100,7 @@ public function getAdapters() { $adapters = array(); foreach ($this->getNode('adapters')->children() as $adapterName => $adapter) { - /* @var $adapter Varien_SimpleXml_Element */ + /* @var Varien_SimpleXml_Element $adapter */ if (isset($adapter->use)) { $adapter = $this->getNode('adapters/' . (string) $adapter->use); } @@ -138,7 +139,7 @@ public function getActiveAdapters() /** * Retrieve handlers * - * @return Varien_Simplexml_Element + * @return SimpleXMLElement */ public function getHandlers() { @@ -148,7 +149,7 @@ public function getHandlers() /** * Retrieve resources * - * @return Varien_Simplexml_Element + * @return SimpleXMLElement */ public function getResources() { @@ -158,7 +159,7 @@ public function getResources() /** * Retrieve resources alias * - * @return Varien_Simplexml_Element + * @return SimpleXMLElement */ public function getResourcesAlias() { @@ -174,7 +175,7 @@ public function getResourcesAlias() * @param string $parentName * @return $this */ - public function loadAclResources(Mage_Api_Model_Acl $acl, $resource=null, $parentName=null) + public function loadAclResources(Mage_Api_Model_Acl $acl, $resource = null, $parentName = null) { $resourceName = null; if (is_null($resource)) { @@ -202,7 +203,7 @@ public function loadAclResources(Mage_Api_Model_Acl $acl, $resource=null, $paren * Get acl assert config * * @param string $name - * @return Mage_Core_Model_Config_Element|boolean + * @return bool|Mage_Core_Model_Config_Element|SimpleXMLElement */ public function getAclAssert($name='') { @@ -222,12 +223,12 @@ public function getAclAssert($name='') * Retrieve privilege set by name * * @param string $name - * @return Mage_Core_Model_Config_Element|boolean + * @return bool|Mage_Core_Model_Config_Element|SimpleXMLElement */ - public function getAclPrivilegeSet($name='') + public function getAclPrivilegeSet($name = '') { $sets = $this->getNode('acl/privilegeSets'); - if (''===$name) { + if ('' === $name) { return $sets; } @@ -238,7 +239,11 @@ public function getAclPrivilegeSet($name='') return false; } - public function getFaults($resourceName=null) + /** + * @param string|null $resourceName + * @return array + */ + public function getFaults($resourceName = null) { if (is_null($resourceName) || !isset($this->getResources()->$resourceName) @@ -247,7 +252,7 @@ public function getFaults($resourceName=null) } else { $faultsNode = $this->getResources()->$resourceName->faults; } - /* @var $faultsNode Varien_Simplexml_Element */ + /* @var Varien_Simplexml_Element $faultsNode */ $translateModule = 'api'; if (isset($faultsNode['module'])) { @@ -268,23 +273,38 @@ public function getFaults($resourceName=null) /** * Retrieve cache object * - * @return Zend_Cache_Frontend_File + * @return Zend_Cache_Core */ public function getCache() { return Mage::app()->getCache(); } + /** + * @param string $id + * @return bool|mixed + */ protected function _loadCache($id) { return Mage::app()->loadCache($id); } + /** + * @param string $data + * @param string $id + * @param array $tags + * @param bool $lifetime + * @return bool|Mage_Core_Model_App + */ protected function _saveCache($data, $id, $tags=array(), $lifetime=false) { return Mage::app()->saveCache($data, $id, $tags, $lifetime); } + /** + * @param string $id + * @return Mage_Core_Model_App + */ protected function _removeCache($id) { return Mage::app()->removeCache($id); diff --git a/app/code/core/Mage/Api/Model/Resource/Abstract.php b/app/code/core/Mage/Api/Model/Resource/Abstract.php index 4c1ce3f779c..bbc4358a5e7 100644 --- a/app/code/core/Mage/Api/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Api/Model/Resource/Abstract.php @@ -97,8 +97,10 @@ protected function _getServer() * Dispatches fault * * @param string $code + * @param string|null $customMessage + * @throws Mage_Api_Exception */ - protected function _fault($code, $customMessage=null) + protected function _fault($code, $customMessage = null) { throw new Mage_Api_Exception($code, $customMessage); } diff --git a/app/code/core/Mage/Api/Model/Resource/Acl/Role.php b/app/code/core/Mage/Api/Model/Resource/Acl/Role.php index 2219837e619..45e7c8a95af 100644 --- a/app/code/core/Mage/Api/Model/Resource/Acl/Role.php +++ b/app/code/core/Mage/Api/Model/Resource/Acl/Role.php @@ -28,6 +28,8 @@ /** * ACL role resource * + * @method $this setCreated(string $value) + * * @category Mage * @package Mage_Api * @author Magento Core Team @@ -44,16 +46,13 @@ protected function _construct() } /** - * Action before save - * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @inheritDoc */ - protected function _beforeSave(Mage_Core_Model_Abstract $object) + protected function _beforeSave(Mage_Core_Model_Abstract $role) { - if (!$object->getId()) { + if (!$role->getId()) { $this->setCreated(Mage::getSingleton('core/date')->gmtDate()); } - return $this; + return parent::_beforeSave($role); } } diff --git a/app/code/core/Mage/Api/Model/Resource/Role.php b/app/code/core/Mage/Api/Model/Resource/Role.php index 85f6ac997df..4535d198adc 100644 --- a/app/code/core/Mage/Api/Model/Resource/Role.php +++ b/app/code/core/Mage/Api/Model/Resource/Role.php @@ -44,27 +44,21 @@ protected function _construct() } /** - * Action before save - * - * @param Mage_Core_Model_Abstract $object - * @return $this + * @inheritDoc */ - protected function _beforeSave(Mage_Core_Model_Abstract $object) + protected function _beforeSave(Mage_Core_Model_Abstract $role) { - if (!$object->getId()) { - $object->setCreated(now()); + if ($role instanceof Mage_Admin_Model_Role) { + if (!$role->getId()) { + $role->setCreated(now()); + } + $role->setModified(now()); } - $object->setModified(now()); - return $this; + return parent::_beforeSave($role); } /** - * Load an object - * - * @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 + * @inheritDoc */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) { diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php index e8e4fcf0799..2b6d06ea590 100644 --- a/app/code/core/Mage/Api/Model/Resource/Roles.php +++ b/app/code/core/Mage/Api/Model/Resource/Roles.php @@ -37,14 +37,14 @@ class Mage_Api_Model_Resource_Roles extends Mage_Core_Model_Resource_Db_Abstract /** * User table name * - * @var unknown + * @var string */ protected $_usersTable; /** * Rule table name * - * @var unknown + * @var string */ protected $_ruleTable; @@ -61,63 +61,56 @@ protected function _construct() } /** - * Action before save - * - * @param Mage_Core_Model_Abstract $role - * @return $this + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $role) { - if ($role->getId() == '') { - if ($role->getIdFieldName()) { - $role->unsetData($role->getIdFieldName()); - } else { - $role->unsetData('id'); + if ($role instanceof Mage_Admin_Model_Roles) { + if ($role->getId() == '') { + if ($role->getIdFieldName()) { + $role->unsetData($role->getIdFieldName()); + } else { + $role->unsetData('id'); + } } - } - if ($role->getPid() > 0) { - $row = $this->load($role->getPid()); - } else { - $row = array('tree_level' => 0); + if ($role->getPid() > 0) { + $row = $this->load($role->getPid()); + } else { + $row = array('tree_level' => 0); + } + $role->setTreeLevel($row['tree_level'] + 1); + $role->setRoleName($role->getName()); } - $role->setTreeLevel($row['tree_level'] + 1); - $role->setRoleName($role->getName()); - return $this; - } + return parent::_beforeSave($role); + } /** - * Action after save - * - * @param Mage_Core_Model_Abstract $role - * @return $this + * @inheritDoc */ protected function _afterSave(Mage_Core_Model_Abstract $role) { $this->_updateRoleUsersAcl($role); Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG); - return $this; + return parent::_afterSave($role); } /** - * Action after delete - * - * @param Mage_Core_Model_Abstract $role - * @return $this + * @inheritDoc */ protected function _afterDelete(Mage_Core_Model_Abstract $role) { $adapter = $this->_getWriteAdapter(); $adapter->delete($this->getMainTable(), array('parent_id=?'=>$role->getId())); $adapter->delete($this->_ruleTable, array('role_id=?'=>$role->getId())); - return $this; + return parent::_afterDelete($role); } /** * Get role users * * @param Mage_Api_Model_Roles $role - * @return unknown + * @return array */ public function getRoleUsers(Mage_Api_Model_Roles $role) { diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 5592c37d106..b184ce7daaa 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -193,8 +193,8 @@ public function clearBySessId($sessid) /** * Retrieve api user role data if it was assigned to role * - * @param int | Mage_Api_Model_User $user - * @return null | array + * @param int|Mage_Api_Model_User $user + * @return null|array */ public function hasAssigned2Role($user) { @@ -224,10 +224,12 @@ public function hasAssigned2Role($user) */ protected function _beforeSave(Mage_Core_Model_Abstract $user) { - if (!$user->getId()) { - $user->setCreated(now()); + if ($user instanceof Mage_Api_Model_User) { + if (!$user->getId()) { + $user->setCreated(now()); + } + $user->setModified(now()); } - $user->setModified(now()); return $this; } @@ -259,10 +261,10 @@ public function delete(Mage_Core_Model_Abstract $user) /** * Save user roles * - * @param Mage_Core_Model_Abstract $user - * @return unknown + * @param Mage_Api_Model_User $user + * @return $this|Mage_Api_Model_User */ - public function _saveRelations(Mage_Core_Model_Abstract $user) + public function _saveRelations(Mage_Api_Model_User $user) { $rolesIds = $user->getRoleIds(); if (!is_array($rolesIds) || count($rolesIds) == 0) { @@ -335,10 +337,10 @@ public function _getRoles(Mage_Core_Model_Abstract $user) /** * Add Role * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Api_Model_User $user * @return $this */ - public function add(Mage_Core_Model_Abstract $user) + public function add(Mage_Api_Model_User $user) { $adapter = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); @@ -371,10 +373,10 @@ public function add(Mage_Core_Model_Abstract $user) /** * Delete from role * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Api_Model_User $user * @return $this */ - public function deleteFromRole(Mage_Core_Model_Abstract $user) + public function deleteFromRole(Mage_Api_Model_User $user) { if ($user->getUserId() <= 0) { return $this; @@ -397,10 +399,10 @@ public function deleteFromRole(Mage_Core_Model_Abstract $user) /** * Retrieve roles which exists for user * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Api_Model_User $user * @return array */ - public function roleUserExists(Mage_Core_Model_Abstract $user) + public function roleUserExists(Mage_Api_Model_User $user) { $result = array(); if ($user->getUserId() > 0) { @@ -416,10 +418,10 @@ public function roleUserExists(Mage_Core_Model_Abstract $user) /** * Check if user not unique * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Api_Model_User $user * @return array */ - public function userExists(Mage_Core_Model_Abstract $user) + public function userExists(Mage_Api_Model_User $user) { $usersTable = $this->getTable('api/user'); $adapter = $this->_getReadAdapter(); diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php index f70d62ad4cf..1069ccb88d4 100644 --- a/app/code/core/Mage/Api/Model/Roles.php +++ b/app/code/core/Mage/Api/Model/Roles.php @@ -63,37 +63,64 @@ protected function _construct() $this->_init('api/roles'); } + /** + * @return $this + */ public function update() { $this->getResource()->update($this); return $this; } + /** + * @return Mage_Api_Model_Resource_Roles_User_Collection + */ public function getUsersCollection() { return Mage::getResourceModel('api/roles_user_collection'); } + /** + * @return array|false|Varien_Simplexml_Element + */ public function getResourcesTree() { return $this->_buildResourcesArray(null, null, null, null, true); } + /** + * @return array|false|Varien_Simplexml_Element + */ public function getResourcesList() { return $this->_buildResourcesArray(); } + /** + * @return array|false|Varien_Simplexml_Element + */ public function getResourcesList2D() { return $this->_buildResourcesArray(null, null, null, true); } + /** + * @return array + */ public function getRoleUsers() { return $this->getResource()->getRoleUsers($this); } + /** + * @param Varien_Simplexml_Element|null $resource + * @param string|null $parentName + * @param int $level + * @param bool|null $represent2Darray + * @param bool $rawNodes + * @param string $module + * @return array|false|Varien_Simplexml_Element + */ protected function _buildResourcesArray( Varien_Simplexml_Element $resource = null, $parentName = null, $level = 0, $represent2Darray = null, $rawNodes = false, $module = 'adminhtml' @@ -152,13 +179,12 @@ protected function _buildResourcesArray( /** * Filter data before save * - * @return $this + * {@inheritDoc} */ protected function _beforeSave() { $this->filter(); - parent::_beforeSave(); - return $this; + return parent::_beforeSave(); } /** @@ -172,7 +198,7 @@ public function filter() if (!$this->_filters || !$data) { return $this; } - /** @var $filter Mage_Core_Model_Input_Filter */ + /** @var Mage_Core_Model_Input_Filter $filter */ $filter = Mage::getModel('core/input_filter'); $filter->setFilters($this->_filters); $this->setData($filter->filter($data)); diff --git a/app/code/core/Mage/Api/Model/Rules.php b/app/code/core/Mage/Api/Model/Rules.php index c5ff981d07a..ea885db9339 100644 --- a/app/code/core/Mage/Api/Model/Rules.php +++ b/app/code/core/Mage/Api/Model/Rules.php @@ -53,16 +53,29 @@ protected function _construct() $this->_init('api/rules'); } - public function update() { + /** + * @return $this + */ + public function update() + { $this->getResource()->update($this); return $this; } - public function getCollection() { + /** + * @return Mage_Api_Model_Resource_Permissions_Collection + */ + public function getCollection() + { return Mage::getResourceModel('api/permissions_collection'); } - public function saveRel() { + /** + * @return $this + * @throws Mage_Core_Exception + */ + public function saveRel() + { $this->getResource()->saveRel($this); return $this; } diff --git a/app/code/core/Mage/Api/Model/Server.php b/app/code/core/Mage/Api/Model/Server.php index a9fefb4542d..c00958578d5 100644 --- a/app/code/core/Mage/Api/Model/Server.php +++ b/app/code/core/Mage/Api/Model/Server.php @@ -55,7 +55,7 @@ class Mage_Api_Model_Server */ public function getAdapterCodeByAlias($alias) { - /** @var $config Mage_Api_Model_Config */ + /** @var Mage_Api_Model_Config $config */ $config = Mage::getSingleton('api/config'); $aliases = $config->getAdapterAliases(); @@ -97,12 +97,12 @@ public function init(Mage_Api_Controller_Action $controller, $adapter = 'default */ public function initialize($adapterCode, $handler = null) { - /** @var $helper Mage_Api_Model_Config */ + /** @var Mage_Api_Model_Config $helper */ $helper = Mage::getSingleton('api/config'); $adapters = $helper->getActiveAdapters(); if (isset($adapters[$adapterCode])) { - /** @var $adapterModel Mage_Api_Model_Server_Adapter_Interface */ + /** @var Mage_Api_Model_Server_Adapter_Interface $adapterModel */ $adapterModel = Mage::getModel((string) $adapters[$adapterCode]->model); if (!($adapterModel instanceof Mage_Api_Model_Server_Adapter_Interface)) { diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php index 3c1d10e4a82..272cc0e9cad 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php @@ -70,9 +70,13 @@ protected function _getWsdlConfig() unset($queryParams['wsdl']); } - $wsdlConfig->setUrl(Mage::helper('api')->getServiceUrl('*/*/*', array('_query' => $queryParams), true)); - $wsdlConfig->setName('Magento'); - $wsdlConfig->setHandler($this->getHandler()); + $wsdlConfig->setData('url', Mage::helper('api')->getServiceUrl( + '*/*/*', + array('_query' => $queryParams), + true + )); + $wsdlConfig->setData('name', 'Magento'); + $wsdlConfig->setData('handler', $this->getHandler()); return $wsdlConfig; } @@ -132,8 +136,8 @@ public function getController() /** * Run webservice * - * @param Mage_Api_Controller_Action $controller * @return $this + * @throws SoapFault */ public function run() { @@ -220,8 +224,10 @@ protected function _extensionLoaded() /** * Transform wsdl url if $_SERVER["PHP_AUTH_USER"] is set * - * @param array - * @return String + * @param array $params + * @param bool $withAuth + * @return string + * @throws Zend_Uri_Exception */ protected function getWsdlUrl($params = null, $withAuth = true) { diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 2d38e8056f4..6e84c9f238d 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -41,6 +41,12 @@ public function __construct() Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMINHTML, Mage_Core_Model_App_Area::PART_EVENTS); } + /** + * @param int $errorCode + * @param string $errorMessage + * @param string $errorFile + * @return bool + */ public function handlePhpError($errorCode, $errorMessage, $errorFile) { Mage::log($errorMessage . $errorFile); @@ -314,7 +320,7 @@ public function call($sessionId, $apiPath, $args = array()) * @param string $sessionId * @param array $calls * @param array $options - * @return array + * @return array|void */ public function multiCall($sessionId, array $calls = array(), $options = array()) { @@ -440,7 +446,7 @@ public function multiCall($sessionId, array $calls = array(), $options = array() * List of available resources * * @param string $sessionId - * @return array + * @return array|void */ public function resources($sessionId) { @@ -505,7 +511,7 @@ public function resources($sessionId) * * @param string $sessionId * @param string $resourceName - * @return array + * @return array|void */ public function resourceFaults($sessionId, $resourceName) { diff --git a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php index ac64c7adeef..0d964c67061 100644 --- a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php @@ -49,8 +49,8 @@ protected function _getWsdlConfig() /** * Run webservice * - * @param Mage_Api_Controller_Action $controller * @return Mage_Api_Model_Server_Adapter_Soap + * @throws SoapFault */ public function run() { @@ -64,7 +64,7 @@ public function run() preg_replace( '/<\?xml version="([^\"]+)"([^\>]+)>/i', '', - $this->wsdlConfig->getWsdlContent() + $this->wsdlConfig->getData('wsdl_content') ) ); } else { diff --git a/app/code/core/Mage/Api/Model/Server/V2/Handler.php b/app/code/core/Mage/Api/Model/Server/V2/Handler.php index 34f11838a34..78c3ee6defe 100644 --- a/app/code/core/Mage/Api/Model/Server/V2/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/V2/Handler.php @@ -38,11 +38,11 @@ class Mage_Api_Model_Server_V2_Handler extends Mage_Api_Model_Server_Handler_Abs /** * Interceptor for all interfaces * - * @param sttring $function + * @param string $function * @param array $args + * @return mixed */ - - public function __call( $function, $args ) + public function __call($function, $args) { $sessionId = array_shift( $args ); $apiKey = ''; diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php index f8d1a9ba54d..09e885ec37c 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php @@ -49,8 +49,8 @@ protected function _getWsdlConfig() /** * Run webservice * - * @param Mage_Api_Controller_Action $controller - * @return Mage_Api_Model_Server_Adapter_Soap + * @return $this + * @throws SoapFault */ public function run() { @@ -73,7 +73,7 @@ public function run() preg_replace( '/<\?xml version="([^\"]+)"([^\>]+)>/i', '', - $this->wsdlConfig->getWsdlContent() + $this->wsdlConfig->getData('wsdl_content') ) ) ) diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php index 7937be092bd..875b13588ae 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php @@ -40,8 +40,8 @@ class Mage_Api_Model_Server_WSI_Handler extends Mage_Api_Model_Server_Handler_Ab * * @param string $function * @param array $args + * @return stdClass */ - public function __call ($function, $args) { $args = $args[0]; @@ -93,7 +93,7 @@ public function __call ($function, $args) */ public function login($username, $apiKey = null) { - if (is_object($username)) { + if (is_object($username) && isset($username->apiKey) && isset($username->username)) { $apiKey = $username->apiKey; $username = $username->username; } @@ -107,7 +107,7 @@ public function login($username, $apiKey = null) * Return called class and method names * * @param String $apiPath - * @return Array + * @return array|void */ protected function _getResourceName($apiPath){ @@ -139,7 +139,7 @@ protected function _getResourceName($apiPath){ * * @param String $modelName * @param String $methodName - * @return Array of ReflectionParameter + * @return array of ReflectionParameter */ public function getMethodParams($modelName, $methodName) { @@ -151,15 +151,15 @@ public function getMethodParams($modelName, $methodName) { /** * Prepares arguments for the method calling. Sort in correct order, set default values for omitted parameters. * - * @param Array $params - * @param Array $args - * @return Array + * @param array $params + * @param array $args + * @return array */ public function prepareArgs($params, $args) { $callArgs = array(); - /** @var $parameter ReflectionParameter */ + /** @var ReflectionParameter $parameter */ foreach($params AS $parameter){ $pName = $parameter->getName(); if( isset( $args[$pName] ) ){ diff --git a/app/code/core/Mage/Api/Model/Session.php b/app/code/core/Mage/Api/Model/Session.php index 39131d2deb6..7df0f5bc264 100644 --- a/app/code/core/Mage/Api/Model/Session.php +++ b/app/code/core/Mage/Api/Model/Session.php @@ -27,6 +27,11 @@ /** * Webservice api session * + * @method Mage_Api_Model_User getUser() + * @method $this setUser(Mage_Api_Model_User $user) + * @method Mage_Api_Model_Acl getAcl() + * @method $this setAcl(Mage_Api_Model_Acl $loadAcl) + * * @category Mage * @package Mage_Api * @author Magento Core Team @@ -36,7 +41,11 @@ class Mage_Api_Model_Session extends Mage_Core_Model_Session_Abstract public $sessionIds = array(); protected $_currentSessId = null; - public function start($sessionName=null) + /** + * @param string|null $sessionName + * @return $this + */ + public function start($sessionName = null) { // parent::start($sessionName=null); $this->_currentSessId = md5(time() . uniqid('', true) . $sessionName); @@ -44,7 +53,12 @@ public function start($sessionName=null) return $this; } - public function init($namespace, $sessionName=null) + /** + * @param string $namespace + * @param string|null $sessionName + * @return $this + */ + public function init($namespace, $sessionName = null) { if (is_null($this->_currentSessId)) { $this->start(); @@ -52,11 +66,18 @@ public function init($namespace, $sessionName=null) return $this; } + /** + * @return string + */ public function getSessionId() { return $this->_currentSessId; } + /** + * @param string|null $sessId + * @return $this + */ public function setSessionId($sessId = null) { if (!is_null($sessId)) { @@ -65,12 +86,19 @@ public function setSessionId($sessId = null) return $this; } + /** + * @return void + */ public function revalidateCookie() { // In api we don't use cookies } - public function clear() { + /** + * @return bool + */ + public function clear() + { if ($sessId = $this->getSessionId()) { try { Mage::getModel('api/user')->logoutBySessId($sessId); @@ -81,13 +109,19 @@ public function clear() { return true; } + /** + * @param string $username + * @param string $apiKey + * @return mixed + * @throws Mage_Core_Exception + */ public function login($username, $apiKey) { $user = Mage::getModel('api/user') ->setSessid($this->getSessionId()) ->login($username, $apiKey); - if ( $user->getId() && $user->getIsActive() != '1' ) { + if ($user->getId() && $user->getIsActive() != '1') { Mage::throwException(Mage::helper('api')->__('Your account has been deactivated.')); } elseif (!Mage::getModel('api/user')->hasAssigned2Role($user->getId())) { Mage::throwException(Mage::helper('api')->__('Access denied.')); @@ -103,7 +137,11 @@ public function login($username, $apiKey) return $user; } - public function refreshAcl($user=null) + /** + * @param Mage_Api_Model_User|null $user + * @return $this + */ + public function refreshAcl($user = null) { if (is_null($user)) { $user = $this->getUser(); @@ -153,18 +191,24 @@ public function isAllowed($resource, $privilege=null) /** * Check session expiration * - * @return boolean + * @param Mage_Api_Model_User $user + * @return boolean */ - public function isSessionExpired ($user) + public function isSessionExpired($user) { if (!$user->getId()) { return true; } - $timeout = strtotime( now() ) - strtotime( $user->getLogdate() ); + $timeout = strtotime(now()) - strtotime($user->getLogdate()); return $timeout > Mage::getStoreConfig('api/config/session_timeout'); } + /** + * @param string|false $sessId + * @return bool + * @throws Mage_Core_Exception + */ public function isLoggedIn($sessId = false) { $userExists = $this->getUser() && $this->getUser()->getId(); @@ -203,5 +247,4 @@ protected function _renewBySessId ($sessId) } return false; } - -} // Class Mage_Api_Model_Session End +} diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php index f06182f7b06..73d0442a3cf 100644 --- a/app/code/core/Mage/Api/Model/User.php +++ b/app/code/core/Mage/Api/Model/User.php @@ -30,25 +30,33 @@ * @method Mage_Api_Model_Resource_User _getResource() * @method Mage_Api_Model_Resource_User getResource() * @method string getFirstname() - * @method Mage_Api_Model_User setFirstname(string $value) + * @method $this setFirstname(string $value) * @method string getLastname() - * @method Mage_Api_Model_User setLastname(string $value) + * @method $this setLastname(string $value) * @method string getEmail() - * @method Mage_Api_Model_User setEmail(string $value) + * @method $this setEmail(string $value) * @method string getUsername() - * @method Mage_Api_Model_User setUsername(string $value) + * @method $this setUsername(string $value) * @method string getApiKey() - * @method Mage_Api_Model_User setApiKey(string $value) + * @method $this setApiKey(string $value) * @method string getCreated() - * @method Mage_Api_Model_User setCreated(string $value) + * @method $this setCreated(string $value) * @method string getModified() - * @method Mage_Api_Model_User setModified(string $value) + * @method $this setModified(string $value) * @method int getLognum() - * @method Mage_Api_Model_User setLognum(int $value) + * @method $this setLognum(int $value) * @method int getReloadAclFlag() - * @method Mage_Api_Model_User setReloadAclFlag(int $value) + * @method $this setReloadAclFlag(int $value) * @method int getIsActive() - * @method Mage_Api_Model_User setIsActive(int $value) + * @method $this setIsActive(int $value) + * @method string getSessid() + * @method $this setSessid($sessId) + * @method string getNewApiKey() + * @method string getUserId() + * @method string getLogdate() + * @method int getRoleId() + * @method array getRoleIds() + * @method $this setLogdate(string $value) * * @category Mage * @package Mage_Api @@ -227,7 +235,7 @@ public function getId() */ public function getAclRole() { - return 'U'.$this->getUserId(); + return 'U' . $this->getUserId(); } /** @@ -342,7 +350,9 @@ public function hasAssigned2Role($user) */ protected function _getEncodedApiKey($apiKey) { - return $this->_getHelper('core')->getHash($apiKey, Mage_Admin_Model_User::HASH_SALT_LENGTH); + /** @var Mage_Core_Helper_Data $helper */ + $helper = $this->_getHelper('core'); + return $helper->getHash($apiKey, Mage_Admin_Model_User::HASH_SALT_LENGTH); } /** diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config.php b/app/code/core/Mage/Api/Model/Wsdl/Config.php index b1bdd3f5865..e07b45b91f9 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config.php @@ -35,6 +35,9 @@ class Mage_Api_Model_Wsdl_Config extends Mage_Api_Model_Wsdl_Config_Base { protected static $_namespacesPrefix = null; + /** + * @inheritDoc + */ public function __construct($sourceData=null) { $this->setCacheId(Mage::helper('api')->getCacheId()); @@ -68,26 +71,47 @@ public static function getNamespacesPrefix() return self::$_namespacesPrefix; } + /** + * @return Varien_Simplexml_Config_Cache_Abstract|Zend_Cache_Core + */ public function getCache() { return Mage::app()->getCache(); } + /** + * @param string $id + * @return bool|mixed + */ protected function _loadCache($id) { return Mage::app()->loadCache($id); } - protected function _saveCache($data, $id, $tags=array(), $lifetime=false) + /** + * @param string $data + * @param string $id + * @param array $tags + * @param bool $lifetime + * @return bool|Mage_Core_Model_App + */ + protected function _saveCache($data, $id, $tags = array(), $lifetime = false) { return Mage::app()->saveCache($data, $id, $tags, $lifetime); } + /** + * @param string $id + * @return Mage_Core_Model_App + */ protected function _removeCache($id) { return Mage::app()->removeCache($id); } + /** + * @return $this + */ public function init() { $this->setCacheChecksum(null); diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php index ab61a719561..51e24e1dda6 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php @@ -42,7 +42,10 @@ class Mage_Api_Model_Wsdl_Config_Base extends Varien_Simplexml_Config protected $_loadedFiles = array(); - public function __construct($sourceData=null) + /** + * @inheritDoc + */ + public function __construct($sourceData = null) { $this->_elementClass = 'Mage_Api_Model_Wsdl_Config_Element'; @@ -90,16 +93,20 @@ public function getHandler() */ public function processFileData($text) { - /** @var $template Mage_Core_Model_Email_Template_Filter */ + /** @var Mage_Core_Model_Email_Template_Filter $template */ $template = Mage::getModel('core/email_template_filter'); - $this->_wsdlVariables->setHandler($this->getHandler()); + $this->_wsdlVariables->setData('handler', $this->getHandler()); $template->setVariables(array('wsdl'=>$this->_wsdlVariables)); return $template->filter($text); } + /** + * @param string $file + * @return $this + */ public function addLoadedFile($file) { if (!in_array($file, $this->_loadedFiles)) { @@ -108,6 +115,10 @@ public function addLoadedFile($file) return $this; } + /** + * @param string $file + * @return $this|false + */ public function loadFile($file) { if (in_array($file, $this->_loadedFiles)) { diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php index c9f4eb3d533..ede25dcf138 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config/Element.php @@ -33,7 +33,12 @@ */ class Mage_Api_Model_Wsdl_Config_Element extends Varien_Simplexml_Element { - public function extend($source, $overwrite=false) + /** + * @param Varien_Simplexml_Element $source + * @param bool $overwrite + * @return $this|Varien_Simplexml_Element + */ + public function extend($source, $overwrite = false) { if (!$source instanceof Varien_Simplexml_Element) { return $this; @@ -53,9 +58,10 @@ public function extend($source, $overwrite=false) * * @param Varien_Simplexml_Element $source * @param boolean $overwrite + * @param string $elmNamespace * @return Varien_Simplexml_Element */ - public function extendChild($source, $overwrite=false, $elmNamespace = '') + public function extendChild($source, $overwrite = false, $elmNamespace = '') { // this will be our new target node $targetChild = null; @@ -144,6 +150,7 @@ public function extendChild($source, $overwrite=false, $elmNamespace = '') * ) * * @param Varien_Simplexml_Element $source + * @param null|string $namespace * @return array */ public function getAttributes($source, $namespace = null) @@ -168,6 +175,7 @@ public function getAttributes($source, $namespace = null) * Return children of all namespaces * * @param Varien_Simplexml_Element $source + * @return array */ public function getChildren($source) { @@ -210,8 +218,8 @@ public function hasChildren() * Return element by tag name, and checking attributes with namespaces * * @param Varien_Simplexml_Element $source - * @param string $namespace - * @return null|Varien_Simplexml_Element + * @param string $elmNamespace + * @return SimpleXMLElement|Varien_Simplexml_Element|null */ public function getElementByName($source, $elmNamespace = '') { @@ -255,6 +263,8 @@ public function getElementByName($source, $elmNamespace = '') /** * Returns attribute value by attribute name * + * @param string $name + * @param string $namespace * @return string */ public function getAttribute($name, $namespace = ''){ diff --git a/app/code/core/Mage/Api/controllers/IndexController.php b/app/code/core/Mage/Api/controllers/IndexController.php index d0a74fc7aa4..8f790311582 100644 --- a/app/code/core/Mage/Api/controllers/IndexController.php +++ b/app/code/core/Mage/Api/controllers/IndexController.php @@ -35,7 +35,7 @@ class Mage_Api_IndexController extends Mage_Api_Controller_Action { public function indexAction() { - /* @var $server Mage_Api_Model_Server */ + /* @var Mage_Api_Model_Server $server */ $this->_getServer()->init($this) ->run(); } diff --git a/app/code/core/Mage/Api/controllers/SoapController.php b/app/code/core/Mage/Api/controllers/SoapController.php index 3067f886ec9..ccafd1efef3 100644 --- a/app/code/core/Mage/Api/controllers/SoapController.php +++ b/app/code/core/Mage/Api/controllers/SoapController.php @@ -35,7 +35,7 @@ class Mage_Api_SoapController extends Mage_Api_Controller_Action { public function indexAction() { - /* @var $server Mage_Api_Model_Server */ + /* @var Mage_Api_Model_Server $server */ $this->_getServer()->init($this, 'soap') ->run(); } diff --git a/app/code/core/Mage/Api/controllers/V2/SoapController.php b/app/code/core/Mage/Api/controllers/V2/SoapController.php index fa6ddd09663..d51141f6966 100644 --- a/app/code/core/Mage/Api/controllers/V2/SoapController.php +++ b/app/code/core/Mage/Api/controllers/V2/SoapController.php @@ -41,7 +41,7 @@ public function indexAction() $handler_name = 'soap_v2'; } - /* @var $server Mage_Api_Model_Server */ + /* @var Mage_Api_Model_Server $server */ $this->_getServer()->init($this, $handler_name, $handler_name) ->run(); } diff --git a/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php b/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php index 87ddb2075fb..dc3de84219b 100644 --- a/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php +++ b/app/code/core/Mage/Api/sql/api_setup/install-1.6.0.0.php @@ -32,7 +32,7 @@ * @author Magento Core Team */ $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/Api/sql/api_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-install-0.7.0.php index 56d5e4daf57..351cf1c10be 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Api/sql/api_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/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php index aeb8861abe7..6cff2cc380c 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -33,7 +33,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->run("ALTER TABLE {$this->getTable('api_user')} ADD `sessid` VARCHAR(40) NOT NULL AFTER `lognum`;"); diff --git a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php index 2c9842ff371..7a53e2050d1 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-0.8.0-0.8.1.php @@ -31,7 +31,7 @@ * @author Magento Core Team */ -/* @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/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php index a5b0610da06..557fc624211 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ b/app/code/core/Mage/Api/sql/api_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(); @@ -283,7 +283,10 @@ ) ); -$installer->getConnection()->modifyTables($tables); +$connection = $installer->getConnection(); +if ($connection instanceof Varien_Db_Adapter_Pdo_Mysql) { + $connection->modifyTables($tables); +} $installer->getConnection()->changeColumn( $installer->getTable('api/rule'), diff --git a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php index c756fd70537..bb0ef3ce98a 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.6.0.0-1.6.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $this Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $this */ $this->startSetup(); $this->getConnection()->changeColumn( From 51e4b6a1dbae6bf250428d6a4395789d90199b48 Mon Sep 17 00:00:00 2001 From: sreichel Date: Tue, 28 May 2019 16:25:15 +0200 Subject: [PATCH 02/11] Reverted all changes in code (just left renamed methods on Varien_Objects) --- .../core/Mage/Api/Model/Resource/Acl/Role.php | 11 +++-- .../core/Mage/Api/Model/Resource/Role.php | 17 ++++--- .../core/Mage/Api/Model/Resource/Roles.php | 49 +++++++++++-------- .../core/Mage/Api/Model/Resource/User.php | 30 ++++++------ app/code/core/Mage/Api/Model/Roles.php | 5 +- .../Mage/Api/Model/Server/Adapter/Soap.php | 6 +-- .../Mage/Api/Model/Server/Wsi/Handler.php | 2 +- app/code/core/Mage/Api/Model/User.php | 4 +- .../mysql4-upgrade-1.5.9.9-1.6.0.0.php | 5 +- 9 files changed, 65 insertions(+), 64 deletions(-) diff --git a/app/code/core/Mage/Api/Model/Resource/Acl/Role.php b/app/code/core/Mage/Api/Model/Resource/Acl/Role.php index 45e7c8a95af..fc25e91bfda 100644 --- a/app/code/core/Mage/Api/Model/Resource/Acl/Role.php +++ b/app/code/core/Mage/Api/Model/Resource/Acl/Role.php @@ -46,13 +46,16 @@ protected function _construct() } /** - * @inheritDoc + * Action before save + * + * @param Mage_Core_Model_Abstract $object + * @return $this */ - protected function _beforeSave(Mage_Core_Model_Abstract $role) + protected function _beforeSave(Mage_Core_Model_Abstract $object) { - if (!$role->getId()) { + if (!$object->getId()) { $this->setCreated(Mage::getSingleton('core/date')->gmtDate()); } - return parent::_beforeSave($role); + return $this; } } diff --git a/app/code/core/Mage/Api/Model/Resource/Role.php b/app/code/core/Mage/Api/Model/Resource/Role.php index 4535d198adc..de577264824 100644 --- a/app/code/core/Mage/Api/Model/Resource/Role.php +++ b/app/code/core/Mage/Api/Model/Resource/Role.php @@ -44,17 +44,18 @@ protected function _construct() } /** - * @inheritDoc + * Action before save + * + * @param Mage_Core_Model_Abstract $object + * @return $this */ - protected function _beforeSave(Mage_Core_Model_Abstract $role) + protected function _beforeSave(Mage_Core_Model_Abstract $object) { - if ($role instanceof Mage_Admin_Model_Role) { - if (!$role->getId()) { - $role->setCreated(now()); - } - $role->setModified(now()); + if (!$object->getId()) { + $object->setCreated(now()); } - return parent::_beforeSave($role); + $object->setModified(now()); + return $this; } /** diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php index 2b6d06ea590..2d4e00d1465 100644 --- a/app/code/core/Mage/Api/Model/Resource/Roles.php +++ b/app/code/core/Mage/Api/Model/Resource/Roles.php @@ -61,49 +61,56 @@ protected function _construct() } /** - * @inheritDoc + * Action before save + * + * @param Mage_Core_Model_Abstract $role + * @return $this */ protected function _beforeSave(Mage_Core_Model_Abstract $role) { - if ($role instanceof Mage_Admin_Model_Roles) { - if ($role->getId() == '') { - if ($role->getIdFieldName()) { - $role->unsetData($role->getIdFieldName()); - } else { - $role->unsetData('id'); - } - } - - if ($role->getPid() > 0) { - $row = $this->load($role->getPid()); + if ($role->getId() == '') { + if ($role->getIdFieldName()) { + $role->unsetData($role->getIdFieldName()); } else { - $row = array('tree_level' => 0); + $role->unsetData('id'); } - $role->setTreeLevel($row['tree_level'] + 1); - $role->setRoleName($role->getName()); } - return parent::_beforeSave($role); - } + + if ($role->getPid() > 0) { + $row = $this->load($role->getPid()); + } else { + $row = array('tree_level' => 0); + } + $role->setTreeLevel($row['tree_level'] + 1); + $role->setRoleName($role->getName()); + return $this; + } /** - * @inheritDoc + * Action after save + * + * @param Mage_Core_Model_Abstract $role + * @return $this */ protected function _afterSave(Mage_Core_Model_Abstract $role) { $this->_updateRoleUsersAcl($role); Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG); - return parent::_afterSave($role); + return $this; } /** - * @inheritDoc + * Action after delete + * + * @param Mage_Core_Model_Abstract $role + * @return $this */ protected function _afterDelete(Mage_Core_Model_Abstract $role) { $adapter = $this->_getWriteAdapter(); $adapter->delete($this->getMainTable(), array('parent_id=?'=>$role->getId())); $adapter->delete($this->_ruleTable, array('role_id=?'=>$role->getId())); - return parent::_afterDelete($role); + return $this; } /** diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index b184ce7daaa..80822908614 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -224,12 +224,10 @@ public function hasAssigned2Role($user) */ protected function _beforeSave(Mage_Core_Model_Abstract $user) { - if ($user instanceof Mage_Api_Model_User) { - if (!$user->getId()) { - $user->setCreated(now()); - } - $user->setModified(now()); + if (!$user->getId()) { + $user->setCreated(now()); } + $user->setModified(now()); return $this; } @@ -261,10 +259,10 @@ public function delete(Mage_Core_Model_Abstract $user) /** * Save user roles * - * @param Mage_Api_Model_User $user - * @return $this|Mage_Api_Model_User + * @param Mage_Core_Model_Abstract $user + * @return $this|Mage_Core_Model_Abstract */ - public function _saveRelations(Mage_Api_Model_User $user) + public function _saveRelations(Mage_Core_Model_Abstract $user) { $rolesIds = $user->getRoleIds(); if (!is_array($rolesIds) || count($rolesIds) == 0) { @@ -337,10 +335,10 @@ public function _getRoles(Mage_Core_Model_Abstract $user) /** * Add Role * - * @param Mage_Api_Model_User $user + * @param Mage_Core_Model_Abstract $user * @return $this */ - public function add(Mage_Api_Model_User $user) + public function add(Mage_Core_Model_Abstract $user) { $adapter = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); @@ -373,10 +371,10 @@ public function add(Mage_Api_Model_User $user) /** * Delete from role * - * @param Mage_Api_Model_User $user + * @param Mage_Core_Model_Abstract $user * @return $this */ - public function deleteFromRole(Mage_Api_Model_User $user) + public function deleteFromRole(Mage_Core_Model_Abstract $user) { if ($user->getUserId() <= 0) { return $this; @@ -399,10 +397,10 @@ public function deleteFromRole(Mage_Api_Model_User $user) /** * Retrieve roles which exists for user * - * @param Mage_Api_Model_User $user + * @param Mage_Core_Model_Abstract $user * @return array */ - public function roleUserExists(Mage_Api_Model_User $user) + public function roleUserExists(Mage_Core_Model_Abstract $user) { $result = array(); if ($user->getUserId() > 0) { @@ -418,10 +416,10 @@ public function roleUserExists(Mage_Api_Model_User $user) /** * Check if user not unique * - * @param Mage_Api_Model_User $user + * @param Mage_Core_Model_Abstract $user * @return array */ - public function userExists(Mage_Api_Model_User $user) + public function userExists(Mage_Core_Model_Abstract $user) { $usersTable = $this->getTable('api/user'); $adapter = $this->_getReadAdapter(); diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php index 1069ccb88d4..965f148ef54 100644 --- a/app/code/core/Mage/Api/Model/Roles.php +++ b/app/code/core/Mage/Api/Model/Roles.php @@ -179,12 +179,13 @@ protected function _buildResourcesArray( /** * Filter data before save * - * {@inheritDoc} + * @return $this */ protected function _beforeSave() { $this->filter(); - return parent::_beforeSave(); + parent::_beforeSave(); + return $this; } /** diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php index 272cc0e9cad..d1883abfd6f 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php @@ -70,11 +70,7 @@ protected function _getWsdlConfig() unset($queryParams['wsdl']); } - $wsdlConfig->setData('url', Mage::helper('api')->getServiceUrl( - '*/*/*', - array('_query' => $queryParams), - true - )); + $wsdlConfig->setData('url', Mage::helper('api')->getServiceUrl('*/*/*', array('_query' => $queryParams), true)); $wsdlConfig->setData('name', 'Magento'); $wsdlConfig->setData('handler', $this->getHandler()); return $wsdlConfig; diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php index 875b13588ae..9f0a4387e70 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php @@ -93,7 +93,7 @@ public function __call ($function, $args) */ public function login($username, $apiKey = null) { - if (is_object($username) && isset($username->apiKey) && isset($username->username)) { + if (is_object($username)) { $apiKey = $username->apiKey; $username = $username->username; } diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php index 73d0442a3cf..d6896abe762 100644 --- a/app/code/core/Mage/Api/Model/User.php +++ b/app/code/core/Mage/Api/Model/User.php @@ -350,9 +350,7 @@ public function hasAssigned2Role($user) */ protected function _getEncodedApiKey($apiKey) { - /** @var Mage_Core_Helper_Data $helper */ - $helper = $this->_getHelper('core'); - return $helper->getHash($apiKey, Mage_Admin_Model_User::HASH_SALT_LENGTH); + return $this->_getHelper('core')->getHash($apiKey, Mage_Admin_Model_User::HASH_SALT_LENGTH); } /** diff --git a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php index 557fc624211..5ae66888b1b 100644 --- a/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ b/app/code/core/Mage/Api/sql/api_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php @@ -283,10 +283,7 @@ ) ); -$connection = $installer->getConnection(); -if ($connection instanceof Varien_Db_Adapter_Pdo_Mysql) { - $connection->modifyTables($tables); -} +$installer->getConnection()->modifyTables($tables); $installer->getConnection()->changeColumn( $installer->getTable('api/rule'), From 0f686cac90d3dd8988b83ba2f2c76864aca2d3d1 Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:19:31 +0200 Subject: [PATCH 03/11] Fixed some annotation --- app/code/core/Mage/Api/Model/Acl.php | 4 ++-- app/code/core/Mage/Api/Model/Resource/Acl.php | 2 +- app/code/core/Mage/Api/Model/Resource/Role.php | 2 +- .../Mage/Api/Model/Resource/Role/Collection.php | 2 +- app/code/core/Mage/Api/Model/Resource/Roles.php | 2 +- app/code/core/Mage/Api/Model/Resource/Rules.php | 1 + .../Mage/Api/Model/Resource/Rules/Collection.php | 2 +- app/code/core/Mage/Api/Model/Resource/User.php | 8 ++++---- app/code/core/Mage/Api/Model/Role.php | 14 ++++++++------ app/code/core/Mage/Api/Model/Roles.php | 13 +++++++------ .../core/Mage/Api/Model/Server/Adapter/Soap.php | 6 +++--- .../Mage/Api/Model/Server/Handler/Abstract.php | 4 ++-- .../Mage/Api/Model/Server/Wsi/Adapter/Soap.php | 2 +- app/code/core/Mage/Api/Model/User.php | 2 +- app/code/core/Mage/Api/Model/Wsdl/Config/Base.php | 2 +- .../core/Mage/Api/controllers/IndexController.php | 2 +- .../core/Mage/Api/controllers/SoapController.php | 2 +- .../Mage/Api/controllers/V2/SoapController.php | 2 +- .../core/Mage/Api/controllers/XmlrpcController.php | 2 +- 19 files changed, 39 insertions(+), 35 deletions(-) diff --git a/app/code/core/Mage/Api/Model/Acl.php b/app/code/core/Mage/Api/Model/Acl.php index f91c79d6268..5cc8a925343 100644 --- a/app/code/core/Mage/Api/Model/Acl.php +++ b/app/code/core/Mage/Api/Model/Acl.php @@ -91,8 +91,8 @@ protected function _getRoleRegistry() /** * Add parent to role object * - * @param Zend_Acl_Role $role - * @param Zend_Acl_Role $parent + * @param Zend_Acl_Role_Interface|string $role + * @param array|Zend_Acl_Role_Interface|string $parent * @return $this */ public function addRoleParent($role, $parent) diff --git a/app/code/core/Mage/Api/Model/Resource/Acl.php b/app/code/core/Mage/Api/Model/Resource/Acl.php index 68b0182ac4a..a042c0bda40 100644 --- a/app/code/core/Mage/Api/Model/Resource/Acl.php +++ b/app/code/core/Mage/Api/Model/Resource/Acl.php @@ -78,7 +78,7 @@ public function loadAcl() * Load roles * * @param Mage_Api_Model_Acl $acl - * @param array $rolesArr + * @param array[] $rolesArr * @return $this */ public function loadRoles(Mage_Api_Model_Acl $acl, array $rolesArr) diff --git a/app/code/core/Mage/Api/Model/Resource/Role.php b/app/code/core/Mage/Api/Model/Resource/Role.php index de577264824..aeaff60e72e 100644 --- a/app/code/core/Mage/Api/Model/Resource/Role.php +++ b/app/code/core/Mage/Api/Model/Resource/Role.php @@ -46,7 +46,7 @@ protected function _construct() /** * Action before save * - * @param Mage_Core_Model_Abstract $object + * @param Mage_Core_Model_Abstract|Mage_Api_Model_Role $object * @return $this */ protected function _beforeSave(Mage_Core_Model_Abstract $object) diff --git a/app/code/core/Mage/Api/Model/Resource/Role/Collection.php b/app/code/core/Mage/Api/Model/Resource/Role/Collection.php index 65306844697..045a8f6047e 100644 --- a/app/code/core/Mage/Api/Model/Resource/Role/Collection.php +++ b/app/code/core/Mage/Api/Model/Resource/Role/Collection.php @@ -46,7 +46,7 @@ protected function _construct() /** * Aet user filter * - * @param int $userId + * @param string $userId * @return $this */ public function setUserFilter($userId) diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php index 2d4e00d1465..dce6e67a6a7 100644 --- a/app/code/core/Mage/Api/Model/Resource/Roles.php +++ b/app/code/core/Mage/Api/Model/Resource/Roles.php @@ -63,7 +63,7 @@ protected function _construct() /** * Action before save * - * @param Mage_Core_Model_Abstract $role + * @param Mage_Core_Model_Abstract|Mage_Api_Model_Roles $role * @return $this */ protected function _beforeSave(Mage_Core_Model_Abstract $role) diff --git a/app/code/core/Mage/Api/Model/Resource/Rules.php b/app/code/core/Mage/Api/Model/Resource/Rules.php index 4e6b30fc4e4..7934328cb8c 100644 --- a/app/code/core/Mage/Api/Model/Resource/Rules.php +++ b/app/code/core/Mage/Api/Model/Resource/Rules.php @@ -50,6 +50,7 @@ protected function _construct() */ public function saveRel(Mage_Api_Model_Rules $rule) { + $permission = ''; $adapter = $this->_getWriteAdapter(); $adapter->beginTransaction(); diff --git a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php index 98c34a0acc5..491657b14a4 100644 --- a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php +++ b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php @@ -46,7 +46,7 @@ protected function _construct() /** * Retrieve rules by role * - * @param int $id + * @param string $id * @return $this */ public function getByRoles($id) diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 80822908614..915df9f2ebc 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -193,8 +193,8 @@ public function clearBySessId($sessid) /** * Retrieve api user role data if it was assigned to role * - * @param int|Mage_Api_Model_User $user - * @return null|array + * @param int|Mage_Api_Model_User|Mage_Core_Model_Abstract $user + * @return array|null */ public function hasAssigned2Role($user) { @@ -219,8 +219,8 @@ public function hasAssigned2Role($user) /** * Action before save * - * @param Mage_Core_Model_Abstract $user - * @return $this + * @param Mage_Api_Model_User $user + * @inheritDoc */ protected function _beforeSave(Mage_Core_Model_Abstract $user) { diff --git a/app/code/core/Mage/Api/Model/Role.php b/app/code/core/Mage/Api/Model/Role.php index 5a1323dcbd4..4283576db5c 100644 --- a/app/code/core/Mage/Api/Model/Role.php +++ b/app/code/core/Mage/Api/Model/Role.php @@ -30,17 +30,19 @@ * @method Mage_Api_Model_Resource_Role _getResource() * @method Mage_Api_Model_Resource_Role getResource() * @method int getParentId() - * @method Mage_Api_Model_Role setParentId(int $value) + * @method $this setParentId(int $value) * @method int getTreeLevel() - * @method Mage_Api_Model_Role setTreeLevel(int $value) + * @method $this setTreeLevel(int $value) * @method int getSortOrder() - * @method Mage_Api_Model_Role setSortOrder(int $value) + * @method $this setSortOrder(int $value) * @method string getRoleType() - * @method Mage_Api_Model_Role setRoleType(string $value) + * @method $this setRoleType(string $value) * @method int getUserId() - * @method Mage_Api_Model_Role setUserId(int $value) + * @method $this setUserId(int $value) * @method string getRoleName() - * @method Mage_Api_Model_Role setRoleName(string $value) + * @method $this setRoleName(string $value) + * @method $this setCreated(string $value) + * @method $this setModified(string $value) * * @category Mage * @package Mage_Api diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php index 965f148ef54..f4b5b240161 100644 --- a/app/code/core/Mage/Api/Model/Roles.php +++ b/app/code/core/Mage/Api/Model/Roles.php @@ -30,19 +30,20 @@ * @method Mage_Api_Model_Resource_Roles _getResource() * @method Mage_Api_Model_Resource_Roles getResource() * @method int getParentId() - * @method Mage_Api_Model_Roles setParentId(int $value) + * @method $this setParentId(int $value) * @method int getTreeLevel() - * @method Mage_Api_Model_Roles setTreeLevel(int $value) + * @method $this setTreeLevel(int $value) * @method int getSortOrder() - * @method Mage_Api_Model_Roles setSortOrder(int $value) + * @method $this setSortOrder(int $value) * @method string getRoleType() - * @method Mage_Api_Model_Roles setRoleType(string $value) + * @method $this setRoleType(string $value) * @method int getUserId() - * @method Mage_Api_Model_Roles setUserId(int $value) + * @method $this setUserId(int $value) * @method string getRoleName() - * @method Mage_Api_Model_Roles setRoleName(string $value) + * @method $this setRoleName(string $value) * @method string getName() * @method Mage_Api_Model_Role setName() setName(string $name) + * @method int getPid() * * @category Mage * @package Mage_Api diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php index d1883abfd6f..53f7b5daf06 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php @@ -70,9 +70,9 @@ protected function _getWsdlConfig() unset($queryParams['wsdl']); } - $wsdlConfig->setData('url', Mage::helper('api')->getServiceUrl('*/*/*', array('_query' => $queryParams), true)); - $wsdlConfig->setData('name', 'Magento'); - $wsdlConfig->setData('handler', $this->getHandler()); + $wsdlConfig->setUrl(Mage::helper('api')->getServiceUrl('*/*/*', array('_query' => $queryParams), true)); + $wsdlConfig->setName('Magento'); + $wsdlConfig->setHandler($this->getHandler()); return $wsdlConfig; } diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 6e84c9f238d..efccac0d7f2 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -581,7 +581,7 @@ public function processingMethodResult($result) * Prepare Api row data for XML exporting * Convert not allowed symbol to numeric character reference * - * @param $row + * @param mixed $row * @return mixed */ public function processingRow($row) @@ -595,4 +595,4 @@ function ($matches) { ); return $row; } -} // Class Mage_Api_Model_Server_Handler_Abstract End +} diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php index 09e885ec37c..96ae0cc8033 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php @@ -73,7 +73,7 @@ public function run() preg_replace( '/<\?xml version="([^\"]+)"([^\>]+)>/i', '', - $this->wsdlConfig->getData('wsdl_content') + $this->wsdlConfig->getWsdlContent() ) ) ) diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php index d6896abe762..fd898dcdbf7 100644 --- a/app/code/core/Mage/Api/Model/User.php +++ b/app/code/core/Mage/Api/Model/User.php @@ -335,7 +335,7 @@ public function logoutBySessId($sessid) * Check if user is assigned to role * * @param int|Mage_Core_Model_Abstract $user - * @return array|null + * @return array */ public function hasAssigned2Role($user) { diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php index 51e24e1dda6..60d37dcb6cb 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php @@ -96,7 +96,7 @@ public function processFileData($text) /** @var Mage_Core_Model_Email_Template_Filter $template */ $template = Mage::getModel('core/email_template_filter'); - $this->_wsdlVariables->setData('handler', $this->getHandler()); + $this->_wsdlVariables->setHandler($this->getHandler()); $template->setVariables(array('wsdl'=>$this->_wsdlVariables)); diff --git a/app/code/core/Mage/Api/controllers/IndexController.php b/app/code/core/Mage/Api/controllers/IndexController.php index 8f790311582..5284736902d 100644 --- a/app/code/core/Mage/Api/controllers/IndexController.php +++ b/app/code/core/Mage/Api/controllers/IndexController.php @@ -39,4 +39,4 @@ public function indexAction() $this->_getServer()->init($this) ->run(); } -} // Class Mage_Api_IndexController End +} diff --git a/app/code/core/Mage/Api/controllers/SoapController.php b/app/code/core/Mage/Api/controllers/SoapController.php index ccafd1efef3..ec61f201936 100644 --- a/app/code/core/Mage/Api/controllers/SoapController.php +++ b/app/code/core/Mage/Api/controllers/SoapController.php @@ -39,4 +39,4 @@ public function indexAction() $this->_getServer()->init($this, 'soap') ->run(); } -} // Class Mage_Api_IndexController End +} diff --git a/app/code/core/Mage/Api/controllers/V2/SoapController.php b/app/code/core/Mage/Api/controllers/V2/SoapController.php index d51141f6966..9b5c697eb09 100644 --- a/app/code/core/Mage/Api/controllers/V2/SoapController.php +++ b/app/code/core/Mage/Api/controllers/V2/SoapController.php @@ -45,4 +45,4 @@ public function indexAction() $this->_getServer()->init($this, $handler_name, $handler_name) ->run(); } -} // Class Mage_Api_IndexController End +} diff --git a/app/code/core/Mage/Api/controllers/XmlrpcController.php b/app/code/core/Mage/Api/controllers/XmlrpcController.php index 33079af00b7..0c977048db0 100644 --- a/app/code/core/Mage/Api/controllers/XmlrpcController.php +++ b/app/code/core/Mage/Api/controllers/XmlrpcController.php @@ -38,4 +38,4 @@ public function indexAction() $this->_getServer()->init($this, 'xmlrpc') ->run(); } -} // Class Mage_Api_XmlrpcController End +} \ No newline at end of file From e72cef0d7f502b072c091ed09548fb6bf5e9fd92 Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:22:42 +0200 Subject: [PATCH 04/11] Phpstan fixes --- app/code/core/Mage/Api/Model/Resource/Acl.php | 2 +- app/code/core/Mage/Api/Model/Resource/Roles.php | 2 +- app/code/core/Mage/Api/Model/Resource/Rules/Collection.php | 2 +- app/code/core/Mage/Api/Model/Resource/User.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/core/Mage/Api/Model/Resource/Acl.php b/app/code/core/Mage/Api/Model/Resource/Acl.php index a042c0bda40..e9b8a4a8fff 100644 --- a/app/code/core/Mage/Api/Model/Resource/Acl.php +++ b/app/code/core/Mage/Api/Model/Resource/Acl.php @@ -84,7 +84,7 @@ public function loadAcl() public function loadRoles(Mage_Api_Model_Acl $acl, array $rolesArr) { foreach ($rolesArr as $role) { - $parent = $role['parent_id']>0 ? Mage_Api_Model_Acl::ROLE_TYPE_GROUP.$role['parent_id'] : null; + $parent = $role['parent_id']>0 ? Mage_Api_Model_Acl::ROLE_TYPE_GROUP.$role['parent_id'] : ''; switch ($role['role_type']) { case Mage_Api_Model_Acl::ROLE_TYPE_GROUP: $roleId = $role['role_type'].$role['role_id']; diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php index dce6e67a6a7..4fc0ab31166 100644 --- a/app/code/core/Mage/Api/Model/Resource/Roles.php +++ b/app/code/core/Mage/Api/Model/Resource/Roles.php @@ -77,7 +77,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $role) } if ($role->getPid() > 0) { - $row = $this->load($role->getPid()); + $row = $this->load($role->getPid(), null); } else { $row = array('tree_level' => 0); } diff --git a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php index 491657b14a4..ff7228ca0ea 100644 --- a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php +++ b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php @@ -51,7 +51,7 @@ protected function _construct() */ public function getByRoles($id) { - $this->getSelect()->where("role_id = ?", (int)$id); + $this->getSelect()->where("role_id = ?", $id); return $this; } diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 915df9f2ebc..fe2614f45ff 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -342,7 +342,7 @@ public function add(Mage_Core_Model_Abstract $user) { $adapter = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); - if (sizeof($aRoles) > 0) { + if (is_array($aRoles) && count($aRoles) > 0) { foreach ($aRoles as $idx => $data) { $adapter->delete( $this->getTable('api/role'), From 4c1ad3e31c0402287e19d25d4442ba58682dec61 Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:24:48 +0200 Subject: [PATCH 05/11] Fixed class names --- app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php | 2 +- app/code/core/Mage/Api/Model/Server/Wsi/Handler.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php index 96ae0cc8033..484f392821c 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php @@ -31,7 +31,7 @@ * @package Mage_Api * @author Magento Core Team */ -class Mage_Api_Model_Server_WSI_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap +class Mage_Api_Model_Server_Wsi_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap { /** * Get wsdl config diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php index 9f0a4387e70..9b6b816ff0a 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php @@ -31,7 +31,7 @@ * @package Mage_Api * @author Magento Core Team */ -class Mage_Api_Model_Server_WSI_Handler extends Mage_Api_Model_Server_Handler_Abstract +class Mage_Api_Model_Server_Wsi_Handler extends Mage_Api_Model_Server_Handler_Abstract { protected $_resourceSuffix = '_v2'; From c0025dc12a4f300b378b1e31ec8f4ffd0a14cf80 Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:26:08 +0200 Subject: [PATCH 06/11] Added call to parent method (return $this) --- app/code/core/Mage/Api/Model/Resource/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index fe2614f45ff..03479843c19 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -228,7 +228,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $user) $user->setCreated(now()); } $user->setModified(now()); - return $this; + return parent::_beforeSave($user); } /** From 9c0217c7f1752f4d9748eb5ad98e8fb7afe9fe95 Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:27:22 +0200 Subject: [PATCH 07/11] Validate class - _updateRoleUsersAcl() requires Mage_Api_Model_Roles, not Mage_Core_Model_Abstract --- app/code/core/Mage/Api/Model/Resource/Roles.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php index 4fc0ab31166..d5943e633b2 100644 --- a/app/code/core/Mage/Api/Model/Resource/Roles.php +++ b/app/code/core/Mage/Api/Model/Resource/Roles.php @@ -94,8 +94,10 @@ protected function _beforeSave(Mage_Core_Model_Abstract $role) */ protected function _afterSave(Mage_Core_Model_Abstract $role) { - $this->_updateRoleUsersAcl($role); - Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG); + if ($role instanceof Mage_Api_Model_Roles) { + $this->_updateRoleUsersAcl($role); + Mage::app()->getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG); + } return $this; } From 088d028850a95af3baabe3e6c91f374d4e24cbfe Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:34:17 +0200 Subject: [PATCH 08/11] Add helper classes for Varien_Objects Instead of replacing magic methods on Varien_Object just for IDE, maybe it would be better to add some pseudo classes with @method annotations. --- app/code/core/Mage/Api/Helper/Object/Role.php | 10 ++++++++++ app/code/core/Mage/Api/Helper/Object/Wsdl.php | 14 ++++++++++++++ app/code/core/Mage/Api/Model/Resource/User.php | 2 +- .../core/Mage/Api/Model/Server/Adapter/Soap.php | 2 +- app/code/core/Mage/Api/Model/Wsdl/Config/Base.php | 4 ++-- 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 app/code/core/Mage/Api/Helper/Object/Role.php create mode 100644 app/code/core/Mage/Api/Helper/Object/Wsdl.php diff --git a/app/code/core/Mage/Api/Helper/Object/Role.php b/app/code/core/Mage/Api/Helper/Object/Role.php new file mode 100644 index 00000000000..e0cd6491e4f --- /dev/null +++ b/app/code/core/Mage/Api/Helper/Object/Role.php @@ -0,0 +1,10 @@ +getId() > 0) { $role = Mage::getModel('api/role')->load($user->getRoleId()); } else { - $role = new Varien_Object(array('tree_level' => 0)); + $role = new Mage_Api_Helper_Object_Role(array('tree_level' => 0)); } $adapter->insert($this->getTable('api/role'), array( 'parent_id' => $user->getRoleId(), diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php index 53f7b5daf06..7c9b50dde86 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php @@ -64,7 +64,7 @@ protected function _construct() */ protected function _getWsdlConfig() { - $wsdlConfig = new Varien_Object(); + $wsdlConfig = new Mage_Api_Helper_Object_Wsdl(); $queryParams = $this->getController()->getRequest()->getQuery(); if (isset($queryParams['wsdl'])) { unset($queryParams['wsdl']); diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php index 60d37dcb6cb..0f619bc649b 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config/Base.php @@ -36,7 +36,7 @@ class Mage_Api_Model_Wsdl_Config_Base extends Varien_Simplexml_Config protected $_handler = ''; /** - * @var Varien_Object + * @var Mage_Api_Helper_Object_Wsdl */ protected $_wsdlVariables = null; @@ -54,7 +54,7 @@ public function __construct($sourceData = null) unset($queryParams['wsdl']); // set up default WSDL template variables - $this->_wsdlVariables = new Varien_Object( + $this->_wsdlVariables = new Mage_Api_Helper_Object_Wsdl( array( 'name' => 'Magento', 'url' => Mage::helper('api')->getServiceUrl('*/*/*', array('_query' => $queryParams), true) From 7e15b69aebd2d4db91472321c16e66e6147fa5ac Mon Sep 17 00:00:00 2001 From: sreichel Date: Fri, 31 May 2019 01:36:25 +0200 Subject: [PATCH 09/11] Minor fix --- app/code/core/Mage/Api/Controller/Action.php | 2 +- app/code/core/Mage/Api/Helper/Data.php | 2 +- app/code/core/Mage/Api/Model/Resource/User.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/code/core/Mage/Api/Controller/Action.php b/app/code/core/Mage/Api/Controller/Action.php index ab319cdd434..e7ad5d306fc 100644 --- a/app/code/core/Mage/Api/Controller/Action.php +++ b/app/code/core/Mage/Api/Controller/Action.php @@ -39,7 +39,7 @@ public function preDispatch() { $this->getLayout()->setArea('adminhtml'); Mage::app()->setCurrentStore('admin'); - $this->setFlag('', self::FLAG_NO_START_SESSION, 1); // Do not start standart session + $this->setFlag('', self::FLAG_NO_START_SESSION, '1'); // Do not start standard session parent::preDispatch(); return $this; } diff --git a/app/code/core/Mage/Api/Helper/Data.php b/app/code/core/Mage/Api/Helper/Data.php index af86c5b7038..60ec4482361 100644 --- a/app/code/core/Mage/Api/Helper/Data.php +++ b/app/code/core/Mage/Api/Helper/Data.php @@ -88,7 +88,7 @@ public function wsiArrayUnpacker(&$obj) /** * Go through an object parameters and unpack associative object to array. * - * @param Object $obj - Link to Object + * @param Object|array $obj - Link to Object * @return bool */ public function v2AssociativeArrayUnpacker(&$obj) diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 5d9cdf4e41f..164a2e6a9b3 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -259,7 +259,7 @@ public function delete(Mage_Core_Model_Abstract $user) /** * Save user roles * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Core_Model_Abstract|Mage_Api_Model_User $user * @return $this|Mage_Core_Model_Abstract */ public function _saveRelations(Mage_Core_Model_Abstract $user) @@ -335,7 +335,7 @@ public function _getRoles(Mage_Core_Model_Abstract $user) /** * Add Role * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Core_Model_Abstract|Mage_Api_Model_User $user * @return $this */ public function add(Mage_Core_Model_Abstract $user) @@ -371,7 +371,7 @@ public function add(Mage_Core_Model_Abstract $user) /** * Delete from role * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Core_Model_Abstract|Mage_Api_Model_User $user * @return $this */ public function deleteFromRole(Mage_Core_Model_Abstract $user) @@ -397,7 +397,7 @@ public function deleteFromRole(Mage_Core_Model_Abstract $user) /** * Retrieve roles which exists for user * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Core_Model_Abstract|Mage_Api_Model_User $user * @return array */ public function roleUserExists(Mage_Core_Model_Abstract $user) @@ -416,7 +416,7 @@ public function roleUserExists(Mage_Core_Model_Abstract $user) /** * Check if user not unique * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Core_Model_Abstract|Mage_Api_Model_User $user * @return array */ public function userExists(Mage_Core_Model_Abstract $user) From 7a7cd0e8df8073699097eb82f10a14428d8e24ce Mon Sep 17 00:00:00 2001 From: sreichel Date: Sat, 1 Jun 2019 19:18:19 +0200 Subject: [PATCH 10/11] Updates according to Flyingmana review --- app/code/core/Mage/Api/Controller/Action.php | 2 +- app/code/core/Mage/Api/Model/Config.php | 5 +---- .../core/Mage/Api/Model/Resource/Role/Collection.php | 2 +- .../Mage/Api/Model/Resource/Rules/Collection.php | 2 +- app/code/core/Mage/Api/Model/Resource/User.php | 12 ++++++------ app/code/core/Mage/Api/Model/Wsdl/Config.php | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/code/core/Mage/Api/Controller/Action.php b/app/code/core/Mage/Api/Controller/Action.php index e7ad5d306fc..715158d4be4 100644 --- a/app/code/core/Mage/Api/Controller/Action.php +++ b/app/code/core/Mage/Api/Controller/Action.php @@ -39,7 +39,7 @@ public function preDispatch() { $this->getLayout()->setArea('adminhtml'); Mage::app()->setCurrentStore('admin'); - $this->setFlag('', self::FLAG_NO_START_SESSION, '1'); // Do not start standard session + $this->setFlag('', self::FLAG_NO_START_SESSION, 1); // Do not start standard session parent::preDispatch(); return $this; } diff --git a/app/code/core/Mage/Api/Model/Config.php b/app/code/core/Mage/Api/Model/Config.php index dcb85a65456..d75a055e326 100644 --- a/app/code/core/Mage/Api/Model/Config.php +++ b/app/code/core/Mage/Api/Model/Config.php @@ -36,10 +36,7 @@ class Mage_Api_Model_Config extends Varien_Simplexml_Config const CACHE_TAG = 'config_api'; /** - * Constructor - * - * @param null $sourceData - * @see Varien_Simplexml_Config + * @inheritDoc */ public function __construct($sourceData = null) { diff --git a/app/code/core/Mage/Api/Model/Resource/Role/Collection.php b/app/code/core/Mage/Api/Model/Resource/Role/Collection.php index 045a8f6047e..4e5cb1d587d 100644 --- a/app/code/core/Mage/Api/Model/Resource/Role/Collection.php +++ b/app/code/core/Mage/Api/Model/Resource/Role/Collection.php @@ -46,7 +46,7 @@ protected function _construct() /** * Aet user filter * - * @param string $userId + * @param int|string $userId * @return $this */ public function setUserFilter($userId) diff --git a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php index ff7228ca0ea..491657b14a4 100644 --- a/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php +++ b/app/code/core/Mage/Api/Model/Resource/Rules/Collection.php @@ -51,7 +51,7 @@ protected function _construct() */ public function getByRoles($id) { - $this->getSelect()->where("role_id = ?", $id); + $this->getSelect()->where("role_id = ?", (int)$id); return $this; } diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 164a2e6a9b3..59236ce20d0 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -194,12 +194,12 @@ public function clearBySessId($sessid) * Retrieve api user role data if it was assigned to role * * @param int|Mage_Api_Model_User|Mage_Core_Model_Abstract $user - * @return array|null + * @return array */ public function hasAssigned2Role($user) { $userId = null; - $result = null; + $result = array(); if (is_numeric($user)) { $userId = $user; } else if ($user instanceof Mage_Core_Model_Abstract) { @@ -219,8 +219,8 @@ public function hasAssigned2Role($user) /** * Action before save * - * @param Mage_Api_Model_User $user - * @inheritDoc + * @param Mage_Core_Model_Abstract|Mage_Api_Model_User $user + * @return $this */ protected function _beforeSave(Mage_Core_Model_Abstract $user) { @@ -228,7 +228,7 @@ protected function _beforeSave(Mage_Core_Model_Abstract $user) $user->setCreated(now()); } $user->setModified(now()); - return parent::_beforeSave($user); + return $this; } /** @@ -342,7 +342,7 @@ public function add(Mage_Core_Model_Abstract $user) { $adapter = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); - if (is_array($aRoles) && count($aRoles) > 0) { + if (sizeof($aRoles) > 0) { foreach ($aRoles as $idx => $data) { $adapter->delete( $this->getTable('api/role'), diff --git a/app/code/core/Mage/Api/Model/Wsdl/Config.php b/app/code/core/Mage/Api/Model/Wsdl/Config.php index e07b45b91f9..d4e83c9a59d 100644 --- a/app/code/core/Mage/Api/Model/Wsdl/Config.php +++ b/app/code/core/Mage/Api/Model/Wsdl/Config.php @@ -92,7 +92,7 @@ protected function _loadCache($id) * @param string $data * @param string $id * @param array $tags - * @param bool $lifetime + * @param int|bool $lifetime * @return bool|Mage_Core_Model_App */ protected function _saveCache($data, $id, $tags = array(), $lifetime = false) From 5bea2ebc7bd4cd2a06413ad970e7227fa1de1042 Mon Sep 17 00:00:00 2001 From: sreichel Date: Sat, 1 Jun 2019 19:42:01 +0200 Subject: [PATCH 11/11] Reverted last change to getter method --- app/code/core/Mage/Api/Helper/Object/Wsdl.php | 1 + app/code/core/Mage/Api/Model/Server/Adapter/Soap.php | 2 +- app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Api/Helper/Object/Wsdl.php b/app/code/core/Mage/Api/Helper/Object/Wsdl.php index fe8c7059dfa..04dd8b847d6 100644 --- a/app/code/core/Mage/Api/Helper/Object/Wsdl.php +++ b/app/code/core/Mage/Api/Helper/Object/Wsdl.php @@ -8,6 +8,7 @@ * @method $this setHandler(string $value) * @method string getUrl() * @method $this setUrl(string $value) + * @method string getWsdlContent() */ class Mage_Api_Helper_Object_Wsdl extends Varien_Object { diff --git a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php index 7c9b50dde86..9262c7f0877 100644 --- a/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php @@ -38,7 +38,7 @@ class Mage_Api_Model_Server_Adapter_Soap /** * Wsdl config * - * @var Varien_Object + * @var Mage_Api_Helper_Object_Wsdl */ protected $wsdlConfig = null; diff --git a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php index 0d964c67061..2590778e88e 100644 --- a/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php +++ b/app/code/core/Mage/Api/Model/Server/V2/Adapter/Soap.php @@ -64,7 +64,7 @@ public function run() preg_replace( '/<\?xml version="([^\"]+)"([^\>]+)>/i', '', - $this->wsdlConfig->getData('wsdl_content') + $this->wsdlConfig->getWsdlContent() ) ); } else {