| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @category   Mygento | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @package    Mygento_Metrika | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @copyright  Copyright © 2015 NKS LLC. (http://www.mygento.ru) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | class Mygento_Metrika_Model_Observer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |     public function addToCartComplete($observer) | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |         $product = $observer->getProduct(); | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |         $params = $observer->getRequest()->getParams(); | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |         if (!isset($params['qty']) || $params['qty'] == 0) { | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |             $qty = 1; | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |         } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |             $qty = $params['qty']; | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |         $data = array( | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |             'ecommerce' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |                 'add' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |                     'products' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |                         'id' => $product->getSku(), | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |                         'name' => $product->getName(), | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |                         'price' => $product->getPrice(), | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |                         //'brand' => 'Яндекс / Яndex', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |                         //'category' => 'Аксессуары/Сумки', | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |                         'quantity' => $qty, | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |                     ) | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |                 ) | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |             ) | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         Mage::helper('metrika')->setSessionData($data); | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public function removeFromCartComplete($observer) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         $product = $observer->getQuoteItem()->getProduct(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $data = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             'ecommerce' => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |                 'remove' => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |                     'products' => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |                         'id' => $product->getSku(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |                         'name' => $product->getName(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |                     ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                 ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         Mage::helper('metrika')->setSessionData($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     public function removeDomainPolicyHeader($observer) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         /** @var Mage_Core_Controller->getCurrentAreaDomainPolicy_Varien_Action $action */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         $action = $observer->getControllerAction(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         if ('frontend' == $action->getLayout()->getArea()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             /** @var Mage_Core_Controller_Response_Http $response */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |             $response = $action->getResponse(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |             // @codingStandardsIgnoreStart | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             $url = parse_url(Mage::helper('core/http')->getHttpReferer()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             // codingStandardsIgnoreEnd | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |             if ($url && isset($url['host']) && $url['host'] == 'webvisor.com') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |                 $response->clearHeader('X-Frame-Options'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 72 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |  | 
            
                        
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.