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


PHP Collection::implode方法代码示例

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


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

示例1: makeDistributedName

 protected function makeDistributedName()
 {
     $this->md5FileName = md5($this->getModel()->path . microtime(true)) . '.' . collect(explode('.', $this->getModel()->path))->last();
     $this->getModel()->old_name = $this->getModel()->path;
     $this->distributedPathCollection = collect([mb_substr($this->md5FileName, 0, 3), mb_substr($this->md5FileName, 3, 3), mb_substr($this->md5FileName, 6, 3)]);
     $this->getModel()->name = mb_substr($this->md5FileName, 9);
     $this->getModel()->distributed_path = $this->distributedPathCollection->implode($this->pathSeparator);
     $this->getModel()->path = $this->getModel()->distributed_path . $this->pathSeparator . $this->getModel()->name;
     return $this;
 }
开发者ID:garrinar,项目名称:laravel,代码行数:10,代码来源:Adapter.php

示例2: getCreatorsBatch

 public function getCreatorsBatch(Collection $channelIds)
 {
     $ids = $channelIds->implode(',');
     $params = ['id' => $ids, 'maxResults' => 50];
     $result = $this->source->getCreator($params);
     return Channel::createData(collect($result['items']));
 }
开发者ID:Gamespectre,项目名称:spectator-api,代码行数:7,代码来源:ChannelService.php

示例3: lookup

 /**
  * Get the account details of up to 100 users
  *
  * @param Collection $usernames
  * @return Collection
  */
 public function lookup(Collection $usernames)
 {
     $response = $this->client->get('users/lookup.json', ['query' => 'screen_name=' . $usernames->implode(','), 'http_errors' => false]);
     if ($response->getStatusCode() == Response::HTTP_NOT_FOUND) {
         return new Collection();
     }
     return new Collection(json_decode($response->getBody()));
 }
开发者ID:votemike,项目名称:shorttwittername,代码行数:14,代码来源:TwitterApi.php

示例4: getVideosBatch

 public function getVideosBatch(Collection $videoIds, $cacheKey, $force = false)
 {
     $videoIdsString = $videoIds->implode(',');
     $params = ['maxResults' => 50, 'id' => $videoIdsString];
     if ($force === true) {
         Cache::forget($cacheKey);
     }
     $results = Cache::rememberForever($cacheKey, function () use($params) {
         return $this->source->getVideo($params);
     });
     return Video::createData(collect($results['items']));
 }
开发者ID:Gamespectre,项目名称:spectator-api,代码行数:12,代码来源:VideoService.php

示例5: implode

 /**
  *
  *  集合元素 转换成 字符串
  *
  * implode
  *
  */
 public function implode()
 {
     $val = $this->collection->map(function ($val, $key) {
         return $val['price'];
     });
     debug($val);
     //Desk,Chair,Bookcase,Door
     $implode = $this->collection->implode('product', ',');
     debug($implode);
     //1-2-3-4-5
     $implode = collect([1, 2, 3, 4, 5])->implode('-');
     debug($implode);
     return view('index');
 }
开发者ID:tccLaravel,项目名称:learn,代码行数:21,代码来源:CollectionController.php

示例6: testImplode

 public function testImplode()
 {
     $data = new Collection([['name' => 'taylor', 'email' => 'foo'], ['name' => 'dayle', 'email' => 'bar']]);
     $this->assertEquals('foobar', $data->implode('email'));
     $this->assertEquals('foo,bar', $data->implode('email', ','));
     $data = new Collection(['taylor', 'dayle']);
     $this->assertEquals('taylordayle', $data->implode(''));
     $this->assertEquals('taylor,dayle', $data->implode(','));
 }
开发者ID:sa7bi,项目名称:euro16,代码行数:9,代码来源:SupportCollectionTest.php

示例7: request

 /**
  * Requests the abstract request. But before it does so, it sets a few properties
  * on the request like the extended level, page and it's limit
  *
  * @param AbstractRequest $request
  * @return mixed
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\RateLimitExceededException
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\ServerErrorException
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\ServerUnavailableException
  * @throws \Wubs\Trakt\Request\Exception\HttpCodeException\StatusCodeException
  */
 protected function request(AbstractRequest $request)
 {
     return $request->setExtended($this->extended->implode(','))->setPage($this->page)->setLimit($this->limit)->make($this->clientId, $this->client);
 }
开发者ID:kduma-archive,项目名称:trakt-api-wrapper,代码行数:15,代码来源:Endpoint.php

示例8: addProperties

 private function addProperties(Collection $properties)
 {
     $formatted = new Collection();
     $properties->each(function ($property) use($formatted) {
         $generator = new Property($this->apiNamespace . "\\" . $this->endpoint->implode("\\") . "\\" . $property, $this->filesystem);
         $formatted->push($generator->generate());
     });
     return $this->writeInTemplate('public_properties', "\n" . $formatted->implode("\n\n"));
 }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:9,代码来源:EndpointGenerator.php


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