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


PHP array_uintersect函数代码示例

本文整理汇总了PHP中array_uintersect函数的典型用法代码示例。如果您正苦于以下问题:PHP array_uintersect函数的具体用法?PHP array_uintersect怎么用?PHP array_uintersect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: intersect

 /**
  * Short description of method intersect
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @param  Collection collection
  * @return core_kernel_classes_ContainerCollection
  */
 public function intersect(common_Collection $collection)
 {
     $returnValue = null;
     $returnValue = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__));
     $returnValue->sequence = array_uintersect($this->sequence, $collection->sequence, 'core_kernel_classes_ContainerComparator::compare');
     return $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:15,代码来源:class.ContainerCollection.php

示例2: execute

 public function execute(array $collection)
 {
     $comparer = $this->getComparer();
     return array_values(array_uintersect($collection, $this->collectionToIntersect, function ($a, $b) use($comparer) {
         return $comparer->equals($a, $b);
     }));
 }
开发者ID:pablozabo,项目名称:Diarco,代码行数:7,代码来源:IntersectQuery.php

示例3: listAction

 /**
  * 获取版块列表
  */
 public function listAction()
 {
     /* @var $daoBoard Dao_Td_Board_Board */
     $daoBoard = Tudu_Dao_Manager::getDao('Dao_Td_Board_Board', Tudu_Dao_Manager::DB_TS);
     $boards = $daoBoard->getBoards(array('orgid' => $this->_user->orgId, 'uniqueid' => $this->_user->uniqueId))->toArray('boardid');
     $return = array();
     foreach ($boards as $bid => $board) {
         if ($board['issystem'] || $board['status'] != 0) {
             continue;
         }
         if ($board['parentid']) {
             if (!array_key_exists($bid, $boards)) {
                 continue;
             }
             if (!in_array('^all', $board['groups']) && !(in_array($this->_user->userName, $board['groups'], true) || in_array($this->_user->address, $board['groups'], true)) && !sizeof(array_uintersect($this->_user->groups, $board['groups'], "strcasecmp")) && !array_key_exists($this->_user->userId, $board['moderators']) && !($board['ownerid'] == $this->_user->userId) && !array_key_exists($this->_user->userId, $boards[$board['parentid']]['moderators'])) {
                 continue;
             }
             $boards[$board['parentid']]['children'][] =& $boards[$bid];
         } else {
             $return[] =& $boards[$bid];
         }
     }
     $ret = array();
     foreach ($return as $item) {
         if (empty($item['children'])) {
             continue;
         }
         $ret[] = array('orgid' => $item['orgid'], 'boardid' => $item['boardid'], 'type' => $item['type'], 'boardname' => $item['boardname'], 'privacy' => (int) $item['privacy'], 'ordernum' => (int) $item['ordernum'], 'issystem' => (int) $item['issystem'], 'needconfirm' => (int) $item['needconfirm'], 'isflowonly' => (int) $item['flowonly'], 'isclassify' => (int) $item['isclassify'], 'status' => (int) $item['status'], 'children' => $this->_formatBoardChildren($item['children']), 'updatetime' => null);
     }
     $this->view->code = TuduX_OpenApi_ResponseCode::SUCCESS;
     $this->view->boards = $ret;
 }
开发者ID:bjtenao,项目名称:tudu-web,代码行数:35,代码来源:BoardController.php

示例4: parse

 /**
  * Parses the search text to a query wich will search in each of the specified fields.
  * If operators AND, OR or NOT are used in the text it is considered search text query and is passed as it is.
  * If it is a simple text - it is escaped and truncated.
  * 
  * @param string $searchText
  * @param array $fields
  * @param string $truncate
  */
 public function parse($searchText, $truncate, $fields)
 {
     $nonTokenizedFields = array_uintersect($fields, self::$_nonTokenizedFields, array('OpenSKOS_Solr_Queryparser_Editor_ParseSearchText', 'compareMultiLangFields'));
     $fields = array_udiff($fields, self::$_nonTokenizedFields, array('OpenSKOS_Solr_Queryparser_Editor_ParseSearchText', 'compareMultiLangFields'));
     $simpleFieldsQuery = '';
     $normalFieldsQuery = '';
     if ($this->_isSearchTextQuery($searchText)) {
         $simpleFieldsQuery = $this->_buildQueryForSearchTextInFields('(' . $searchText . ')', $nonTokenizedFields);
         $normalFieldsQuery = $this->_buildQueryForSearchTextInFields('(' . $searchText . ')', $fields);
     } else {
         $trimedSearchText = trim($searchText);
         if (empty($trimedSearchText)) {
             $searchText = '*';
         }
         $searchTextForNonTokenized = $this->_escapeSpecialChars($searchText);
         $simpleFieldsQuery = $this->_buildQueryForSearchTextInFields('(' . $searchTextForNonTokenized . ')', $nonTokenizedFields);
         $searchTextForTokenized = $this->_replaceTokenizeDelimiterChars($searchText);
         $normalFieldsQuery = $this->_buildQueryForSearchTextInFields('(' . $searchTextForTokenized . ')', $fields);
     }
     if ($simpleFieldsQuery != '' && $normalFieldsQuery != '') {
         return $simpleFieldsQuery . ' OR ' . $normalFieldsQuery;
     } else {
         return $simpleFieldsQuery . $normalFieldsQuery;
     }
 }
开发者ID:rubensworks,项目名称:OpenSKOS,代码行数:34,代码来源:ParseSearchText.php

示例5: collect

 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return \Generated\Shared\Transfer\DiscountableItemTransfer[]
  */
 public function collect(QuoteTransfer $quoteTransfer)
 {
     $lefCollectedItems = $this->left->collect($quoteTransfer);
     $rightCollectedItems = $this->right->collect($quoteTransfer);
     return array_uintersect($lefCollectedItems, $rightCollectedItems, function (DiscountableItemTransfer $collected, DiscountableItemTransfer $toCollect) {
         return strcmp(spl_object_hash($collected->getOriginalItemCalculatedDiscounts()), spl_object_hash($toCollect->getOriginalItemCalculatedDiscounts()));
     });
 }
开发者ID:spryker,项目名称:Discount,代码行数:13,代码来源:CollectorAndSpecification.php

示例6: filterArray

 public function filterArray(&$array, $children = false)
 {
     if ($children === false) {
         $children = $this->children;
     }
     $count = count($children);
     if ($count === 1) {
         $children[0]->filterArray($array);
     } else {
         $processedArray = array();
         $opArray = array();
         //Process parens first
         $parens = array();
         for ($i = 0; $i < $count; $i++) {
             if (!isset($children[$i])) {
                 continue;
             }
             if ($children[$i] === '(') {
                 unset($children[$i]);
                 for ($j = $i + 1; $j < $count; $j++) {
                     if ($children[$j] === ')') {
                         unset($children[$j]);
                         break;
                     }
                     array_push($parens, $children[$j]);
                     unset($children[$j]);
                 }
                 $index = array_push($processedArray, $array);
                 $this->filterArray($processedArray[$index - 1], $parens);
                 $parens = null;
             }
         }
         for ($i = 0; $i < $count; $i++) {
             if (!isset($children[$i])) {
                 continue;
             }
             if (is_object($children[$i])) {
                 $index = array_push($processedArray, $array);
                 $children[$i]->filterArray($processedArray[$index - 1]);
             } else {
                 array_push($opArray, $children[$i]);
             }
         }
         $i = 1;
         foreach ($opArray as $op) {
             if ($op === 'and') {
                 $tmp = array_uintersect($processedArray[0], $processedArray[$i], array($this, 'compareAll'));
                 $processedArray[0] = $tmp;
                 $i++;
             } else {
                 throw new Exception('Not handling or yet!');
             }
         }
         $array = $processedArray[0];
     }
 }
开发者ID:pboyd04,项目名称:SlimOData,代码行数:56,代码来源:class.ODataFilter.php

示例7: test

function test($a1, $a2, $k)
{
    $res = array_uintersect($a1, $a2, function ($i, $j) use($k) {
        if ($i[$k] == $j[$k]) {
            return 0;
        }
        return -1;
    });
    return $res;
}
开发者ID:xzungshao,项目名称:iphp,代码行数:10,代码来源:tArray.php

示例8: dbmsSelector

 public function dbmsSelector($name = 'dbType', $default = NULL)
 {
     $availableDrivers = Doctrine_Manager::getInstance()->getCurrentConnection()->getAvailableDrivers();
     $supportedDrivers = Doctrine_Manager::getInstance()->getCurrentConnection()->getSupportedDrivers();
     $drivers = array_uintersect($availableDrivers, $supportedDrivers, 'strcasecmp');
     foreach ($drivers as $driver) {
         $driversPDO[$driver] = $driver;
     }
     $dbTypes = $driversPDO;
     return form::dropdown($name, $dbTypes, $default);
 }
开发者ID:swk,项目名称:bluebox,代码行数:11,代码来源:OdbcManager.php

示例9: itemsForUpdate

 /**
  * Возвращает элементы изменившиеся с последнего обновления
  * @param  Array  $newArray    новые данные
  * @param  Array  $originArray текущие данные
  * @return Array             
  */
 public static function itemsForUpdate(array $newArray, array $originArray)
 {
     return array_uintersect($newArray, $originArray, function ($a, $b) {
         if ($a['id'] < $b['id']) {
             return -1;
         } elseif ($a['id'] > $b['id']) {
             return 1;
         } else {
             if ($a != $b) {
                 return 0;
             } else {
                 return 1;
             }
         }
     });
 }
开发者ID:QSODevelopers,项目名称:yupe-storeswap,代码行数:22,代码来源:DataDelimiter.php

示例10: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $integration_object = $options['integration_object'];
     //add custom feature settings
     $integration_object->appendToForm($builder, $options['data'], 'features');
     $leadFields = $options['lead_fields'];
     $formModifier = function (FormInterface $form, $data, $method = 'get') use($integration_object, $leadFields) {
         $settings = ['silence_exceptions' => false, 'feature_settings' => $data];
         try {
             $fields = $integration_object->getFormLeadFields($settings);
             if (!is_array($fields)) {
                 $fields = [];
             }
             $error = '';
         } catch (\Exception $e) {
             $fields = [];
             $error = $e->getMessage();
         }
         list($specialInstructions, $alertType) = $integration_object->getFormNotes('leadfield_match');
         /**
          * Auto Match Integration Fields with Mautic Fields.
          */
         $flattenLeadFields = [];
         foreach (array_values($leadFields) as $fieldsWithoutGroups) {
             $flattenLeadFields = array_merge($flattenLeadFields, $fieldsWithoutGroups);
         }
         $integrationFields = array_keys($fields);
         $flattenLeadFields = array_keys($flattenLeadFields);
         $fieldsIntersection = array_uintersect($integrationFields, $flattenLeadFields, 'strcasecmp');
         $autoMatchedFields = [];
         foreach ($fieldsIntersection as $field) {
             $autoMatchedFields[$field] = strtolower($field);
         }
         $form->add('leadFields', 'integration_fields', ['label' => 'mautic.integration.leadfield_matches', 'required' => true, 'lead_fields' => $leadFields, 'data' => isset($data['leadFields']) && !empty($data['leadFields']) ? $data['leadFields'] : $autoMatchedFields, 'integration_fields' => $fields, 'special_instructions' => $specialInstructions, 'alert_type' => $alertType]);
         if ($method == 'get' && $error) {
             $form->addError(new FormError($error));
         }
     };
     $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($formModifier) {
         $data = $event->getData();
         $formModifier($event->getForm(), $data);
     });
     $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use($formModifier) {
         $data = $event->getData();
         $formModifier($event->getForm(), $data, 'post');
     });
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:51,代码来源:FeatureSettingsType.php

示例11: relatedCargo

 public function relatedCargo()
 {
     $from_radius = (int) $this->from_radius;
     $radius_from = ($from_radius < 25 ? 25 : $from_radius) / 111.144;
     $lat_from = (double) $this->from_address_lat;
     $lng_from = (double) $this->from_address_long;
     $conditionFrom = "((a.lat BETWEEN '" . ($lat_from - $radius_from) . "' AND '" . ($lat_from + $radius_from) . "') \r\n              AND (a.`long` BETWEEN '" . ($lng_from - $radius_from) . "' AND '" . ($lng_from + $radius_from) . "')\r\n              AND (SQRT(POW(" . $lat_from . "-a.lat,2)+POW(" . $lng_from . "-a.`long`,2)) <" . $radius_from . ") AND a.direction='from')";
     $cargoIdFrom = Yii::app()->db->createCommand()->select('ra.cargo_id')->from('site_cargo_address ra')->leftJoin('site_address a', 'a.address_id=ra.address_id')->where($conditionFrom)->queryColumn();
     $to_radius = (int) $this->to_radius;
     $radius_to = ($to_radius < 25 ? 25 : $to_radius) / 111.144;
     $lat_to = (double) $this->to_address_lat;
     $lng_to = (double) $this->to_address_long;
     $conditionTo = "((a.lat BETWEEN '" . ($lat_to - $radius_to) . "' AND '" . ($lat_to + $radius_to) . "') \r\n              AND (a.`long` BETWEEN '" . ($lng_to - $radius_to) . "' AND '" . ($lng_to + $radius_to) . "')\r\n              AND (SQRT(POW(" . $lat_to . "-a.lat,2)+POW(" . $lng_to . "-a.`long`,2)) <" . $radius_to . ") AND a.direction='to')";
     $cargoIdTo = Yii::app()->db->createCommand()->select('ra.cargo_id')->from('site_cargo_address ra')->leftJoin('site_address a', 'a.address_id=ra.address_id')->where($conditionTo)->queryColumn();
     $cargoIds = array_uintersect($cargoIdFrom, $cargoIdTo, "strcasecmp");
     return $cargoIds;
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:17,代码来源:CargoSearchForm.php

示例12: isValid

 /**
  * @see Editor_Models_ConceptValidator::validate($concept)
  */
 public function isValid(Editor_Models_Concept $concept, $extraData)
 {
     $this->_setField('broader');
     $isValid = true;
     $allBroaders = $concept->getRelationsByField('broader', null, array($concept, 'getAllRelations'));
     $allNarrowers = $concept->getRelationsByField('narrower', null, array($concept, 'getAllRelations'));
     $matches = array_uintersect($allBroaders, $allNarrowers, array('Api_Models_Concept', 'compare'));
     if (!empty($matches)) {
         $isValid = false;
         foreach ($matches as $broader) {
             $broader = new Editor_Models_Concept($broader);
             $this->_addConflictedConcept($broader);
         }
     }
     if (!$isValid) {
         $this->_setErrorMessage(_('One or more of the broader relations create a cycle'));
     }
     return $isValid;
 }
开发者ID:olhsha,项目名称:OpenSKOS2tempMeertens,代码行数:22,代码来源:SameBroaderAndNarrower.php

示例13: import

 /**
  * @param $tableName
  * @param $columns
  * @param @CsvFile[] $sourceData
  */
 public function import($tableName, $columns, array $sourceData, array $options = [])
 {
     $this->importedRowsCount = 0;
     $this->importedColumns = 0;
     $this->warnings = [];
     $this->timers = [];
     $this->validate($tableName, $columns);
     $stagingTableName = $this->createStagingTable($tableName, $this->getIncremental());
     foreach ($sourceData as $csvFile) {
         $this->importTableColumnsAll($stagingTableName, $columns, $csvFile);
     }
     if ($this->getIncremental()) {
         $importColumns = array_uintersect($this->tableColumns($tableName), $columns, 'strcasecmp');
         $this->insertOrUpdateTargetTable($stagingTableName, $tableName, $importColumns);
     } else {
         $this->swapTables($stagingTableName, $tableName);
     }
     $this->dropTable($stagingTableName, $this->getIncremental());
     return new Result(['warnings' => $this->warnings, 'timers' => $this->timers, 'importedRowsCount' => $this->importedRowsCount, 'importedColumns' => $this->importedColumns]);
 }
开发者ID:keboola,项目名称:php-db-import,代码行数:25,代码来源:CsvImportMysql.php

示例14: getComponentsToRegister

 /**
  * Get components to be added.
  *
  * @return array
  */
 protected function getComponentsToRegister()
 {
     static $components = null;
     if (!is_null($components)) {
         return $components;
     }
     $mode = Settings::get('mode', 'all');
     $componentsTmp = [];
     if ($mode == 'allBut') {
         $componentsTmp = array_udiff($this->componentList, $this->getSettingsList(), 'strcasecmp');
     } elseif ($mode == 'only') {
         $componentsTmp = array_uintersect($this->componentList, $this->getSettingsList(), 'strcasecmp');
     } else {
         $componentsTmp = $this->componentList;
     }
     $components = [];
     foreach ($componentsTmp as $component) {
         $components['Krisawzm\\Embed\\Components\\' . $component] = $component . 'Embed';
     }
     return $components;
 }
开发者ID:aydancoskun,项目名称:octobercms,代码行数:26,代码来源:Plugin.php

示例15: execute

 public function execute(&$value, &$error)
 {
     // check if we have a list
     $array_choice = $this->getParameter('array_choice', array());
     // check if we have a config entry
     $config_choice = sfConfig::get($this->getParameter('config_choice', null));
     $config_choice = is_null($config_choice) ? array() : array_keys($config_choice);
     // merge the two arrays (no need to array_unique it)
     $choice_list = array_merge($array_choice, $config_choice);
     // check if we have an exception list
     $exception_list = $this->getParameter('array_except', array());
     // whether the entry value is unique or not
     $unique = $this->getParameter('unique', true);
     // check if this is lega values
     if ($unique && (is_array($value) || !in_array($value, $choice_list) || in_array($value, $exception_list)) || !$unique && (!is_array($value) || !count(array_uintersect($value, $choice_list, 'strcmp')) || count(array_uintersect($value, $exception_list, 'strcmp')))) {
         $error = $this->getParameter('bad_choice_error', 'bad choice error');
         return false;
     }
     // check if we have an exclusive list
     $exclusive_list = $this->getParameter('array_exclusive', array());
     $exclusive_error = false;
     if (!$unique && count($exclusive_list)) {
         $diff_list = array_udiff($choice_list, $exclusive_list, 'strcmp');
         if (count(array_uintersect($value, $exclusive_list, 'strcmp')) && count(array_uintersect($value, $diff_list, 'strcmp'))) {
             $error = $this->getParameter('exclusive_choice_error', 'bad choice error');
             return false;
         }
     }
     // check if we have an inclusive list
     $inclusive_list = $this->getParameter('array_inclusive', array());
     $inclusive_error = false;
     if (count($inclusive_list)) {
         $diff_list = array_udiff($choice_list, $inclusive_list, 'strcmp');
         if (count(array_uintersect($value, $inclusive_list, 'strcmp')) && !count(array_uintersect($value, $diff_list, 'strcmp'))) {
             $error = $this->getParameter('inclusive_choice_error', 'bad choice error');
             return false;
         }
     }
     return true;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:40,代码来源:myChoiceValidator.class.php


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