示例#1
0
 /**
  * Repository locator constructor
  *
  * @param RepositoryInterface $repository Object repository this locator applies to
  * @param null|string|LocatorInterface $locator Object locator
  */
 public function __construct(RepositoryInterface $repository, $locator = null)
 {
     $this->repository = $repository;
     // If an instantiated locator (local locator, repository locator, object URL) is given
     if ($locator instanceof LocatorInterface) {
         $this->creationDate = $locator->getCreationDate();
         $this->uid = $locator->getId();
         $this->type = $locator->getObjectType();
         $this->revision = $locator->getRevision();
         return;
     }
     // Else: Parse as string
     parent::__construct($locator);
 }