示例#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);
 }
示例#2
0
 /**
  * Set the object hidden state
  *
  * @param boolean $hidden Object hidden state
  * @return LocatorInterface|Locator New object locator
  */
 public function setHidden($hidden)
 {
     $this->locator = $this->locator->setHidden($hidden);
     return $this;
 }