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


PHP Arr::pull方法代码示例

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


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

示例1: replaceNamedParameters

 /**
  * Replace all of the named parameters in the path.
  *
  * @param  string $path
  * @param  array  $parameters
  *
  * @return string
  */
 protected function replaceNamedParameters($path, &$parameters)
 {
     $this->ensureTenancyInParameters($path, $parameters);
     return preg_replace_callback('/\\{(.*?)\\??\\}/', function ($m) use(&$parameters) {
         return isset($parameters[$m[1]]) ? Arr::pull($parameters, $m[1]) : $m[0];
     }, $path);
 }
开发者ID:illuminate3,项目名称:laravel-doctrine-tenancy,代码行数:15,代码来源:UrlGenerator.php

示例2: __construct

 /**
  * 根据配置文件初始化client
  * @param  array  $servers
  * @param int  $timeOut
  * @return  void
  */
 public function __construct(array $servers = [], $timeOut = 5)
 {
     $cluster = Arr::pull($servers, 'cluster');
     $options = (array) Arr::pull($servers, 'options');
     $this->timeOut = Arr::pull($servers, 'timeout');
     $this->clients = $this->createClients($servers, $options);
 }
开发者ID:TeamOfMalaysia,项目名称:TOM-BLOG,代码行数:13,代码来源:RedisService.php

示例3: createClusters

 /**
  * Create multiple clusters (aggregate clients).
  *
  * @param  array  $clusters
  * @param  array  $options
  * @return void
  */
 protected function createClusters(array $clusters, array $options = [])
 {
     $options = array_merge($options, (array) Arr::pull($clusters, 'options'));
     foreach ($clusters as $name => $servers) {
         $this->clients += $this->createAggregateClient($name, $servers, array_merge($options, (array) Arr::pull($servers, 'options')));
     }
 }
开发者ID:jarnovanleeuwen,项目名称:framework,代码行数:14,代码来源:PhpRedisDatabase.php

示例4: __construct

 /**
  * 根据配置文件初始化client
  *
  * @param  array  $servers
  * @return void
  */
 public function __construct(array $servers = [], $timeOut = 5)
 {
     $cluster = Arr::pull($servers, 'cluster');
     $options = (array) Arr::pull($servers, 'options');
     $this->clients = $this->createClients($servers, $options);
     $this->timeOut = $timeOut;
     $this->curConnection = $this->clients['default'];
 }
开发者ID:hacklee,项目名称:laravel5-php-redis,代码行数:14,代码来源:PRedis.php

示例5: broadcast

 /**
  * Broadcast the given event.
  *
  * @param  array  $channels
  * @param  string  $event
  * @param  array  $payload
  * @return void
  */
 public function broadcast(array $channels, $event, array $payload = [])
 {
     $socket = Arr::pull($payload, 'socket');
     $payload = ['event' => $event, 'data' => $payload, 'socket' => $socket];
     foreach ($this->formatChannels($channels) as $channel) {
         LaravooleFacade::task(['channel' => $channel, 'payload' => $payload]);
     }
 }
开发者ID:acabin,项目名称:laravoole,代码行数:16,代码来源:LaravooleBoardcaster.php

示例6: getAccessTokenResponse

 /**
  * {@inheritdoc}
  */
 public function getAccessTokenResponse($code)
 {
     $postKey = version_compare(ClientInterface::VERSION, '6') === 1 ? 'form_params' : 'body';
     $response = $this->getHttpClient()->post($this->getTokenUrl(), [$postKey => $this->getTokenFields($code)]);
     $data = [];
     parse_str($response->getBody(), $data);
     return Arr::add($data, 'expires_in', Arr::pull($data, 'expires'));
 }
开发者ID:telenok,项目名称:account,代码行数:11,代码来源:FacebookProvider.php

示例7: broadcast

 /**
  * Broadcast the given event.
  *
  * @param  array  $channels
  * @param  string  $event
  * @param  array  $payload
  * @return void
  */
 public function broadcast(array $channels, $event, array $payload = [])
 {
     $socket = Arr::pull($payload, 'socket');
     $response = $this->pusher->trigger($this->formatChannels($channels), $event, $payload, $socket);
     if (is_array($response) && $response['status'] >= 200 && $response['status'] <= 299 || $response === true) {
         return;
     }
     throw new BroadcastException(is_bool($response) ? 'Failed to connect to Pusher.' : $response['body']);
 }
开发者ID:bryanashley,项目名称:framework,代码行数:17,代码来源:PusherBroadcaster.php

示例8: createDriver

 /**
  * Create a new driver instance.
  *
  * @param  string  $driver
  *
  * @return \Orchestra\Tenanti\Migrator\FactoryInterface
  *
  * @throws \InvalidArgumentException
  */
 protected function createDriver($driver)
 {
     $config = Arr::pull($this->config, "drivers.{$driver}");
     $chunk = Arr::pull($this->config, 'chunk', 100);
     if (is_null($config)) {
         throw new InvalidArgumentException("Driver [{$driver}] not supported.");
     }
     return $this->app->make($this->resolver, [$this->app, $driver, $config, $chunk]);
 }
开发者ID:DavidIWilson,项目名称:site1,代码行数:18,代码来源:TenantiManager.php

示例9: broadcast

 /**
  * Broadcast the given event.
  *
  * @param  array  $channels
  * @param  string  $event
  * @param  array  $payload
  * @return void
  */
 public function broadcast(array $channels, $event, array $payload = [])
 {
     $connection = $this->redis->connection($this->connection);
     $socket = Arr::pull($payload, 'socket');
     $payload = json_encode(['event' => $event, 'data' => $payload, 'socket' => $socket]);
     foreach ($this->formatChannels($channels) as $channel) {
         $connection->publish($channel, $payload);
     }
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:17,代码来源:RedisBroadcaster.php

示例10: __construct

 /**
  * Create a new Redis connection instance.
  *
  * @param  array  $servers
  * @return void
  */
 public function __construct(array $servers = [])
 {
     $cluster = Arr::pull($servers, 'cluster');
     $options = array_merge(['timeout' => 10.0], (array) Arr::pull($servers, 'options'));
     if ($cluster) {
         $this->clients = $this->createAggregateClient($servers, $options);
     } else {
         $this->clients = $this->createSingleClients($servers, $options);
     }
 }
开发者ID:hannesvdvreken,项目名称:framework,代码行数:16,代码来源:PredisDatabase.php

示例11: __construct

 /**
  * Create a new Redis connection instance.
  *
  * @param  array  $servers
  * @return void
  */
 public function __construct(array $servers = [])
 {
     $cluster = Arr::pull($servers, 'cluster');
     if ($cluster) {
         $options = (array) Arr::pull($servers['clusterConfig'], 'options');
         $this->clients = $this->createAggregateClient($servers['clusterConfig'], $options);
     } else {
         $options = (array) Arr::pull($servers, 'options');
         $this->clients = $this->createSingleClients($servers, $options);
     }
 }
开发者ID:barbery,项目名称:laravel-phpredis,代码行数:17,代码来源:Database.php

示例12: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('redis', function ($app) {
         $servers = $app['config']['database.redis'];
         $client = Arr::pull($servers, 'client', 'predis');
         if ($client === 'phpredis') {
             return new PhpRedisDatabase($servers);
         } else {
             return new PredisDatabase($servers);
         }
     });
 }
开发者ID:hannesvdvreken,项目名称:framework,代码行数:17,代码来源:RedisServiceProvider.php

示例13: createSingleClients

 /**
  * Create an array of single connection or sentinel clients
  *
  * @param  array  $servers
  * @param  array  $options
  * @return array
  */
 protected function createSingleClients(array $servers, array $options = [])
 {
     $clients = [];
     foreach ($servers as $key => $server) {
         $options = array_merge($options, Arr::pull($server, 'options'));
         $clients[$key] = new Client($server, $options);
         if (isset($options['update_sentinels']) && boolval($options['update_sentinels']) === true) {
             $clients[$key]->getConnection()->setUpdateSentinels(true);
         }
     }
     return $clients;
 }
开发者ID:cooperaj,项目名称:laravel-redis-sentinel,代码行数:19,代码来源:Database.php

示例14: all

 public static function all($params = [])
 {
     $metadata = [];
     $response = static::requestToArray('GET', null, $params);
     if (Arr::has($response, 'metadata')) {
         $metadata = Arr::pull($response, 'metadata');
         $response = Arr::pull($response, 'data');
     }
     // Create collection of current class
     $collection = Collection::makeOf(static::class, $response);
     // Set metada property to main object
     foreach ($metadata as $key => $value) {
         $collection->{$key} = $value;
     }
     return $collection;
 }
开发者ID:loduis,项目名称:alegra-php,代码行数:16,代码来源:Metadata.php

示例15: getModels

 /**
  * Get the hydrated models without eager loading.
  *
  * @param array $columns
  *
  * @return \Illuminate\Database\Eloquent\Model[]
  */
 public function getModels($columns = ['*'])
 {
     $results = $this->query->get($columns);
     $connection = $this->model->getConnectionName();
     // Check for joined relations
     if (!empty($this->joined)) {
         foreach ($results as $key => $result) {
             $relation_values = [];
             foreach ($result as $column => $value) {
                 Arr::set($relation_values, $column, $value);
             }
             foreach ($this->joined as $relationName) {
                 $relation = $this->getRelation($relationName);
                 $relation_values[$relationName] = $relation->getRelated()->newFromBuilder(Arr::pull($relation_values, $relationName), $connection);
             }
             $results[$key] = $relation_values;
         }
     }
     return $this->model->hydrate($results, $connection)->all();
 }
开发者ID:pendalff,项目名称:eloquent-joins,代码行数:27,代码来源:Builder.php


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