Example #1
0
 /**
  * Provides functionality for getters and setters of the customer
  * @see Varien_Object::__call()
  */
 public function __call($method, $args)
 {
     if ($this->_customer instanceof Mage_Customer_Model_Customer) {
         $key = $this->_underscore(substr($method, 3));
         switch (substr($method, 0, 3)) {
             case 'get':
                 return $this->_customer->getData($key, isset($args[0]) ? $args[0] : null);
             case 'set':
                 return $this->_customer->setData($key, isset($args[0]) ? $args[0] : null);
             case 'uns':
                 return $this->_customer->unsetData($key);
             case 'has':
                 $data = $this->_customer->getData();
                 return isset($data[$key]);
         }
         try {
             $_reflectionObject = new ReflectionObject($this->_customer);
             if ($_reflectionObject->hasMethod($method)) {
                 $_reflectionMethod = new ReflectionMethod(get_class($this->_customer), $method);
                 return $_reflectionMethod->invokeArgs($this->_customer, $args);
             }
         } catch (Exception $e) {
             return parent::__call($method, $args);
         }
     }
     return parent::__call($method, $args);
 }
 public function __call($method, $args)
 {
     switch (substr($method, 0, 3)) {
         case 'get':
             $key = substr($method, 3);
             $data = $this->getData($key, isset($args[0]) ? $args[0] : null);
             return $data;
         case 'set':
             $key = substr($method, 3);
             $result = $this->setData($key, isset($args[0]) ? $args[0] : null);
             return $result;
         default:
             return parent::__call($method, $args);
     }
 }
Example #3
0
 public function __call($method, $args)
 {
     switch (substr($method, 0, 3)) {
         case 'get':
             $key = substr($method, 3);
             $data = $this->getData($key, isset($args[0]) ? $args[0] : null);
             return $data;
         case 'set':
             $key = substr($method, 3);
             $result = $this->setData($key, isset($args[0]) ? $args[0] : null);
             return $result;
         default:
             return parent::__call($method, $args);
     }
     throw new Varien_Exception("Invalid method " . get_class($this) . "::" . $method . "(" . print_r($args, 1) . ")");
 }
Example #4
0
 /**
  * API caller
  *
  * @param string $name
  * @param array  $args
  *
  * @return mixed
  */
 public function __call($name, $args)
 {
     switch (substr($name, 0, 3)) {
         case 'get':
         case 'set':
         case 'uns':
         case 'has':
             return parent::__call($name, $args);
     }
     if (!Mage::getSingleton('slack/config_settings')->isActive()) {
         return;
     }
     $params = $this->_prepareParams();
     $result = $this->_post($name, $params);
     if ($result->code != 200) {
         Mage::throwException('Failed to connect to Slack API');
     } elseif (!$result->body['ok']) {
         Mage::throwException($result->body['error']);
     }
     unset($result->body['ok']);
     foreach ($result->body as $key => $value) {
         $this->setData($key, $value);
     }
     return $this;
 }
Example #5
0
 public function __call($method, $args)
 {
     if (substr($method, 0, 3) == 'get') {
         $key = $this->_underscore(substr($method, 3));
         if (isset($this->_settings['store'][$key])) {
             return $this->_settings['store'][$key];
         } elseif (isset($this->_settings['website'][$key])) {
             return $this->_settings['website'][$key];
         } elseif (isset($this->_settings['default'][$key])) {
             return $this->_settings['default'][$key];
         }
         return $this->getData($key, isset($args[0]) ? $args[0] : null);
     } else {
         parent::__call($method, $args);
     }
 }
 public function __call($method, $args)
 {
     if (substr($method, 0, 3) == 'get') {
         $key = $this->_underscore(substr($method, 3));
         if (isset($this->_collections[$key])) {
             return $this->_collections[$key];
         }
         if (isset($this->_collections[$key . 's'])) {
             return $this->_collections[$key . 's'][$args[0]];
         }
         if (isset($this->_arrays[$key])) {
             return $this->_arrays[$key];
         }
         if (isset($this->_arrays[$key . 's'])) {
             return $this->_arrays[$key . 's'][$args[0]];
         }
     } elseif (substr($method, 0, 3) == 'has') {
         $key = $this->_underscore(substr($method, 3));
         if (isset($this->_collections[$key . 's'])) {
             return isset($this->_collections[$key . 's'][$args[0]]);
         }
     } elseif (substr($method, 0, 3) == 'set') {
         $key = $this->_underscore(substr($method, 3));
         if (isset($this->_collections[$key])) {
             $this->_collections[$key] = $args[0];
             return $this;
         }
         if (isset($this->_collections[$key . 's'])) {
             $this->_collections[$key . 's'][$args[0]] = $args[1];
             return $this;
         }
         if (isset($this->_arrays[$key])) {
             $this->_arrays[$key] = $args[0];
             return $this;
         }
     } elseif (substr($method, 0, 3) == 'add') {
         $key = $this->_underscore(substr($method, 3));
         if (isset($this->_arrays[$key . 's'])) {
             $this->_arrays[$key . 's'][] = $args[0];
             return $this;
         }
     } elseif (substr($method, 0, 3) == 'uns') {
         $key = $this->_underscore(substr($method, 3));
         if (isset($this->_collections[$key . 's'])) {
             unset($this->_collections[$key . 's'][$args[0]]);
             return $this;
         }
         if (isset($this->_arrays[$key])) {
             $this->_arrays[$key] = array();
             return $this;
         }
         if (isset($this->_arrays[$key . 's'])) {
             unset($this->_arrays[$key . 's'][$args[0]]);
             return $this;
         }
     }
     return parent::__call($method, $args);
 }
Example #7
0
 public function __call($method, $args)
 {
     if (!Mage::helper('zab_timedcart')->isActiveTimeout()) {
         return $this;
     }
     return parent::__call($method, $args);
 }