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


PHP Collection::get方法代码示例

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


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

示例1: testGet

 /**
  * @test Collection::get()
  */
 public function testGet()
 {
     $this->buildEnvironment();
     $result = $this->collection->get('a1');
     $expect = $this->source['a1'];
     $this->assertEquals($expect, $result);
 }
开发者ID:timoxeen,项目名称:php-commerceml,代码行数:10,代码来源:CollectionTest.php

示例2: testPopPushPutShiftUnshiftInject

 public function testPopPushPutShiftUnshiftInject()
 {
     // pop
     $_3 = $this->collection->pop();
     $this->assertEquals($this->_3, $_3);
     $this->assertEquals($this->_2, $this->collection->last());
     $this->assertEquals(3, $this->collection->count());
     // push
     $this->collection->push($_3);
     $this->assertEquals($this->_3, $this->collection->last());
     // put
     $this->collection->put(2, 'test');
     $this->assertEquals('test', $this->collection->get(2));
     // shift
     $_0 = $this->collection->shift();
     $this->assertEquals($this->_0, $_0);
     $this->assertEquals($this->_1, $this->collection->first());
     $this->assertEquals(3, $this->collection->count());
     // unshift
     $this->collection->unshift($_0);
     $this->assertEquals($this->_0, $this->collection->first());
     // inject
     $this->collection->inject(2, 'test2');
     $this->assertEquals('test2', $this->collection->get(2));
     $this->assertEquals(5, $this->collection->count());
 }
开发者ID:dtkahl,项目名称:php-array-tools,代码行数:26,代码来源:CollectionTest.php

示例3: appendChildren

 private function appendChildren(Aggregate $entity, CollectionInterface $children) : Aggregate
 {
     $children->each(function (string $name, array $config) use(&$entity) {
         $config = new Collection($config);
         $rel = new ValueObjectRelationship(new ClassName($config->get('class')), new RelationshipType($config->get('type')), $name, $config->get('child')['property'], $config->hasKey('collection') ? (bool) $config->get('collection') : false);
         if ($config->hasKey('properties')) {
             $rel = $this->appendProperties($rel, new Collection($config->get('properties')));
         }
         $config = new Collection($config->get('child'));
         $child = new ValueObject(new ClassName($config->get('class')), $config->get('labels'), $rel);
         if ($config->hasKey('properties')) {
             $child = $this->appendProperties($child, new Collection($config->get('properties')));
         }
         $entity = $entity->withChild($child);
     });
     return $entity;
 }
开发者ID:innmind,项目名称:neo4j-onm,代码行数:17,代码来源:AggregateFactory.php

示例4: findImageSize

 /**
  * Find image size data
  *
  * @param string $sizeName
  * @return ImageSize
  */
 public function findImageSize($sizeName)
 {
     if ($this->imageSizes->containsKey($sizeName)) {
         return $this->imageSizes->get($sizeName);
     } else {
         return null;
     }
 }
开发者ID:sitesupra,项目名称:sitesupra,代码行数:14,代码来源:Image.php

示例5: get

 /**
  * /
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function get($id)
 {
     if (!is_string($id)) {
         throw new \Exception("Cookie index must be string", 03);
     }
     $newId = str_replace('.', '_', $id);
     $value = parent::get($newId);
     return new Cookie($value);
 }
开发者ID:pedrokoblitz,项目名称:maltz,代码行数:14,代码来源:CookieJar.php

示例6: get

 public function get($key = '', $defVal = null)
 {
     if (stripos($key, '.') !== false) {
         list($parentKey) = explode('.', $key);
         if (!array_key_exists($parentKey, $this->_loadedFiles)) {
             $this->_loadFile($parentKey);
         }
     }
     return parent::get($key, $defVal);
 }
开发者ID:zigiphp,项目名称:zigiphp,代码行数:10,代码来源:Config.php

示例7: testGetsElementByIndex

 public function testGetsElementByIndex()
 {
     $list = new Collection(\Cassandra::TYPE_VARINT);
     $list->add(new Varint('1'), new Varint('2'), new Varint('3'), new Varint('4'), new Varint('5'), new Varint('6'), new Varint('7'), new Varint('8'));
     $this->assertEquals(new Varint('1'), $list->get(0));
     $this->assertEquals(new Varint('2'), $list->get(1));
     $this->assertEquals(new Varint('3'), $list->get(2));
     $this->assertEquals(new Varint('4'), $list->get(3));
     $this->assertEquals(new Varint('5'), $list->get(4));
     $this->assertEquals(new Varint('6'), $list->get(5));
     $this->assertEquals(new Varint('7'), $list->get(6));
     $this->assertEquals(new Varint('8'), $list->get(7));
 }
开发者ID:Dylan1312,项目名称:php-driver,代码行数:13,代码来源:CollectionTest.php

示例8: get_instance_title

 /**
  * Optional method. If exists, allows this class to decide the title for
  * all blockinstances of this type
  */
 public static function get_instance_title(BlockInstance $bi)
 {
     $configdata = $bi->get('configdata');
     if (!empty($configdata['collection'])) {
         require_once 'collection.php';
         $data = get_record_select('collection', 'id = ?', array($configdata['collection']));
         $collection = new Collection($configdata['collection'], (array) $data);
         $title = $collection->get('name');
         return $title;
     }
     return '';
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:16,代码来源:lib.php

示例9: handler_participants

 protected function handler_participants(Collection $activities, $fields)
 {
     $res = XDB::iterator('SELECT  id, participant
                             FROM  activities_participants
                            WHERE  id IN {?}', $activities->ids());
     $users = new Collection('User');
     $part = array();
     while ($datas = $res->next()) {
         $part[$datas['id']][] = $users->addget($datas['participant']);
     }
     foreach ($part as $key => $obj) {
         $activities->get($key)->participants($obj);
     }
     $users->select($this->subs['participants']);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:15,代码来源:activityinstance.php

示例10: encode

 public function encode($script)
 {
     $this->search($script);
     $this->words->sort();
     $encoded = new Collection();
     // a dictionary of base62 -> base10
     $size = $this->words->size();
     for ($i = 0; $i < $size; $i++) {
         $encoded->put(Packer::encode62($i), $i);
     }
     $index = 0;
     foreach ($this->words as $word) {
         if ($encoded->has($word)) {
             $word->index = $encoded->get($word);
             $word->clear();
         } else {
             while ($this->words->has(Packer::encode62($index))) {
                 $index++;
             }
             $word->index = $index++;
             if ($word->count == 1) {
                 $word->clear();
             }
         }
         $word->replacement = Packer::encode62($word->index);
         if (strlen($word->replacement) == strlen($word)) {
             $word->clear();
         }
     }
     // sort by encoding
     $this->words->sort(array('Base62', 'sorter'));
     // trim unencoded words
     $this->words = $this->words->slice(0, preg_match_all('/\\|/', $this->getKeyWords(), $matches) + 1);
     $script = preg_replace_callback($this->getPattern(), array(&$this, '_word_replacement'), $script);
     /* build the packed script */
     $p = $this->escape($script);
     $a = '[]';
     $c = max($this->words->size(), 1);
     $k = $this->getKeyWords();
     $e = $this->getEncoder();
     $d = $this->getDecoder();
     // the whole thing
     return $this->format(Base62::$UNPACK, $p, $a, $c, $k, $e, $d);
 }
开发者ID:saarze,项目名称:base2,代码行数:44,代码来源:Base62.php

示例11: getDoctorsListCount

 public function getDoctorsListCount($latitude = 0, $longitude = 0, $query = array())
 {
     $this->data = DB::table('doctors');
     $this->data->leftJoin('doctors_details AS dhospital', 'doctors.id', '=', 'dhospital.doctor_id');
     $this->data->leftJoin('listing_hospitals', 'dhospital.detail_id', '=', 'listing_hospitals.id');
     $this->data->leftJoin('doctors_details AS dhmo', 'doctors.id', '=', 'dhmo.doctor_id');
     $this->data->leftJoin('listing_hmo', 'dhmo.detail_id', '=', 'listing_hmo.id');
     $this->data->leftJoin('doctors_specialization', 'doctors.id', '=', 'doctors_specialization.doctor_id');
     $this->data->leftJoin('location_cities', 'listing_hospitals.city', '=', 'location_cities.id');
     $this->data->leftJoin('location_provinces', 'listing_hospitals.province', '=', 'location_provinces.id');
     $this->data->select(DB::raw("doctors.*, dhospital.detail_id as hospital_id, listing_hospitals.listing_title as hospital_title, listing_hospitals.latitude, listing_hospitals.longitude, listing_hospitals.street, location_cities.city_name, location_provinces.province_name, dhmo.detail_id as hmo_id, listing_hmo.listing_title as hmo_title, doctors_specialization.specialization_id, (6371 * acos (cos ( radians(?) ) * cos( radians( listing_hospitals.latitude ) ) * cos( radians( listing_hospitals.longitude ) - radians(?) ) + sin ( radians(?) ) * sin( radians( listing_hospitals.latitude ) ))) AS distance"))->setBindings([$latitude, $longitude, $latitude]);
     $this->data->where('dhospital.detail_type', '=', 1);
     $this->data->where('dhmo.detail_type', '=', 4);
     if (isset($query['specializations'])) {
         $this->data->whereIn('doctors_specialization.specialization_id', $query['specializations']);
     }
     if (isset($query['locations'])) {
         $this->data->whereIn('listing_hospitals.city', $query['locations']);
     }
     $this->data->groupBy('doctors.id');
     // }
     return $this->data->get();
 }
开发者ID:pbanjoplasabas,项目名称:mydoctorfinder,代码行数:23,代码来源:Doctors.php

示例12: handler_cuvisibility

 /**
  * Select a GID which identifies the visibility of a caste-user assocation
  */
 protected function handler_cuvisibility(Collection $users, $fields)
 {
     $_users = array();
     foreach ($users as $u) {
         $_users[$u->id()] = array();
     }
     $viscoll = new Collection('Group');
     $iter = XDB::iterRow('SELECT  uid, cid, visibility
                             FROM  castes_users
                            WHERE  uid IN {?}', $users->ids());
     while (list($uid, $cid, $vis) = $iter->next()) {
         $_users[$uid][$cid] = $vis;
         if ($vis != 0) {
             $viscoll->add($vis);
         }
     }
     $viscoll->select(GroupSelect::base());
     foreach ($users as $u) {
         $cuarray = array_map(function ($gid) use($viscoll) {
             return $gid == 0 ? null : $viscoll->get($gid);
         }, $_users[$u->id()]);
         $u->fillFromArray(array('cuvisibility' => $cuarray));
     }
 }
开发者ID:netixx,项目名称:frankiz,代码行数:27,代码来源:user.php

示例13: Collection

<?php

$collection = new Collection(['a' => 'apple', 'b' => 'banana', 'c' => 'carrot']);
$collection->get('b');
//
// RETURNS:
//
// 'banana'
//
开发者ID:dotink,项目名称:flourish-collection,代码行数:9,代码来源:with_string.php

示例14: get

 /**
  * {@inheritdoc}
  */
 public function get($key)
 {
     $this->initialize();
     return $this->coll->get($key);
 }
开发者ID:richardmiller,项目名称:mongodb-odm,代码行数:8,代码来源:PersistentCollection.php

示例15: isXmlHttpRequest

 /**
  * Returns true if the request is a XMLHttpRequest.
  *
  * It works if your JavaScript library set an X-Requested-With HTTP header.
  * It is known to work with Prototype, Mootools, jQuery.
  *
  * @return Boolean true if the request is an XMLHttpRequest, false otherwise
  *
  * @api
  */
 public function isXmlHttpRequest()
 {
     return 'XMLHttpRequest' == $this->headers->get('X_REQUESTED_WITH');
 }
开发者ID:phpalchemy,项目名称:http,代码行数:14,代码来源:Request.php


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