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


PHP ArrayUtils::getDeep方法代码示例

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


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

示例1: validateConfig

 public static function validateConfig($config, $create = true)
 {
     if (null === ArrayUtils::get($config, 'dsn', null, true)) {
         if (null === ArrayUtils::getDeep($config, 'options', 'db', null, true)) {
             throw new BadRequestException('Database name must be included in the \'dsn\' or as an \'option\' attribute.');
         }
     }
     return true;
 }
开发者ID:rajeshpillai,项目名称:df-couchdb,代码行数:9,代码来源:CouchDbConfig.php

示例2: getUserDn

 /**
  * Gets DN by username
  *
  * @param $username
  * @param $uidField
  *
  * @return string
  */
 public function getUserDn($username, $uidField = 'uid')
 {
     $baseDn = $this->baseDn;
     $connection = $this->connection;
     $search = ldap_search($connection, $baseDn, '(' . $uidField . '=' . $username . ')');
     $result = ldap_get_entries($connection, $search);
     $dn = ArrayUtils::getDeep($result, 0, 'dn');
     return $dn;
 }
开发者ID:df-arif,项目名称:df-adldap,代码行数:17,代码来源:OpenLdap.php

示例3: __call

 /**
  * Magic method to fetch any user value.
  *
  * @param string $method
  * @param array  $args
  *
  * @return mixed
  * @throws NotFoundException
  */
 public function __call($method, $args)
 {
     $key = strtolower(substr($method, 3));
     $data = $this->getData();
     if (in_array($key, ['dn', 'count'])) {
         return ArrayUtils::get($data, $key);
     }
     return ArrayUtils::getDeep($data, $key, 0);
 }
开发者ID:rajeshpillai,项目名称:df-adldap,代码行数:18,代码来源:LdapUser.php

示例4: getGroupByPrimaryGroupId

 protected function getGroupByPrimaryGroupId($id)
 {
     $groups = $this->search("(&(objectCategory=group)(objectClass=group))", ['*', 'primarygrouptoken']);
     array_shift($groups);
     foreach ($groups as $group) {
         if (ArrayUtils::getDeep($group, 'primarygrouptoken', 0) === $id) {
             return new ADGroup($group);
         }
     }
     throw new NotFoundException('Group not found by primarygrouptoken [' . $id . ']');
 }
开发者ID:df-arif,项目名称:df-adldap,代码行数:11,代码来源:ADLdap.php

示例5: updateEventFromHandler

 /**
  * Give a normalized event, put any changed data from the payload back into the event
  *
  * @param PlatformEvent $event
  * @param array         $exposedEvent
  *
  * @return $this
  */
 public static function updateEventFromHandler(PlatformEvent &$event, array $exposedEvent = [])
 {
     //  Did propagation stop?
     if (ArrayUtils::get($exposedEvent, 'stop_propagation', false)) {
         $event->stopPropagation();
     }
     $request = ArrayUtils::getDeep($exposedEvent, 'request', 'body');
     $response = ArrayUtils::get($exposedEvent, 'response', false);
     if (!$response) {
         //            Log::debug( 'No response in exposed event' );
     }
     if ($request) {
         if (!$event->isPostProcessScript()) {
             $event->setData($request);
         }
         $event->setRequestData($request);
     }
     if ($response) {
         if ($event->isPostProcessScript()) {
             $event->setData($response);
         }
         $event->setResponseData($response);
     }
     return $event;
 }
开发者ID:df-arif,项目名称:df-core,代码行数:33,代码来源:ScriptEvent.php

示例6: validateFieldValue


//.........这里部分代码省略.........
                         if ($throw) {
                             if (empty($msg)) {
                                 $msg = "Field '{$name}' value must be a valid email address.";
                             }
                             throw new BadRequestException($msg);
                         }
                         return false;
                     }
                     break;
                 case 'url':
                     $sections = ArrayUtils::clean(ArrayUtils::get($config, 'sections'));
                     $flags = 0;
                     foreach ($sections as $format) {
                         switch (strtolower($format)) {
                             case 'path':
                                 $flags &= FILTER_FLAG_PATH_REQUIRED;
                                 break;
                             case 'query':
                                 $flags &= FILTER_FLAG_QUERY_REQUIRED;
                                 break;
                         }
                     }
                     if (!empty($value) && !filter_var($value, FILTER_VALIDATE_URL, $flags)) {
                         if ($throw) {
                             if (empty($msg)) {
                                 $msg = "Field '{$name}' value must be a valid URL.";
                             }
                             throw new BadRequestException($msg);
                         }
                         return false;
                     }
                     break;
                 case 'int':
                     $min = ArrayUtils::getDeep($config, 'range', 'min');
                     $max = ArrayUtils::getDeep($config, 'range', 'max');
                     $formats = ArrayUtils::clean(ArrayUtils::get($config, 'formats'));
                     $options = [];
                     if (is_int($min)) {
                         $options['min_range'] = $min;
                     }
                     if (is_int($max)) {
                         $options['max_range'] = $max;
                     }
                     $flags = 0;
                     foreach ($formats as $format) {
                         switch (strtolower($format)) {
                             case 'hex':
                                 $flags &= FILTER_FLAG_ALLOW_HEX;
                                 break;
                             case 'octal':
                                 $flags &= FILTER_FLAG_ALLOW_OCTAL;
                                 break;
                         }
                     }
                     $options = ['options' => $options, 'flags' => $flags];
                     if (!is_null($value) && false === filter_var($value, FILTER_VALIDATE_INT, $options)) {
                         if ($throw) {
                             if (empty($msg)) {
                                 $msg = "Field '{$name}' value is not in the valid range.";
                             }
                             throw new BadRequestException($msg);
                         }
                         return false;
                     }
                     break;
                 case 'float':
开发者ID:rajeshpillai,项目名称:df-core,代码行数:67,代码来源:BaseDbTableResource.php

示例7: cleanRecord

 /**
  * @param array        $record
  * @param string|array $include  List of keys to include in the output record
  * @param string|array $id_field Single or list of identifier fields
  *
  * @return array
  */
 protected static function cleanRecord($record = [], $include = '*', $id_field = self::DEFAULT_ID_FIELD)
 {
     if ('*' == $include) {
         return $record;
     }
     //  Check for $record['_id']
     $id = ArrayUtils::get($record, $id_field, ArrayUtils::get($record, 'id'), false);
     //  Check for $record['_rev']
     $rev = ArrayUtils::get($record, static::REV_FIELD, ArrayUtils::get($record, 'rev', ArrayUtils::getDeep($record, 'value', 'rev'), false), false);
     $out = [$id_field => $id, static::REV_FIELD => $rev];
     if (empty($include)) {
         return $out;
     }
     if (!is_array($include)) {
         $include = array_map('trim', explode(',', trim($include, ',')));
     }
     foreach ($include as $key) {
         if (0 == strcasecmp($key, $id_field) || 0 == strcasecmp($key, static::REV_FIELD)) {
             continue;
         }
         $out[$key] = ArrayUtils::get($record, $key);
     }
     return $out;
 }
开发者ID:rajeshpillai,项目名称:df-couchdb,代码行数:31,代码来源:Table.php

示例8: getName

 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     return ArrayUtils::getDeep($this->getData(), 'name', 0);
 }
开发者ID:rajeshpillai,项目名称:df-adldap,代码行数:7,代码来源:ADUser.php


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