Ejemplo n.º 1
0
 /**
  * maps an mapping array between a SimpleXML and Objekt
  *
  * @param                   $mapping
  * @param \SimpleXMLElement $xml
  * @param                   $objekt
  */
 protected function map($mapping, \SimpleXMLElement $xml, $objekt)
 {
     foreach ($mapping as $key) {
         if (isset($xml->{$key})) {
             $setter = $this->mapper->getSetter($key);
             $objekt->{$setter}($this->cast($xml->{$key}, $this->mapper->getType($key)));
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * magic call
  *
  * @param $method
  * @param $params
  *
  * @return mixed
  * @throws \Justimmo\Exception\MethodNotFoundException
  */
 public function __call($method, $params)
 {
     if (mb_strpos($method, 'filterBy') === 0 && count($params) == 1) {
         $key = $this->mapper->getFilterPropertyName(mb_substr($method, 8));
         return $this->filter($key, $params[0]);
     }
     if (mb_strpos($method, 'orderBy') === 0 && count($params) <= 1) {
         $key = $this->mapper->getFilterPropertyName(mb_substr($method, 7));
         if (empty($params[0]) || !in_array($params[0], array('asc', 'desc'))) {
             $params[0] = 'asc';
         }
         return $this->order($key, $params[0]);
     }
     throw new MethodNotFoundException('The method ' . $method . ' was not found in ' . get_class($this));
 }
Ejemplo n.º 3
0
 /**
  *
  * @param $value
  *
  * @return $this
  */
 public function filterByFederalState($value)
 {
     return $this->set($this->mapper->getFilterPropertyName('federalState'), $value);
 }
Ejemplo n.º 4
0
 public function send()
 {
     $this->api->postRealtyInquiry(array($this->mapper->getFilterPropertyName('realtyId') => $this->getRealtyId(), $this->mapper->getFilterPropertyName('firstName') => $this->getFirstName(), $this->mapper->getFilterPropertyName('lastName') => $this->getLastName(), $this->mapper->getFilterPropertyName('email') => $this->getEmail(), $this->mapper->getFilterPropertyName('phone') => $this->getPhone(), $this->mapper->getFilterPropertyName('message') => $this->getMessage(), $this->mapper->getFilterPropertyName('street') => $this->getStreet(), $this->mapper->getFilterPropertyName('zipCode') => $this->getZipCode(), $this->mapper->getFilterPropertyName('city') => $this->getCity(), $this->mapper->getFilterPropertyName('country') => $this->getCountry(), $this->mapper->getFilterPropertyName('title') => $this->getTitle(), $this->mapper->getFilterPropertyName('salutationId') => $this->getSalutationId()));
 }