当前位置: 首页>>代码示例>>PHP>>正文


PHP Phone::setNumber方法代码示例

本文整理汇总了PHP中Phone::setNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::setNumber方法的具体用法?PHP Phone::setNumber怎么用?PHP Phone::setNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phone的用法示例。


在下文中一共展示了Phone::setNumber方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findPerson

 /**
  * Try to find this person in the database.
  * If we cannot find them, create a new person record.
  *
  * @return Person
  */
 public static function findPerson($post)
 {
     $search = array();
     // Translates Open311 parameters into PersonList search parameters
     // open311 => personList
     $fields = array('first_name' => 'firstname', 'last_name' => 'lastname', 'email' => 'email', 'phone' => 'phoneNumber', 'device_id' => 'phoneDeviceId');
     foreach ($fields as $open311Field => $crmField) {
         if (!empty($post[$open311Field])) {
             $search[$crmField] = $post[$open311Field];
         }
     }
     // If the user provided any personal info, do a person search
     if (count($search)) {
         $table = new PersonTable();
         $list = $table->find($search);
         // When we find one and only one record, use the record we found
         if (count($list) == 1) {
             $person = $list->current();
         } else {
             $p = array();
             foreach ($fields as $key => $field) {
                 if (!empty($post[$key])) {
                     $p[$field] = $post[$key];
                 }
             }
             if (count($p)) {
                 $person = new Person();
                 try {
                     $person->handleUpdate($p);
                     $person->save();
                     if (!empty($post['email'])) {
                         $email = new Email();
                         $email->setPerson($person);
                         $email->setEmail($post['email']);
                         $email->save();
                     }
                     if (!empty($post['phone']) || !empty($post['device_id'])) {
                         $phone = new Phone();
                         $phone->setPerson($person);
                         if (!empty($post['phone'])) {
                             $phone->setNumber($post['phone']);
                         }
                         if (!empty($post['device_id'])) {
                             $phone->setDeviceId($post['device_id']);
                         }
                         $phone->save();
                     }
                 } catch (\Exception $e) {
                     unset($person);
                 }
             }
         }
     }
     return isset($person) ? $person : null;
 }
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:61,代码来源:Open311Client.php

示例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;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:17,代码来源:Sender.class.php

示例3: readTransaction


//.........这里部分代码省略.........
         $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"]);
             }
             // <transaction> <sender> <phone> <number>
             if (isset($data["sender"]["phone"]["number"])) {
                 $phone->setNumber($data["sender"]["phone"]["number"]);
             }
             $sender->setPhone($phone);
         }
         $transaction->setSender($sender);
     }
     if (isset($data["shipping"]) && is_array($data["shipping"])) {
         // <transaction> <shipping>
         $shipping = new Shipping();
         // <transaction> <shipping> <type>
         if (isset($data["shipping"]["type"])) {
             $shipping->setType(new ShippingType($data["shipping"]["type"]));
         }
         // <transaction> <shipping> <cost>
         if (isset($data["shipping"]["cost"])) {
             $shipping->setCost($data["shipping"]["cost"]);
         }
         if (isset($data["shipping"]["address"]) && is_array($data["shipping"]["address"])) {
             // <transaction> <shipping> <address>
             $address = new Address();
             // <transaction> <shipping> <address> <street>
             if (isset($data["shipping"]["address"]["street"])) {
                 $address->setStreet($data["shipping"]["address"]["street"]);
             }
             // <transaction> <shipping> <address> <number>
             if (isset($data["shipping"]["address"]["number"])) {
                 $address->setNumber($data["shipping"]["address"]["number"]);
             }
             // <transaction> <shipping> <address> <complement>
             if (isset($data["shipping"]["address"]["complement"])) {
                 $address->setComplement($data["shipping"]["address"]["complement"]);
             }
             // <transaction> <shipping> <address> <city>
             if (isset($data["shipping"]["address"]["city"])) {
                 $address->setCity($data["shipping"]["address"]["city"]);
             }
             // <transaction> <shipping> <address> <state>
             if (isset($data["shipping"]["address"]["state"])) {
                 $address->setState($data["shipping"]["address"]["state"]);
             }
             // <transaction> <shipping> <address> <district>
             if (isset($data["shipping"]["address"]["district"])) {
                 $address->setDistrict($data["shipping"]["address"]["district"]);
             }
             // <transaction> <shipping> <address> <postalCode>
             if (isset($data["shipping"]["address"]["postalCode"])) {
                 $address->setPostalCode($data["shipping"]["address"]["postalCode"]);
             }
             // <transaction> <shipping> <address> <country>
             if (isset($data["shipping"]["address"]["country"])) {
                 $address->setCountry($data["shipping"]["address"]["country"]);
             }
             $shipping->setAddress($address);
         }
         // <transaction> <shipping>
         $transaction->setShipping($shipping);
     }
     return $transaction;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:TransactionParser.class.php

示例4: testSetNumber

 /**
  * Tests Phone->setNumber()
  */
 public function testSetNumber()
 {
     $this->Phone->setNumber('NUMBER');
     $this->assertEquals('NUMBER', $this->Phone->number);
 }
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:8,代码来源:PhoneTest.php


注:本文中的Phone::setNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。