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


PHP Store::get方法代码示例

本文整理汇总了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'));
 }
开发者ID:ulrichsg,项目名称:phconf,代码行数:10,代码来源:StoreTest.php

示例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'));
 }
开发者ID:ercling,项目名称:keyvaluestore,代码行数:12,代码来源:StoreTest.php

示例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]));
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:29,代码来源:QueueControllerTest.php

示例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;
 }
开发者ID:riaf,项目名称:rhaco2-repository,代码行数:35,代码来源:AutoLoader.php

示例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']));
         }
     }
 }
开发者ID:lukebro,项目名称:flash,代码行数:14,代码来源:FlashFactory.php

示例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);
         }
     }
 }
开发者ID:Avatarchik,项目名称:web-agarman,代码行数:9,代码来源:LetterSet.php

示例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;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:10,代码来源:OpenpearMessage.php

示例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());
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:11,代码来源:StoreController.php

示例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);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:15,代码来源:store.php

示例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;
 }
开发者ID:riaf,项目名称:rhaco2-repository,代码行数:19,代码来源:HatenaFormat.php

示例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());
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:24,代码来源:AssortmentController.php

示例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;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:24,代码来源:OpenpearChangeset.php

示例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;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:25,代码来源:OpenpearMaintainer.php

示例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;
 }
开发者ID:nequal,项目名称:Openpear,代码行数:19,代码来源:OpenpearCharge.php

示例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;
     }
 }
开发者ID:julians,项目名称:last.miscellaneous,代码行数:33,代码来源:user.class.php


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