本文整理汇总了PHP中Store::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::get方法的具体用法?PHP Store::get怎么用?PHP Store::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMerge
/** @dataProvider dataMerge */
public function testMerge($mode, $newBarValue)
{
$store = new Store(':');
$store->set('foo:bar', 'baz');
$mergeData = ['foo' => ['bar' => 'quux', 'fizz' => 'buzz']];
$store->merge($mergeData, $mode);
self::assertEquals($newBarValue, $store->get('foo:bar'));
self::assertEquals('buzz', $store->get('foo:fizz'));
}
示例2: testPushAdvanced
public function testPushAdvanced()
{
$store = new Store();
$pair = new Pair('key', 'value');
$store->push($pair);
$store->push(__DIR__ . '/data/php.ini');
$store->push(__DIR__ . '/data/test.xml');
$this->assertEquals('John', $store->get('firstName'));
$store->push(new Pair('firstName', 'Paul'));
$this->assertEquals('Paul', $store->get('firstName'));
$this->assertEquals('Off', $store->get('asp_tags'));
}
示例3: testAdd
/**
* @covers QueueController::Add
* @todo Implement testAdd().
*/
public function testAdd()
{
$person = Person::factory('adult');
$person->name = 'Poehavshiy';
$person->add();
$store = Store::factory('Grocery');
$store->name = 'Prison';
$store->add();
$product = new Product();
$product->name = 'Sladkiy hleb';
$product->add();
$request = Application::getInstance()->request;
$request->setParams(array('storeId' => $store->id, 'personId' => $person->id, 'product_' . $product->id => 'on'));
$personId = $request->p('personId');
$storeId = $request->p('storeId');
$store = Store::get($storeId);
$person = Person::get($personId);
$store->queue->add($person);
$person->basket->drop();
$name = 'product_' . $product->id;
$value = $product;
if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
$person->basket->add(Product::get($matches[1][0]));
}
}
示例4: load_classes
protected static function load_classes()
{
$store_key = array(__DIR__, '__autoload');
if (Store::has($store_key)) {
$classes = Store::get($store_key);
} else {
$classes = array();
$modules = array();
$dir = path('libs');
$itr = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
$pattern = '/^' . preg_quote($dir, '/') . '\\/(.+?)\\.php$/';
foreach ($itr as $elem) {
if ($elem->isFile() && preg_match($pattern, $elem->getPathname(), $match)) {
$class_name = $elem->getBasename('.php');
if ($class_name == basename($elem->getPath())) {
$modules[$class_name] = str_replace('/', '.', substr($elem->getPath(), strlen($dir) + 1));
} else {
if ($class_name !== __CLASS__) {
$classes[$class_name] = str_replace('/', '.', $match[1]);
}
}
}
}
foreach ($modules as $module_name => $module_path) {
foreach ($classes as $class_name => $class_path) {
if (strpos($class_path, $module_path) === 0) {
unset($classes[$class_name]);
}
}
}
$classes = $modules + $classes;
Store::set($store_key, $classes);
}
self::$classes = $classes;
}
示例5: getFromSession
/**
* Get current flash message from session.
*
* @return void
*/
private function getFromSession()
{
if ($this->exists()) {
$flashes = $this->session->get($this->key);
foreach ($flashes as $flash) {
$this->current->push(new Flash($flash['level'], $flash['message']));
}
}
}
示例6: lookupWordlists
private function lookupWordlists()
{
foreach ($this->bitmasks as $mask) {
$addend = Store::get(Store::WORDLIST, $mask);
if ($addend) {
$this->wordlists = array_merge($this->wordlists, $addend);
}
}
}
示例7: unread_count
public static function unread_count(OpenpearMaintainer $maintainer)
{
$key = array('openpear_message_unread', $maintainer->id());
if (Store::has($key)) {
return Store::get($key);
}
$unread_messages_count = C(__CLASS__)->find_count(Q::eq('maintainer_to_id', $maintainer->id()), Q::eq('unread', true));
Store::set($key, $unread_messages_count);
return $unread_messages_count;
}
示例8: Remove
public function Remove()
{
$this->_response()->asJSON();
try {
$store = Store::get($this->_request()->g('id'));
$store->remove();
return array('success' => 1);
} catch (Exception $e) {
return array('error' => $e->getMessage());
}
}
示例9: save
function save($object = '', $related_field = '')
{
if (!$this->exists()) {
$o = new Store();
$o->select_max('position');
$o->get();
if (count($o->all) != 0) {
$max = $o->position + 1;
$this->position = $max;
} else {
$this->postion = 1;
}
}
return parent::save($object, $related_field);
}
示例10: linktitleHandler
/**
* linktitleHandler
*/
public static function linktitleHandler($url)
{
if (module_const('is_cache', false)) {
$store_key = array('__hatenaformat_linktitlehandler', $url);
if (Store::has($store_key)) {
return Store::get($store_key);
}
}
if (Tag::setof($title, Http::read($url), 'title')) {
$url = $title->value();
if (module_const('is_cache', false)) {
Store::set($store_key, $url, self::CACHE_EXPIRE);
}
}
return $url;
}
示例11: Save
/**
* Сохраняет информацию об ассортименте магазина.
*
* Принимает: storeId, product_id1, product_id2, ...
*
* @return type
*/
public function Save()
{
$this->_response()->asJSON();
try {
$store = Store::get($this->_request()->p('storeId'));
$map = array();
foreach ($_POST as $name => $value) {
if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
$map[$matches[1][0]] = $value;
}
}
$store->assortment->map($map);
return array('success' => true);
} catch (Exception $e) {
return array('error' => $e->getMessage());
}
}
示例12: get_changeset
/**
* チェンジセットを取得する
* @param int $revision
* @param bool $cache
* @return OpenpearChangeset
**/
public static function get_changeset($revision, $cache = true)
{
$cache_key = self::cache_key($revision);
if ($cache) {
if (isset(self::$cached_changesets[$revision])) {
return self::$cached_changesets[$revision];
} else {
if (Store::has($cache_key)) {
$changeset = Store::get($cache_key);
self::$cached_changesets[$revision] = $changeset;
return $changeset;
}
}
}
$changeset = C(__CLASS__)->find_get(Q::eq('revision', $revision));
Store::set($cache_key, $changeset);
return $changeset;
}
示例13: get_maintainer
/**
* メンテナ情報を取得する
* @param int $id
* @param bool $cache
* @return OpenpearMaintainar
**/
public static function get_maintainer($id, $cache = true)
{
$cache_key = self::cache_key($id);
if ($cache) {
Log::debug('cache on');
if (isset(self::$cached_maintainers[$id])) {
return self::$cached_maintainers[$id];
} else {
if (Store::has($cache_key)) {
$maintainer = Store::get($cache_key);
self::$cached_maintainers[$id] = $maintainer;
return $maintainer;
}
}
}
$maintainer = C(__CLASS__)->find_get(Q::eq('id', $id));
Store::set($cache_key, $maintainer, OpenpearConfig::object_cache_timeout(3600));
return $maintainer;
}
示例14: packages
public static function packages(OpenpearMaintainer $maintainer)
{
$store_key = array('charges_maintainer', $maintainer->id());
if (Store::has($store_key, self::CACHE_TIMEOUT)) {
$packages = Store::get($store_key);
} else {
try {
$packages = array();
$charges = C(OpenpearCharge)->find_all(Q::eq('maintainer_id', $maintainer->id()));
foreach ($charges as $charge) {
$packages[] = $charge->package();
}
} catch (Exception $e) {
$packages = array();
}
Store::set($store_key, $packages, self::CACHE_TIMEOUT);
}
return $packages;
}
示例15: getWeeklyChart
public function getWeeklyChart($type = "artist", $from = null, $to = null)
{
$r = Store::get();
if ($from && $to) {
$key = "user:" . $this->name . ":weeklychart:" . $type . ":" . $from . ":" . $to;
$chart = $r->get($key);
if (!$chart) {
$args = array("method" => "user.getweekly" . $type . "chart", "from" => $from, "to" => $to, "user" => $this->name);
$chart = API::request($args);
if ($chart) {
$r->set($key, $chart);
}
}
} else {
$key = "user:" . $this->name . ":weeklychart:" . $type . ":latest";
$chart = $r->get($key);
if (!$chart) {
$args = array("method" => "user.getweekly" . $type . "chart", "user" => $this->name);
$chart = API::request($args);
if ($chart) {
$r->set($key, $chart);
$r->expire($key, $this->expires);
}
}
}
if ($chart) {
$chart = json_decode($chart);
$var = "weekly" . $type . "chart";
return $chart->{$var}->{$type};
} else {
return null;
}
}