Skip to content

Commit

Permalink
Adiciona PSR2 com algumas modificações e atualiza PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-teixeira committed May 29, 2017
1 parent 4baccbe commit 0a887ed
Show file tree
Hide file tree
Showing 30 changed files with 156 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class PedroTeixeira_Correios_Block_Adminhtml_System_Config_Form_Button
{
/**
* Retrieve the html code for Element
*
*
* @param Varien_Data_Form_Element_Abstract $element Element
*
*
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
Expand All @@ -28,7 +28,7 @@ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)

/**
* Retrieve an adminhtml button
*
*
* @return string
*/
public function getButton()
Expand Down
10 changes: 5 additions & 5 deletions app/code/community/PedroTeixeira/Correios/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class PedroTeixeira_Correios_Helper_Data extends Mage_Core_Helper_Abstract
{
/**
* Gets the configuration value by path
*
*
* @param string $path System Config Path
*
*
* @return mixed
*/
public function getConfigData($path)
Expand All @@ -28,9 +28,9 @@ public function getConfigData($path)

/**
* Get a text for option value
*
*
* @param string|int $value Method Code
*
*
* @return string|bool
*/
public function getShippingLabel($value)
Expand All @@ -41,7 +41,7 @@ public function getShippingLabel($value)

/**
* Retrieve stream context as a Soap parameter
*
*
* @return array
*/
public function getStreamContext()
Expand Down
6 changes: 3 additions & 3 deletions app/code/community/PedroTeixeira/Correios/Model/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,17 @@ public function loadByTags()
/**
* Validate the response data from Correios.
* This method will choose between Request Cache or Save in Cache
*
*
* Step 1:
* Invalid responses must call the Cache load.
* Cache loading is requested by throwing adapter exception.
*
*
* Step 2:
* To save valid responses, it must contain no errors.
* Errors are detected by pattern_nocache and returns false.
*
* @param string $data XML Content
*
*
* @throws Zend_Http_Client_Adapter_Exception
*
* @return boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ protected function _getRequestItems($request)
$allItems = $request->getAllItems();
$items = array();

foreach ( $allItems as $item ) {
if ( !$item->getParentItemId() ) {
foreach ($allItems as $item) {
if (!$item->getParentItemId()) {
$items[] = $item;
}
}
Expand Down Expand Up @@ -185,7 +185,6 @@ protected function _getQuotes()
$correiosReturn = $this->_addPostMethods($correiosReturn);

foreach ($correiosReturn as $servicos) {

$errorId = (string) $servicos->Erro;
$errorList[$errorId] = $servicos->MsgErro;

Expand Down Expand Up @@ -587,11 +586,11 @@ public function getTracking($trackings)

/**
* Loads the parameters and calls the webservice using SOAP
*
*
* @param string $code Code
*
*
* @return bool|array
*
*
* @throws Exception
*/
protected function _getTrackingRequest($code)
Expand Down Expand Up @@ -622,13 +621,13 @@ protected function _getTrackingRequest($code)

/**
* Loads tracking progress details
*
*
* @param SimpleXMLElement $evento XML Element Node
* @param bool $isDelivered Delivery Flag
*
*
* @return array
*/
protected function _getTrackingProgressDetails($evento, $isDelivered=false)
protected function _getTrackingProgressDetails($evento, $isDelivered = false)
{
$date = new Zend_Date($evento->data, 'dd/MM/YYYY', new Zend_Locale('pt_BR'));
$track = array(
Expand All @@ -648,10 +647,10 @@ protected function _getTrackingProgressDetails($evento, $isDelivered=false)
}

/**
* Loads progress data using the WSDL response
*
* Loads progress data using the WSDL response
*
* @param string $request Request response
*
*
* @return array
*/
protected function _getTrackingProgress($request)
Expand Down Expand Up @@ -867,7 +866,6 @@ protected function _addPostMethods($cServico)
protected function _filterMethodByItemRestriction($request)
{
if ($this->getConfigFlag('filter_by_item')) {

$items = $this->_getRequestItems($request);
$intersection = $this->_postMethodsExplode;
foreach ($items as $item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ public function getConfigData($field)
$path = 'carriers/' . $this->_code . '/' . $field;
return Mage::getStoreConfig($path);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PedroTeixeira_Correios_Model_Observer
{
/**
* Look for shipped trackings, and send notifications if available and enabled
*
*
* @return string
*/
public function sroTrackingJob()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @copyright 2015 Pedro Teixeira (http://pedroteixeira.io)
* @license http://opensource.org/licenses/MIT MIT
* @link https://github.com/pedro-teixeira/correios
*
*
* @method string getMethodId()
* @method string getMethodCode()
* @method string getMethodTitle()
Expand All @@ -23,9 +23,9 @@ class PedroTeixeira_Correios_Model_Postmethod extends Mage_Core_Model_Abstract
{
/**
* Internal constructor
*
*
* @see Varien_Object::_construct()
*
*
* @return void
*/
protected function _construct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class PedroTeixeira_Correios_Model_Resource_Postmethod
{
/**
* Resource initialization
*
*
* @see Mage_Core_Model_Resource_Abstract::_construct()
*
*
* @return void
*/
protected function _construct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class PedroTeixeira_Correios_Model_Resource_Postmethod_Collection
{
/**
* Resource initialization
*
*
* @see Mage_Core_Model_Resource_Db_Collection_Abstract::_construct()
*
*
* @return void
*/
protected function _construct()
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/PedroTeixeira/Correios/Model/Sigepweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PedroTeixeira_Correios_Model_Sigepweb extends Mage_Core_Model_Abstract

/**
* Retrieve the module helper
*
*
* @return Pedroteixeira_Correios_Helper_Data
*/
public function helper()
Expand All @@ -26,7 +26,7 @@ public function helper()

/**
* Request Correios service codes using configuration fields
*
*
* @return SimpleXMLElement
*/
public function getBuscaCliente()
Expand Down
48 changes: 24 additions & 24 deletions app/code/community/PedroTeixeira/Correios/Model/Sro.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PedroTeixeira_Correios_Model_Sro extends Varien_Object

/**
* Retrieves all valid tracking codes
*
*
* @return PedroTeixeira_Correios_Model_Sro
*/
public function init()
Expand All @@ -40,7 +40,7 @@ public function init()
/**
* Load all opened tracks from database.
* Filter tracks only with complete order state, and shipped status.
*
*
* @return Mage_Sales_Model_Resource_Order_Shipment_Track_Collection
*/
public function getShippedTracks()
Expand All @@ -60,14 +60,14 @@ public function getShippedTracks()

/**
* Load XML response from Correios
*
*
* @throws Exception
*
*
* @link http://www.correios.com.br/para-voce/correios-de-a-a-z/pdf/rastreamento-de-objetos/
* Manual_SROXML_28fev14.pdf
* @link http://www.corporativo.correios.com.br/encomendas/sigepweb/doc/
* Manual_de_Implementacao_do_Web_Service_SIGEPWEB_Logistica_Reversa.pdf
*
*
* @return boolean|Correios_Rastro_BuscaEventosResponse
*/
public function request()
Expand Down Expand Up @@ -103,9 +103,9 @@ public function request()

/**
* Retrieve config value by path
*
*
* @param string $path Variable Path
*
*
* @return string
*/
public function getConfigData($path)
Expand All @@ -115,9 +115,9 @@ public function getConfigData($path)

/**
* Returns a Shipping comment message
*
*
* @param Correios_Rastro_Objeto $obj Response Object
*
*
* @return string
*/
public function getComment($obj)
Expand All @@ -144,10 +144,10 @@ public function getComment($obj)

/**
* Returns an Update Shipping e-mail comment
*
*
* @param Correios_Rastro_Objeto $obj Response Object
* @param Mage_Sales_Model_Order_Shipment_Track $track Tracking instance
*
*
* @return string
*/
public function getEmailComment($obj, $track)
Expand Down Expand Up @@ -175,10 +175,10 @@ public function getEmailComment($obj, $track)

/**
* Check the event type
*
*
* @param Correios_Rastro_Objeto $obj Response Object
* @param string $mode Event Type Mode
*
*
* @return boolean
*/
public function validate($obj, $mode)
Expand All @@ -197,9 +197,9 @@ public function validate($obj, $mode)
/**
* Track Description field are now being used to save the event id.
* Event Id is a simple key to identify the last carrier event.
*
*
* @param Correios_Rastro_Objeto $obj Response Object
*
*
* @return string
*/
public function getEventId($obj)
Expand All @@ -216,9 +216,9 @@ public function getEventId($obj)

/**
* Check whether event notify is enabled or not
*
*
* @param Correios_Rastro_Objeto $obj Response Object
*
*
* @return boolean
*/
public function isNotify($obj)
Expand All @@ -228,9 +228,9 @@ public function isNotify($obj)

/**
* Load order status based on event checking
*
*
* @param Correios_Rastro_Objeto $obj Response Object
*
*
* @return string
*/
public function getStatus($obj)
Expand All @@ -247,9 +247,9 @@ public function getStatus($obj)

/**
* Validates the tracking code
*
*
* @param string $trackNumber Tracking Code
*
*
* @return boolean
*/
public function validateTrackNumber($trackNumber)
Expand All @@ -259,11 +259,11 @@ public function validateTrackNumber($trackNumber)

/**
* Retrieves the tracking instance
*
*
* @param Correios_Rastro_Objeto $obj Return Object
*
*
* @throws Exception
*
*
* @return Mage_Sales_Model_Order_Shipment_Track
*/
public function getTrack($obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PedroTeixeira_Correios_Adminhtml_SigepwebController
{
/**
* This updates the available service codes from Correios
*
*
* @return void
*/
public function postmethodsUpdateAction()
Expand Down
Loading

0 comments on commit 0a887ed

Please sign in to comment.