Load store.

@return StoreInterface $store Loaded store

@throws StoreNotFoundException Store not found
509583
public function get()
    {
        if ($this->store instanceof StoreInterface) {
            return $this->store;
        }

        $stores = $this
            ->storeRepository
            ->findAll();

        if (empty($stores)) {
            throw new StoreNotFoundException();
        }

        $this->store = reset($stores);

        return $this->store;
    }
998575
def load(self):
        """"""

        with open(self.store_file_path, 'r') as fh:
            self.store = json.loads(fh.read())
1267798
public function load($configuration = false) {
        global $CFG;

        if ($configuration === false) {
            $configuration = $this->include_configuration();
        }

        $this->configstores = array();
        $this->configdefinitions = array();
        $this->configlocks = array();
        $this->configmodemappings = array();
        $this->configdefinitionmappings = array();
        $this->configlockmappings = array();

        $siteidentifier = 'unknown';
        if (array_key_exists('siteidentifier', $configuration)) {
            $siteidentifier = $configuration['siteidentifier'];
        }
        $this->siteidentifier = $siteidentifier;

        // Filter the lock instances.
        $defaultlock = null;
        foreach ($configuration['locks'] as $conf) {
            if (!is_array($conf)) {
                // Something is very wrong here.
                continue;
            }
            if (!array_key_exists('name', $conf)) {
                // Not a valid definition configuration.
                continue;
            }
            $name = $conf['name'];
            if (array_key_exists($name, $this->configlocks)) {
                debugging('Duplicate cache lock detected. This should never happen.', DEBUG_DEVELOPER);
                continue;
            }
            $conf['default'] = (!empty($conf['default']));
            if ($defaultlock === null || $conf['default']) {
                $defaultlock = $name;
            }
            $this->configlocks[$name] = $conf;
        }

        // Filter the stores.
        $availableplugins = cache_helper::early_get_cache_plugins();
        foreach ($configuration['stores'] as $store) {
            if (!is_array($store) || !array_key_exists('name', $store) || !array_key_exists('plugin', $store)) {
                // Not a valid instance configuration.
                debugging('Invalid cache store in config. Missing name or plugin.', DEBUG_DEVELOPER);
                continue;
            }
            $plugin = $store['plugin'];
            $class = 'cachestore_'.$plugin;
            $exists = array_key_exists($plugin, $availableplugins);
            if (!$exists) {
                // Not a valid plugin, or has been uninstalled, just skip it an carry on.
                debugging('Invalid cache store in config. Not an available plugin.', DEBUG_DEVELOPER);
                continue;
            }
            $file = $CFG->dirroot.'/cache/stores/'.$plugin.'/lib.php';
            if (!class_exists($class) && file_exists($file)) {
                require_once($file);
            }
            if (!class_exists($class)) {
                continue;
            }
            if (!array_key_exists('cache_store', class_parents($class))) {
                continue;
            }
            if (!array_key_exists('configuration', $store) || !is_array($store['configuration'])) {
                $store['configuration'] = array();
            }
            $store['class'] = $class;
            $store['default'] = !empty($store['default']);
            if (!array_key_exists('lock', $store) || !array_key_exists($store['lock'], $this->configlocks)) {
                $store['lock'] = $defaultlock;
            }

            $this->configstores[$store['name']] = $store;
        }

        // Filter the definitions.
        foreach ($configuration['definitions'] as $id => $conf) {
            if (!is_array($conf)) {
                // Something is very wrong here.
                continue;
            }
            if (!array_key_exists('mode', $conf) || !array_key_exists('component', $conf) || !array_key_exists('area', $conf)) {
                // Not a valid definition configuration.
                continue;
            }
            if (array_key_exists($id, $this->configdefinitions)) {
                debugging('Duplicate cache definition detected. This should never happen.', DEBUG_DEVELOPER);
                continue;
            }
            $conf['mode'] = (int)$conf['mode'];
            if ($conf['mode'] < cache_store::MODE_APPLICATION || $conf['mode'] > cache_store::MODE_REQUEST) {
                // Invalid cache mode used for the definition.
                continue;
            }
            if ($conf['mode'] === cache_store::MODE_SESSION || $conf['mode'] === cache_store::MODE_REQUEST) {
                // We force this for session and request caches.
                // They are only allowed to use the default as we don't want people changing them.
                $conf['sharingoptions'] = cache_definition::SHARING_DEFAULT;
                $conf['selectedsharingoption'] = cache_definition::SHARING_DEFAULT;
                $conf['userinputsharingkey'] = '';
            } else {
                // Default the sharing option as it was added for 2.5.
                // This can be removed sometime after 2.5 is the minimum version someone can upgrade from.
                if (!isset($conf['sharingoptions'])) {
                    $conf['sharingoptions'] = cache_definition::SHARING_DEFAULTOPTIONS;
                }
                // Default the selected sharing option as it was added for 2.5.
                // This can be removed sometime after 2.5 is the minimum version someone can upgrade from.
                if (!isset($conf['selectedsharingoption'])) {
                    $conf['selectedsharingoption'] = cache_definition::SHARING_DEFAULT;
                }
                // Default the user input sharing key as it was added for 2.5.
                // This can be removed sometime after 2.5 is the minimum version someone can upgrade from.
                if (!isset($conf['userinputsharingkey'])) {
                    $conf['userinputsharingkey'] = '';
                }
            }
            $this->configdefinitions[$id] = $conf;
        }

        // Filter the mode mappings.
        foreach ($configuration['modemappings'] as $mapping) {
            if (!is_array($mapping) || !array_key_exists('mode', $mapping) || !array_key_exists('store', $mapping)) {
                // Not a valid mapping configuration.
                debugging('A cache mode mapping entry is invalid.', DEBUG_DEVELOPER);
                continue;
            }
            if (!array_key_exists($mapping['store'], $this->configstores)) {
                // Mapped array instance doesn't exist.
                debugging('A cache mode mapping exists for a mode or store that does not exist.', DEBUG_DEVELOPER);
                continue;
            }
            $mapping['mode'] = (int)$mapping['mode'];
            if ($mapping['mode'] < 0 || $mapping['mode'] > 4) {
                // Invalid cache type used for the mapping.
                continue;
            }
            if (!array_key_exists('sort', $mapping)) {
                $mapping['sort'] = 0;
            }
            $this->configmodemappings[] = $mapping;
        }

        // Filter the definition mappings.
        foreach ($configuration['definitionmappings'] as $mapping) {
            if (!is_array($mapping) || !array_key_exists('definition', $mapping) || !array_key_exists('store', $mapping)) {
                // Not a valid mapping configuration.
                continue;
            }
            if (!array_key_exists($mapping['store'], $this->configstores)) {
                // Mapped array instance doesn't exist.
                continue;
            }
            if (!array_key_exists($mapping['definition'], $this->configdefinitions)) {
                // Mapped array instance doesn't exist.
                continue;
            }
            if (!array_key_exists('sort', $mapping)) {
                $mapping['sort'] = 0;
            }
            $this->configdefinitionmappings[] = $mapping;
        }

        usort($this->configmodemappings, array($this, 'sort_mappings'));
        usort($this->configdefinitionmappings, array($this, 'sort_mappings'));

        return true;
    }
815495
public function getPrefetchShipping($store = null)
    {
        return $this->getScopeConfig()->isSetFlag(
            self::XML_PATH_PREFETCH_SHIPPING,
            ScopeInterface::SCOPE_STORE,
            $store
        );
    }
444606
public static function set_Hstore( $store )
    {
        if( $store instanceof Hstore ) {
            return $store;
        }
        try {
            $store = new Hstore( $store );
            return $store;
        } catch ( \InvalidArgumentException $e ) {
            return null;
        }
    }
411522
public function load()
    {
        $file = new File($this->filePath);
        $fileExt = $file->getExtension();
        $fileConfClass = $this->getConfigFileClass($fileExt);
        if (class_exists($fileConfClass)) {
            $fileConf = new $fileConfClass($file);

            return $fileConf;
        }

        throw new ConfNotSupportedException($this->filePath);
    }
1038307
private function loadStores()
    {
        $itemIds = array_keys($this->_items);

        if (count($itemIds)) {
            $connection = $this->getConnection();
            $select = $connection->select()
                ->from(['thesaurus_entity_store' => $this->getTable(ThesaurusInterface::STORE_TABLE_NAME)])
                ->where('thesaurus_entity_store.' . ThesaurusInterface::THESAURUS_ID . ' IN (?)', $itemIds);

            $result = $connection->fetchPairs($select);

            if ($result) {
                foreach ($this as $item) {
                    $entityId = $item->getData(ThesaurusInterface::THESAURUS_ID);
                    if (!isset($result[$entityId])) {
                        continue;
                    }
                    $storeId = $result[$item->getData(ThesaurusInterface::THESAURUS_ID)];
                    $storeCode = $this->storeManager->getStore($storeId)->getCode();

                    if ($result[$entityId] == 0) {
                        $stores = $this->storeManager->getStores(false, true);
                        $storeId = current($stores)->getId();
                        $storeCode = key($stores);
                    }

                    $item->setData('_first_store_id', $storeId);
                    $item->setData('store_code', $storeCode);
                    $item->setData('store_id', [$result[$entityId]]);
                }
            }
        }
    }
47655
def load_from_store(self):
        
        if not self._store:
            raise AttributeError('No datastore defined!')
        if self._store.has_blob('all_keys'):
            data = Serializer.deserialize(self._store.get_blob('all_keys'))
            self.load_from_data(data)
            return True
        elif self._store.has_blob('all_keys_with_undefined'):
            blob = self._store.get_blob('all_keys_with_undefined')
            data = Serializer.deserialize(blob)
            self.load_from_data(data, with_undefined=True)
            return True
        else:
            return False
1131692
public function render(Store $store)
    {
        $sViewName = $store->getViewName();
        $sNamespace = $store->getNamespace();
        // In this view renderer, the namespace must always be prepended to the view name.
        if(substr($sViewName, 0, strlen($sNamespace) + 2) != $sNamespace . '::')
        {
            $sViewName = $sNamespace . '::' . $sViewName;
        }
        // Render the template
        return trim(jaxon()->render($sViewName, $store->getViewData()), " \t\n");
    }
1049774
public function build()
    {
        return new StoreMap($this->location, $this->update, $this->context, $this->options);
    }
406093
public function get_stores_for_definition(cache_definition $definition) {
        // Check if MUC has been disabled.
        $factory = cache_factory::instance();
        if ($factory->stores_disabled()) {
            // Yip its been disabled.
            // To facilitate this we are going to always return an empty array of stores to use.
            // This will force all cache instances to use the cachestore_dummy.
            // MUC will still be used essentially so that code using it will still continue to function but because no cache stores
            // are being used interaction with MUC will be purely based around a static var.
            return array();
        }

        $availablestores = $this->get_stores($definition->get_mode(), $definition->get_requirements_bin());
        $stores = array();
        $id = $definition->get_id();

        // Now get any mappings and give them priority.
        foreach ($this->configdefinitionmappings as $mapping) {
            if ($mapping['definition'] !== $id) {
                continue;
            }
            $storename = $mapping['store'];
            if (!array_key_exists($storename, $availablestores)) {
                continue;
            }
            if (array_key_exists($storename, $stores)) {
                $store = $stores[$storename];
                unset($stores[$storename]);
                $stores[$storename] = $store;
            } else {
                $stores[$storename] = $availablestores[$storename];
            }
        }

        if (empty($stores) && !$definition->is_for_mappings_only()) {
            $mode = $definition->get_mode();
            // Load the default stores.
            foreach ($this->configmodemappings as $mapping) {
                if ($mapping['mode'] === $mode && array_key_exists($mapping['store'], $availablestores)) {
                    $store = $availablestores[$mapping['store']];
                    if (empty($store['mappingsonly'])) {
                        $stores[$mapping['store']] = $store;
                    }
                }
            }
        }

        return $stores;
    }
957121
public function repository(Store $store)
    {
        $repository = new KeywordsRepository($store);

        if ($this->app->bound('Illuminate\Contracts\Events\Dispatcher')) {
            $repository->setEventDispatcher(
                $this->app['Illuminate\Contracts\Events\Dispatcher']
            );
        }

        return $repository;
    }
227711
public function load()
    {
        foreach ($this->config['autoload'] as $file) {
            if ( ! locate_template($this->getRelativePath($file), true, true)) {
                throw new FileNotFoundException("Autoloaded file [{$this->getPath($file)}] cannot be found. Please, check your autoloaded entries in `config/app.php` file.");
            }
        }
    }
523192
public static function load() : ScheduledJobStore
    {
        if (is_null(self::$instance)) {
            self::$instance = new ScheduledJobStore(Connection::get());
        }

        return self::$instance;
    }
741001
private function getDefaultStoreId()
    {
        $store = $this->storeManager->getDefaultStoreView();

        if (null === $store) {
            // Occurs when current user does not have access to default website (due to AdminGWS ACLS on Magento EE).
            $store = !empty($this->storeManager->getWebsites()) ? current($this->storeManager->getWebsites())->getDefaultStore() : null;
        }

        return $store ? $store->getId() : 0;
    }
864009
public function useStoreCreditConfig($store = null)
    {
        return $this->getScopeConfig()->isSetFlag(
            self::XML_PATH_STORE_CREDIT,
            ScopeInterface::SCOPE_STORE,
            $store
        );
    }
1069843
public function getDefaultCacheStore(): ?Store
    {
        // We do not know what store is desired. Therefore,
        // the safest bet is to obtain the default
        $manager = Cache::getFacadeRoot();
        if (isset($manager)) {
            /** @var Repository $repository */
            $repository = $manager->store();
            return $repository->getStore();
        }
        return $manager;
    }