本文整理汇总了PHP中Phone::setAreaCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::setAreaCode方法的具体用法?PHP Phone::setAreaCode怎么用?PHP Phone::setAreaCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phone
的用法示例。
在下文中一共展示了Phone::setAreaCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readTransaction
public static function readTransaction($str_xml)
{
// Parser
$parser = new xmlParser($str_xml);
// <transaction>
$data = $parser->getResult('transaction');
$transaction = new Transaction();
// <transaction> <lastEventDate>
if (isset($data["lastEventDate"])) {
$transaction->setLastEventDate($data["lastEventDate"]);
}
// <transaction> <date>
if (isset($data["date"])) {
$transaction->setDate($data["date"]);
}
// <transaction> <code>
if (isset($data["code"])) {
$transaction->setCode($data["code"]);
}
// <transaction> <reference>
if (isset($data["reference"])) {
$transaction->setReference($data["reference"]);
}
// <transaction> <type>
if (isset($data["type"])) {
$transaction->setType(new TransactionType($data["type"]));
}
// <transaction> <status>
if (isset($data["status"])) {
$transaction->setStatus(new TransactionStatus($data["status"]));
}
if (isset($data["paymentMethod"]) && is_array($data["paymentMethod"])) {
// <transaction> <paymentMethod>
$paymentMethod = new PaymentMethod();
// <transaction> <paymentMethod> <type>
if (isset($data["paymentMethod"]['type'])) {
$paymentMethod->setType(new PaymentMethodType($data["paymentMethod"]['type']));
}
// <transaction> <paymentMethod> <code>
if (isset($data["paymentMethod"]['code'])) {
$paymentMethod->setCode(new PaymentMethodCode($data["paymentMethod"]['code']));
}
$transaction->setPaymentMethod($paymentMethod);
}
// <transaction> <grossAmount>
if (isset($data["grossAmount"])) {
$transaction->setGrossAmount($data["grossAmount"]);
}
// <transaction> <discountAmount>
if (isset($data["discountAmount"])) {
$transaction->setDiscountAmount($data["discountAmount"]);
}
// <transaction> <feeAmount>
if (isset($data["feeAmount"])) {
$transaction->setFeeAmount($data["feeAmount"]);
}
// <transaction> <netAmount>
if (isset($data["netAmount"])) {
$transaction->setNetAmount($data["netAmount"]);
}
// <transaction> <extraAmount>
if (isset($data["extraAmount"])) {
$transaction->setExtraAmount($data["extraAmount"]);
}
// <transaction> <installmentCount>
if (isset($data["installmentCount"])) {
$transaction->setInstallmentCount($data["installmentCount"]);
}
if (isset($data["items"]['item']) && is_array($data["items"]['item'])) {
$items = array();
$i = 0;
if (isset($data["items"]['item'][0])) {
foreach ($data["items"]['item'] as $key => $value) {
$item = self::parseTransactionItem($value);
$items[$i] = $item;
$i++;
}
} else {
$items[0] = self::parseTransactionItem($data["items"]['item']);
}
// <transaction> <items>
$transaction->setItems($items);
}
if (isset($data["sender"])) {
// <transaction> <sender>
$sender = new Sender();
// <transaction> <sender> <name>
if (isset($data["sender"]["name"])) {
$sender->setName($data["sender"]["name"]);
}
// <transaction> <sender> <email>
if (isset($data["sender"]["email"])) {
$sender->setEmail($data["sender"]["email"]);
}
if (isset($data["sender"]["phone"])) {
// <transaction> <sender> <phone>
$phone = new Phone();
// <transaction> <sender> <phone> <areaCode>
if (isset($data["sender"]["phone"]["areaCode"])) {
$phone->setAreaCode($data["sender"]["phone"]["areaCode"]);
//.........这里部分代码省略.........
示例2: setPhone
/**
* Sets the sender phone
* @param String $areaCode
* @param String $number
*/
public function setPhone($areaCode, $number = null)
{
$param = $areaCode;
if ($param instanceof Phone) {
$this->phone = $param;
} elseif ($number) {
$phone = new Phone();
$phone->setAreaCode($areaCode);
$phone->setNumber($number);
$this->phone = $phone;
}
}