Exemplo n.º 1
0
 /**
  * Instantiate and return an object
  *
  * @param string $url Object URL (relative or absolute including the apparat base URL)
  * @param int $visibility Object visibility
  * @return ObjectInterface Object
  */
 public static function load($url, $visibility = ObjectTypes::VISIBILITY_ALL)
 {
     // Instantiate the object URL
     /** @var ObjectUrl $objectUrl */
     $objectUrl = Kernel::create(ObjectUrl::class, [$url, true]);
     // Instantiate the local object repository, load and return the object
     return Repository::instance($objectUrl->getRepositoryUrl())->loadObject($objectUrl, $visibility);
 }
Exemplo n.º 2
0
 /**
  * Auto-connect a repository with URL default settings
  *
  * @param string $url Repository URL
  * @return boolean Success
  */
 public function connect($url)
 {
     // If it's an absolute URL
     /** @var Url $url */
     $url = Kernel::create(Url::class, [$url]);
     $config = $url->isAbsolute() ? $this->getAbsoluteUrlConfig() : $this->getRelativeUrlConfig($url);
     // If a repository configuration has been created
     if ($config !== null) {
         $repository = Repository::register(strval($url), $config);
         return $repository instanceof DomainRepository;
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * Create a repository
  *
  * @param string $url Repository URL (relative or absolute including the apparat base URL)
  * @param array $config Repository configuration
  * @return RepositoryFacade Repository facade
  * @api
  */
 public static function create($url, array $config)
 {
     return new static(Repository::create($url, $config));
 }