Collect values, caches
@param bool $force
@return mixed
@throws \common_Exception
@throws \oat\oatbox\service\exception\InvalidServiceManagerException
327486
public function collect($force = false)
    {
        $active = $this->getPersistence()->get(self::class);
        if (!$active || $force) {
            $action = new GetActiveDeliveryExecution();
            $this->propagate($action);
            $active = $action->getNumberOfActiveActions();
            $this->getPersistence()->set(self::class, $active, $this->getOption(self::OPTION_TTL));
        }
        return $active;


    }
409764
public function getActiveServices($force = false)
    {
        if ($this->nb_messaging_service_list === null) {
            $this->nb_messaging_service_list = new CNabuMessagingServiceList();
        }

        if ($this->nb_messaging_service_list->isEmpty() || $force) {
            $this->nb_messaging_service_list->clear();
            $this->nb_messaging_service_list->merge(CNabuMessagingService::getActiveMessagingServices($this));
            $this->nb_messaging_service_list->iterate(function($key, CNabuMessagingService $nb_service) {
                $nb_service->setMessaging($this);
                return true;
            });
        }

        return $this->nb_messaging_service_list;
    }
179625
public function loadRatioList($force = false)
    {
        if (($force === false) && (count($this->ratioList) > 0)) {
            return $this->ratioList;
        }

        $repository = $this->objectManager->getRepository('Tbbc\MoneyBundle\Entity\DoctrineStorageRatio');
        $doctrineStorageRatios = $repository->findAll();

        // FIXME
        // if filename doesn't exist, init with only reference currency code
        if (0 === count($doctrineStorageRatios)) {
            $this->ratioList = array($this->referenceCurrencyCode => 1.0);
            $this->saveRatioList($this->ratioList);

            return $this->ratioList;
        }

        $this->ratioList = array();

        foreach ($doctrineStorageRatios as $doctrineStorageRatio) {
            $this->ratioList[$doctrineStorageRatio->getCurrencyCode()] = $doctrineStorageRatio->getRatio();
        }

        return $this->ratioList;
    }
1115160
public function hasTranslations(bool $force = false)
    {
        $this->getTranslations($force);

        return $this->translations_list->isFilled();

    }
602599
protected function touch($force = false)
    {
        if (true === $this->getState()->is('deleted')) {
            return $this;
        }
        if (true === $this->getState()->is('empty') || true === $force) {
            $record = $this->store->retrieveRecord($this->getType(), $this->getId());
            $this->initialize($record['properties']);
            $this->getState()->setLoaded();
        }
        return $this;
    }
1257913
public function restore($force = true)
    {
        $ok = $this->handler->restore();

        if (!$ok && $force) {
            throw new Exception("Could not restore settings: No restore point available");
        }

        return $this;
    }
1179960
public function info(int $count = 1, bool $force = false) : object
    {
        if ($this->messageThread === null || $force) {
            $this->messageThread = $this->get(sprintf(self::MESSAGE_THREAD_ENDPOINT . 'threads/%s', $this->messageThreadId), [
                'fields' => 'threadMembers,threadNameDetail,threadThumbnailDetail,threadProperty,latestTakedownEventDetail,newArrivalEventDetail,threadEvents',
                'count' => $count,
            ]);
        }

        return $this->messageThread;
    }
689553
public function getActiveServices(bool $force = false) : CNabuMessagingServiceList
    {
        if ($this->nb_messaging_service_list->isEmpty() || $force) {
            $this->nb_messaging_service_list->clear();
            if (($nb_messaging = $this->getMessaging()) instanceof CNabuMessaging &&
                !($nb_services_list = $nb_messaging->getActiveServices())->isEmpty()
            ) {
                $nb_services_list->iterate(function($key, CNabuMessagingService $nb_service) {
                    if ($nb_service->isTemplateConnected($this->getId())) {
                        $this->nb_messaging_service_list->addItem($nb_service);
                    }
                    return true;
                });
            }
        }

        return $this->nb_messaging_service_list;
    }
251273
public function cacheConfig($force = false)
    {
        if ($this->cacheFile->exists() && $force === false) {
            return;
        }
        $this->cacheFile->dump($this->data);
    }
1363447
public function getRelativePath($force = FALSE) {

		if(!is_null($this->folder->getRelativePath())) {
			return $this->folder->getRelativePath() . $this->filename;
		}

	}
1172733
public function getAPILanguages(bool $force = false) : CNabuLanguageList
    {
        $nb_api = new CNabuLanguageList();
        $this->getLanguages($force)->iterate(function ($key, CNabuLanguage $nb_language) use ($nb_api) {
            if ($nb_language->isAPILanguage()) {
                $nb_api->addItem($nb_language);
            }
            return true;
        });

        return $nb_api;
    }
475889
protected function getHttpClient(bool $force = false): HttpClient
    {
        if ($this->_httpClient === null || $force) {
            $config = ArrayHelper::merge(['class' => HttpClient::class], $this->httpClientConfig);
            $config['baseUrl'] = $this->getBaseUrl();

            return $this->_httpClient = Yii::createObject($config);
        } else {
            return $this->_httpClient;
        }
    }
936120
public function provideFlatten($force = TRUE) {

     if ($this->isEmpty()) {
       $this->flattenjson = [];
     }
     else {
       if ($this->flattenjson == NULL || $force) {
         $mainproperty = $this->mainPropertyName();
         $jsonArray = json_decode($this->{$mainproperty}, TRUE, 10);
         $flattened = [];
         StrawberryfieldJsonHelper::arrayToFlatCommonkeys(
           $jsonArray,
           $flattened,
           TRUE
         );
         $this->flattenjson = $flattened;
       }
     }
     return $this->flattenjson;
   }
1079705
public function getCatalogs($force = false)
    {
        if ($this->nb_catalog_list->isEmpty() || $force) {
            $this->nb_catalog_list->clear();
            $this->nb_catalog_list->merge(CNabuCatalog::getAllCatalogs($this));
        }

        return $this->nb_catalog_list->getItems();
    }
225960
public static function load($force = false) 
    {
        // already loaded
        if (!$force && self::$_loaded) {
            return false;
        }
        self::_resolveDefaultPath();

        $files = glob(realpath(self::$_path)."/*.php");
        foreach ($files as $file) {
            Log::log("loading factory from $file ...");
            include_once $file;
        }
        self::$_loaded = true;
        return self::$_loaded;
    }
666360
public function getCommerces($force = false)
    {
        if ($this->nb_commerce_list->isEmpty() || $force) {
            $this->nb_commerce_list->clear();
            $this->nb_commerce_list->merge(CNabuCommerce::getAllCommerces($this));
        }

        return $this->nb_commerce_list->getItems();
    }
552344
public function getAdminUser($force = false) {

        if ($this->nb_admin_user === null || $force) {
            $this->nb_admin_user = null;
            if ($this->isValueNumeric('nb_server_admin_user_id')) {
                $nb_user = new CNabuUser($this->getAdminUserId());
                if ($nb_user->isFetched()) {
                    $this->nb_admin_user = $nb_user;
                }
            }
        }

        return $this->nb_admin_user;
    }