本文整理汇总了PHP中Map::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::get方法的具体用法?PHP Map::get怎么用?PHP Map::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectTypeOf
/**
* @param <type> $key
* @return Provider
*/
private function selectTypeOf($key)
{
if ($this->types->containsKey($key)) {
return $this->types->get($key);
}
return null;
}
示例2: testCopy
public function testCopy()
{
$copy = $this->properties->copy();
$copy->set('foo5', 'bar5');
$this->assertEquals('bar5', $copy->get('foo5'));
$this->assertEquals(null, $this->properties->get('foo5'));
}
示例3: search
/**
*
* @param <type> $table
* @param ArrayIterator $params
* @return ArrayObject
*/
public function search($table, ArrayIterator $params)
{
$this->searchParams = $params;
$this->join();
if ($table == "analysis") {
$this->statements->remove("type_event");
}
$statement = "SELECT this_.* " . $this->selectAttributes() . " FROM {$table} this_ ";
$statement .= $this->join();
$i = 0;
$this->searchParams->rewind();
if ($this->searchParams->count() > 0 && !$this->searchParams->offsetExists('true')) {
$statement .= " WHERE ";
}
while ($this->searchParams->valid()) {
if ($this->statements->containsKey($this->searchParams->key())) {
if ($i++ > 0) {
$statement .= " AND ";
}
$clause = $this->statements->get($this->searchParams->key());
$statement .= str_replace(":" . $this->searchParams->key(), "'" . $this->searchParams->current() . "'", $clause['where']);
}
$this->searchParams->next();
}
return $this->getObject($statement . " ORDER BY this_.date DESC, this_.id DESC");
}
示例4: generate
/**
* Generates a request based on the current apache variables.
* @throws Exception
*/
public static function generate()
{
$headers = new Map(apache_request_headers());
$method = $_SERVER['REQUEST_METHOD'];
$path = $_SERVER['REQUEST_URI'];
switch ($headers->get('Content-Type', null)) {
case 'application/json':
$data = file_get_contents('php://input');
$values = json_decode($data, true);
$params = new Map($values);
break;
case 'application/x-www-form-urlencoded':
$params = new Map($_POST);
break;
default:
if ($method === 'GET') {
$params = new Map($_GET);
} else {
if ($method === 'POST' || $method === 'PUT') {
$params = new Map($_POST);
} else {
$params = new Map();
}
}
break;
}
return new Request($path, $method, $headers, $params);
}
示例5: removeAffectsGivenKeyOnly
/** @test */
public function removeAffectsGivenKeyOnly()
{
$map = new Map(array('foo' => 42, 'bar' => 1337));
$map->remove('foo');
$this->assertFalse($map->hasKey('foo'));
$this->assertEquals(1337, $map->get('bar'));
}
示例6: recordAccess
/**
* Moves the element from current position to end of array
*
* @param int|string $key The key
* @return LRUMap
*/
protected function recordAccess($key)
{
foreach (parent::get($key) as $value) {
unset($this->elements[$key]);
$this->elements[$key] = $value;
}
return $this;
}
示例7: isInstantiable
private static function isInstantiable(Clazz $clazz, Map $whitelist)
{
if ($clazz->isPrimitive()) {
return true;
}
$instantiable = $whitelist->get($clazz);
return $instantiable != null && $instantiable;
}
示例8: test_common_and_exotic_keys
/**
* @dataProvider provides_keys
*/
public function test_common_and_exotic_keys($key)
{
$map = new Map();
$map->set($key, 'foo');
$this->assertSame('foo', $map->get($key, 'baz'));
$this->assertCount(1, $map);
$map->all(function ($v, $k) use($key) {
$this->assertSame($key, $k);
});
}
示例9: getAllyRelation
/**
* Checks an relation to the indicated alliance.
*
* @param integer|boolean $aid
*
* @return mixed The relation mode or false
*/
protected function getAllyRelation($aid = false)
{
if (!$aid || !$this->aid) {
return false;
}
$this->loadAllianceRelations();
if ($this->alliances->size() > 0 && $this->alliances->exists($aid)) {
return $this->alliances->get($aid);
}
return false;
}
示例10: getLineWithTitles
public function getLineWithTitles()
{
return new ArrayObject($this->values->get("rowTitles"));
}
示例11:
<?php
// Runs top to bottom (most important should be at the top)
Map::get('/', 'home#index');
示例12:
<?php
//Shop Redirect to merchant
Map::get('/', 'home#index');
Map::get('/about-us' . FORMAT, 'staticpage#about');
Map::get('/contact-us' . FORMAT, 'staticpage#contact');
Map::get('/privacy-policy' . FORMAT, 'staticpage#privacy');
Map::get('/brand-index/(.*)', 'brandIndex#index');
Map::get('/cat-by-brand/(.*)', 'brandIndex#catByBrand');
Map::get('/product-by-cat/(.*)', 'brandIndex#productByCategory');
Map::get('/shop', 'shop#index');
Map::get('/shop/categories/(.*)' . FORMAT, 'categories#categories');
Map::get('/shop/brands/(.*)' . FORMAT, 'categories#brands');
Map::get('/shop/category/(.*)' . FORMAT, 'category#category');
Map::get('/shop/brand/(.*)' . FORMAT, 'category#brand');
Map::get('/shop/(.*)', 'product#index');
Map::get('/blog/page/(.*)', 'blog#index');
Map::get('/blog/category/(.*)', 'blog#category');
Map::get('/blog/(.*)', 'blog#article');
Map::get('/search/(.*)', 'search#index');
Map::get('/goto/(.*)', 'goto#index');
Map::get('/error', 'error#index');
Map::get('/(.*)', 'product#index');
示例13: getFonts
public function getFonts()
{
return $this->map->get($this->id());
}
示例14: filetypeAllowed
private function filetypeAllowed($filetype)
{
return $this->filetypeAllowed->get($filetype);
}
示例15: getMap
/**
* Get the map where the match was played on
* @return Map Returns an invalid map if no map was found
*/
public function getMap()
{
return Map::get($this->map);
}