當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。