Exemplo n.º 1
0
 public function testCleanEmptyItemsAll()
 {
     \App_Util_Array::cleanEmptyItems($this->_data, false);
     $this->assertArrayHasKey('a', $this->_data);
     $this->assertArrayHasKey('f', $this->_data);
     $this->assertArrayNotHasKey('h', $this->_data);
     $this->assertArrayNotHasKey('j', $this->_data);
     $this->assertArrayNotHasKey('i', $this->_data);
     $this->assertArrayNotHasKey('l', $this->_data);
 }
 protected function _mapEricssonModelToModel(array $data)
 {
     $data = parent::_mapEricssonModelToModel($data);
     $contactFields = array('otherContact_1', 'otherContact_2', 'otherContact_3');
     foreach ($contactFields as $field) {
         if (isset($data[$field])) {
             \App_Util_Array::cleanEmptyItems($data[$field], false);
             if (empty($data[$field])) {
                 unset($data[$field]);
             }
         }
     }
     return $data;
 }
Exemplo n.º 3
0
 protected function _mapToSdp(array $data)
 {
     $this->_map($data, $this->_mapModelToSdp);
     App_Util_Array::cleanEmptyItems($data, true);
     foreach ($this->_presetSdpValues as $sdpField => $value) {
         if (!App_Util_Array::issetItem($data, $sdpField)) {
             App_Util_Array::setItem($data, $sdpField, $value);
         }
     }
     array_walk_recursive($data, function (&$item, $key) {
         if (is_string($item) && in_array($key, array('phone', 'mobile', 'fax'))) {
             $item = str_replace('+', '00', $item);
         }
     });
     return $data;
 }