Пример #1
0
 /**
  * update pstn rates from pstnnetworks collection
  * @link http://open.didww.com/index.php/3._Update_PSTN_Rates
  * @param \Didww\API2\PSTNNetwork[] $networks
  */
 public static function updateNetworks($networks = array())
 {
     $request = array();
     foreach ($networks as $network) {
         if ($network instanceof \Didww\API2\PSTNNetwork) {
             $request[] = array("network_prefix" => trim($network->getNetworkPrefix()), "sell_rate" => $network->getSellRate());
         } else {
             throw new PSTNNetworkException("PSTNNetwork expected but type " . \Didww\Utils\Util::getType($network) . " found");
         }
     }
     self::updateNetworksFromArray($request);
 }
Пример #2
0
 public function offsetSet($offset, $value)
 {
     $type = $this->getCollectionType();
     if (!$value instanceof $type) {
         throw new ServerPaginatedCollectionExceptoin("{$type} expected but type " . \Didww\Utils\Util::getType($value) . " found");
     }
     if (is_null($offset)) {
         $this->_list[] = $value;
     } else {
         $this->_list[$offset] = $value;
     }
 }