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


PHP ArrayUtil::arrayUniqueRecursive方法代码示例

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


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

示例1: testArrayUniqueRecursive

 public function testArrayUniqueRecursive()
 {
     $array = array('testValue1', 'testValue2', 'testValue3');
     $expected = array('testValue1', 'testValue2', 'testValue3');
     $this->assertEquals($expected, ArrayUtil::arrayUniqueRecursive($array));
     $array = array('testValue1', 'testValue2', 'testValue2');
     $expected = array('testValue1', 'testValue2');
     $this->assertEquals($expected, ArrayUtil::arrayUniqueRecursive($array));
     $array = array('testValue1', 'testValue1', 'testValue1');
     $expected = array('testValue1');
     $this->assertEquals($expected, ArrayUtil::arrayUniqueRecursive($array));
     $array = array(array('testKey1' => 'testValue1', 'testKey2' => 'testValue2', 'testKey3' => 'textValue3'));
     $expected = array(array('testKey1' => 'testValue1', 'testKey2' => 'testValue2', 'testKey3' => 'textValue3'));
     $this->assertEquals($expected, ArrayUtil::arrayUniqueRecursive($array));
     $array = array(array('testKey1' => 'testValue1', 'testKey2' => 'testValue1', 'testKey3' => 'textValue3'));
     $expected = array(array('testKey1' => 'testValue1', 'testKey3' => 'textValue3'));
     $this->assertEquals($expected, ArrayUtil::arrayUniqueRecursive($array));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:18,代码来源:ArrayUtilTest.php

示例2: resolveEmailRecipientsFromEmailMessage

 /**
  * Get recipient details from email message.
  * Have to cover two cases: when message is CC-ed or BCC-ed to dropbox,
  * and when email message is forwarded to dropbox.
  * 1. If message is CC-ed or BCC-ed to dropbox, recipients can be exctracted from "To" field of email message
  * 2. If message is forwarded, then email from which message is forwarded to dropbox is recipient
  * @param ImapMessage $emailMessage
  * @param array $emailRecipient
  */
 public static function resolveEmailRecipientsFromEmailMessage(ImapMessage $emailMessage)
 {
     // Check if email is forwarded or not.
     if (self::isMessageForwarded($emailMessage)) {
         // Somebody sent email to Zurmo user, the user forwarded it to dropbox, so the user is a recipient
         $emailRecipients = array(array('email' => $emailMessage->fromEmail, 'name' => $emailMessage->fromName, 'type' => EmailMessageRecipient::TYPE_TO));
     } else {
         $emailRecipients = array();
         // Zurmo user sent email, so recipients are in 'To' and 'CC' fields
         if (!empty($emailMessage->to)) {
             foreach ($emailMessage->to as $key => $value) {
                 $emailMessage->to[$key]['type'] = EmailMessageRecipient::TYPE_TO;
                 if ($value['email'] == Yii::app()->imap->imapUsername) {
                     unset($emailMessage->to[$key]);
                 }
             }
             $emailRecipients = array_merge($emailRecipients, $emailMessage->to);
         }
         if (!empty($emailMessage->cc)) {
             foreach ($emailMessage->cc as $key => $value) {
                 $emailMessage->cc[$key]['type'] = EmailMessageRecipient::TYPE_CC;
                 if ($value['email'] == Yii::app()->imap->imapUsername) {
                     unset($emailMessage->cc[$key]);
                 }
             }
             $emailRecipients = array_merge($emailRecipients, $emailMessage->cc);
         }
     }
     if (count($emailRecipients) == 0) {
         throw new NotSupportedException();
     }
     $emailRecipients = ArrayUtil::arrayUniqueRecursive($emailRecipients);
     //After removing duplicates email get removed if its the same as name
     foreach ($emailRecipients as $key => $emailRecipient) {
         if (!isset($emailRecipient['email'])) {
             $emailRecipients[$key]['email'] = $emailRecipient['name'];
         }
     }
     return $emailRecipients;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:49,代码来源:EmailArchivingUtil.php

示例3: arrayUniqueRecursive

 public static function arrayUniqueRecursive($array)
 {
     $result = array_map("unserialize", array_unique(array_map("serialize", $array)));
     foreach ($result as $key => $value) {
         if (is_array($value)) {
             $result[$key] = ArrayUtil::arrayUniqueRecursive($value);
         }
     }
     return $result;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:ArrayUtil.php

示例4: resolveEmailRecipientsFromEmailMessage

 /**
  * Get recipient details from email message.
  * Have to cover two cases: when message is CC-ed or BCC-ed to dropbox,
  * and when email message is forwarded to dropbox.
  * 1. If message is CC-ed or BCC-ed to dropbox, recipients can be exctracted from "To" field of email message
  * 2. If message is forwarded, then email from which message is forwarded to dropbox is recipient
  * @param ImapMessage $emailMessage
  * @param array $emailRecipient
  */
 public static function resolveEmailRecipientsFromEmailMessage(ImapMessage $emailMessage)
 {
     // Check if email is forwarded or not.
     if (self::isMessageForwarded($emailMessage)) {
         // Somebody sent email to Zurmo user, the user forwarded it to dropbox, so the user is a recipient
         $emailRecipients = array(array('email' => $emailMessage->fromEmail, 'name' => $emailMessage->fromName, 'type' => EmailMessageRecipient::TYPE_TO));
     } else {
         // Zurmo user sent email, so recipients are in 'To' and 'CC' fields
         foreach ($emailMessage->to as $key => $value) {
             $emailMessage->to[$key]['type'] = EmailMessageRecipient::TYPE_TO;
             if ($value['email'] == Yii::app()->imap->imapUsername) {
                 unset($emailMessage->to[$key]);
             }
         }
         $emailRecipients = $emailMessage->to;
         if (!empty($emailMessage->cc)) {
             foreach ($emailMessage->cc as $key => $value) {
                 $emailMessage->cc[$key]['type'] = EmailMessageRecipient::TYPE_CC;
                 if ($value['email'] == Yii::app()->imap->imapUsername) {
                     unset($emailMessage->cc[$key]);
                 }
             }
             $emailRecipients = ArrayUtil::arrayUniqueRecursive(array_merge($emailRecipients, $emailMessage->cc));
         }
     }
     return $emailRecipients;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:36,代码来源:EmailArchivingUtil.php


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