registerPaths

@param bool $refresh

@return static
@throws \ReflectionException
769744
public function registerPaths($refresh = false)
    {
        if (!$this->pathRegistered || $refresh) {
            // Set package path
            $package = $this->getPackage();

            if (!$package instanceof NullPackage) {
                $locale  = $package->app->get('language.locale', 'en-GB');
                $default = $package->app->get('language.default', 'en-GB');

                $prefix = $this->pathPrefix ? '/' . $this->pathPrefix : null;

                $this->renderer->addPath(
                    $package->getDir() . '/Templates' . $prefix . '/' . $locale,
                    PriorityQueue::BELOW_NORMAL
                );

                if ($locale !== $default) {
                    $this->renderer->addPath(
                        $package->getDir() . '/Templates' . $prefix . '/' . $default,
                        PriorityQueue::BELOW_NORMAL
                    );
                }

                $this->renderer->addPath($package->getDir() . '/Templates' . $prefix, PriorityQueue::BELOW_NORMAL);

                if ($this->pathPrefix) {
                    $this->renderer->addPath(
                        $package->app->get('path.templates') . '/' . $this->pathPrefix,
                        PriorityQueue::LOW
                    );
                }
            }

            $this->pathRegistered = true;
        }

        return $this;
    }
355271
public function getAclUrl(bool $refresh = false): string {
        if ($refresh || $this->aclUrl === null) {
            $request  = new Request('HEAD', $this->fedora->sanitizeUri($this->uri));
            $response = $this->fedora->sendRequest($request);
            $this->extractAcl($response);

            // Fedora 4.7.5 doesn't provide ACL link header for binary resources
            // if the ACL id directly attached to the resource (sic!).
            // As a fallback we can try to extract it from the metadata (which
            // is done automatically in the setMetadata() method being called
            // by the getMetadata(true) method).
            if ($this->aclUrl == '') {
                $this->getMetadata(true);
            }
        }
        return $this->aclUrl;
    }
864523
public function registerAspect(Aspect $aspect): void
    {
        $refAspect = new ReflectionClass($aspect);
        $this->set("aspect.{$refAspect->name}", $aspect, ['aspect']);
        $this->addResource($refAspect->getFileName());
    }
739525
public function load($refresh = false)
    {
        $results = $this->repository->read();

        /* @var $config \Core\Config\ConfigObject */
        foreach ($results as $config) {
            $storage = $this->createStorage($config->getStorage());
            $storage->set($config->getId(), $config->getValue());
        }
    }
1175519
public function registerAll()
    {
        /** @var LanguageService $service */
        $service   = resolve(LanguageService::class);
        $languages = $service->getAllEnabled();
        foreach ($this->routes['ml'] as $value) {
            foreach ($languages as $language) {
                $prefix = null;
                if (!$language->is_default) {
                    $prefix = $language->code;
                }
                Route::group(
                    array_merge(['prefix' => $prefix], $value['groupArgs']),
                    function ($router) use ($value, $language) {
                        $value['closure']($router, $language->code);
                    }
                );
            }
        }
        foreach ($this->routes['regular'] as $value) {
            Route::group(
                $value['groupArgs'],
                function ($router) use ($value) {
                    $value['closure']($router);
                }
            );
        }
        if (!empty($this->routes['catchAll'])) {
            Route::group(
                $this->routes['catchAll']['groupArgs'],
                function ($router) {
                    $this->routes['catchAll']['closure']($router);
                }
            );
        }

        $router = resolve('router');
        $router->getRoutes()->refreshActionLookups();
        $router->getRoutes()->refreshNameLookups();
    }
799972
public function registerClasses($classes, $merge = true)
    {
        if (DIRECTORY_SEPARATOR === '\\') {
            foreach ($classes as $key => $path) {
                $classes[$key] = strtr($path, '\\', '/');
            }
        }

        $this->_classes = $merge ? array_merge($this->_classes, $classes) : $classes;

        return $this;
    }
356959
public static function register($path)
	{
		self::$_path = $path;
		self::addPath($path);

		if ($loaders = spl_autoload_functions())
			array_map('spl_autoload_unregister', $loaders);
		else
			$loaders = function_exists('__autoload') ? array('__autoload') : array();

		array_unshift($loaders, array(__CLASS__, 'load'));
		array_map('spl_autoload_register', $loaders);
	}
105834
public function registerMultilingualPaths($refresh = false)
    {
        if ($this->config['path.multilingual_registered'] && !$refresh) {
            return $this;
        }

        $this->registerPaths();

        $locale  = $this->getPackage()->app->get('language.locale');
        $default = $this->getPackage()->app->get('language.default');

        $this->addPath(
            $this->config['tmpl_path.view'] . '/' . $this->getPackage()->app->get('language.locale'),
            PriorityQueue::BELOW_NORMAL
        );

        if ($locale != $default) {
            $this->addPath(
                $this->config['tmpl_path.view'] . '/' . $this->getPackage()->app->get('language.default'),
                PriorityQueue::BELOW_NORMAL
            );
        }

        $this->config['path.multilingual_registered'] = true;

        return $this;
    }
1301161
public function setPaths() : ApplicationInterface
    {
        $this->container->set('app', $this);
        $paths = $this->bootstrappers->getBootstrapper()->getPaths();

        foreach ($paths->all() as $key => $path) {
            $this->container->set($key, $path);
        }

        return $this;
    }
1226618
public function hasRequiredSettings(bool $refresh = false): bool
    {
        $required = $this->getParsedRequiredProperties($refresh);

        if (!$this->allRequired && (empty($required) || $required === null)) {
            return true;
        }

        return $this->validateProperties($required);
    }
76857
protected function buildRouteMaps($refresh = false)
    {
        if ($this->routeMaps && !$this->debug && !$refresh) {
            return $this;
        }

        foreach ($this->routes as $key => $routeItem) {
            $this->routeMaps[$routeItem->getName()] = $key;
        }

        return $this;
    }
507383
public function setRefreshToken($refreshToken = null)
    {
        $this->refreshToken = null === $refreshToken
            ? bin2hex(openssl_random_pseudo_bytes(64))
            : $refreshToken;

        return $this;
    }
1266084
public function register($class, $transforms)
    {
        if (!is_array($transforms)) {
            $transforms = array($transforms);
        }
        foreach ($transforms as $t) {
            if (!($t instanceof TransformationInterface)) {
                throw new \InvalidArgumentException("Only instances of TransformationInterface can be registered");
            }
        }

        if (!isset($this->transforms[$class])) {
            $this->classes[] = $class;
            $this->transforms[$class] = array();
        }

        foreach ($transforms as $t) {
            $this->transforms[$class][] = $t;
        }
    }
1335767
protected function deltaCheck($refresh = true) {
		$chk = false;
		if (! $refresh && $chk = $this->query('select dat from '.$this->DB_TableName.' where path=\'\' and fname=\'\' limit 1')) {
			$chk = unserialize($chk[0]);
		}
		if ($chk && ($chk['mtime'] + $this->options['metaCacheTime']) > $_SERVER['REQUEST_TIME']) {
			return true;
		}
		
		try {
			$more = true;
			$this->DB->beginTransaction();
			
			if ($res = $this->query('select dat from '.$this->DB_TableName.' where path=\'\' and fname=\'\' limit 1')) {
				$res = unserialize($res[0]);
				$cursor = $res['cursor'];
			} else {
				$cursor = '';
			}
			$delete = false;
			$reset = false;
			do {
				@ ini_set('max_execution_time', 120);
				$_info = $this->dropbox->delta($cursor);
				if (! empty($_info['reset'])) {
					$this->DB->exec('TRUNCATE table '.$this->DB_TableName);
					$this->DB->exec('insert into '.$this->DB_TableName.' values(\'\', \'\', \''.serialize(array('cursor' => '', 'mtime' => 0)).'\', 0);');
					$this->DB->exec('insert into '.$this->DB_TableName.' values(\'/\', \'\', \''.serialize(array(
						'path'      => '/',
						'is_dir'    => 1,
						'mime_type' => '',
						'bytes'     => 0
					)).'\', 0);');
					$reset = true;
				}
				$cursor = $_info['cursor'];
				
				foreach($_info['entries'] as $entry) {
					$key = strtolower($entry[0]);
					$pkey = strtolower(dirname($key));
					
					$path = $this->DB->quote($pkey);
					$fname = $this->DB->quote(strtolower(basename($key)));
					$where = 'where path='.$path.' and fname='.$fname;
					
					if (empty($entry[1])) {
						$this->DB->exec('delete from '.$this->DB_TableName.' '.$where);
						! $delete && $delete = true;
						continue;
					}

					$sql = 'select path from '.$this->DB_TableName.' '.$where.' limit 1';
					if (! $reset && $this->query($sql)) {
						$this->DB->exec('update '.$this->DB_TableName.' set dat='.$this->DB->quote(serialize($entry[1])).', isdir='.($entry[1]['is_dir']? 1 : 0).' ' .$where);
					} else {
						$this->DB->exec('insert into '.$this->DB_TableName.' values ('.$path.', '.$fname.', '.$this->DB->quote(serialize($entry[1])).', '.(int)$entry[1]['is_dir'].')');
					}
				}
			} while (! empty($_info['has_more']));
			$this->DB->exec('update '.$this->DB_TableName.' set dat='.$this->DB->quote(serialize(array('cursor'=>$cursor, 'mtime'=>$_SERVER['REQUEST_TIME']))).' where path=\'\' and fname=\'\'');
			if (! $this->DB->commit()) {
				$e = $this->DB->errorInfo();
				return $e[2];
			}
			if ($delete) {
				$this->DB->exec('vacuum');
			}
		} catch(Dropbox_Exception $e) {
			return $e->getMessage();
		}
		return true;
	}
871548
public static function initServices($refresh = false)
    {
        // Define full definition file path
        $path = sprintf('%s%sxac-services-v%d.conf'
            , ! empty(self::$logPath) ? self::$logPath : sys_get_temp_dir()
            , DIRECTORY_SEPARATOR
            , self::$apiVersion
            );
        
        if ($refresh === true || ! file_exists($path)) {
            self::log(sprintf("Refresh services definition on-demand for v%d API", self::$apiVersion));
            $res = self::getInstance()->call('endpoints');
            $res['_timestamp'] = time();
            file_put_contents($path, serialize($res));
            chmod($path, 0777);
            self::$services = $res;
        } else {
            self::$services = unserialize(file_get_contents($path));
            // Check that content is not expired
            if (time() - self::$services['_timestamp'] > self::$ttl) {
                self::log(sprintf("Refresh outdated services definition for v%d API", self::$apiVersion));
                self::initServices(true);
            }
        }
    }
1270979
static public function registerDefaults() {
		if (self::$registeredStatic) {
			require_once __DIR__ . '/Exceptions/RegisterationFailed.php';
			throw new RegistrationFailed('Is already registered');
		}
		
		$loader = new static();
		$loader->registerNamespace('ZExt', __DIR__ . '/..');
		$loader->register();
		
		self::$registeredStatic = true;
		
		return $loader;
	}
276116
public function registerAnnotationsPathWithRegistry($path)
    {
        foreach (Finder::create()->files()->in($path) as $file) {
            AnnotationRegistry::registerFile($file->getRealPath());
        }

        return $this;
    }