src/acdhOeaw/fedora/acl/WebAclRule.php
public function save(string $location = null): FedoraResource {
        if ($this->uri != '') {
            $meta = $this->getMetadata();
            $meta->merge($this->getAclMetadata(), [RC::idProp()]);
            $this->setMetadata($meta);
            $this->updateMetadata();
        } else {
            if ($location === null) {
                throw new InvalidArgumentException('location parameter missing');
            }

            $meta      = $this->getAclMetadata();
            $meta->addResource(RC::idProp(), 'https://id.acdh.oeaw.ac.at/acl/' . microtime(true) . rand(0, 1000));
            $res       = $this->fedora->createResource($meta, '', $location, 'POST');
            $this->uri = $res->getUri();
            $this->fedora->getCache()->delete($res);
            $this->fedora->getCache()->add($this);
        }
        return $this;
    }
public function save(string $location = null): FedoraResource {
        if ($this->uri != '') {
            $meta = $this->getMetadata();
            $meta->merge($this->getAclMetadata(), [RC::idProp()]);
            $this->setMetadata($meta);
            $this->updateMetadata();
        } else {
            if ($location === null) {
                throw new InvalidArgumentException('location parameter missing');
            }

            $meta      = $this->getAclMetadata();
            $meta->addResource(RC::idProp(), 'https://id.acdh.oeaw.ac.at/acl/' . microtime(true) . rand(0, 1000));
            $res       = $this->fedora->createResource($meta, '', $location, 'POST');
            $this->uri = $res->getUri();
            $this->fedora->getCache()->delete($res);
            $this->fedora->getCache()->add($this);
        }
        return $this;
    }
public function save ( string $ location = null ) : FedoraResource { if ( $ this -> uri != '' ) { $ meta = $ this -> getMetadata ( ) ; $ meta -> merge ( $ this -> getAclMetadata ( ) , [ RC :: idProp ( ) ] ) ; $ this -> setMetadata ( $ meta ) ; $ this -> updateMetadata ( ) ; } else { if ( $ location === null ) { throw new InvalidArgumentException ( 'location parameter missing' ) ; } $ meta = $ this -> getAclMetadata ( ) ; $ meta -> addResource ( RC :: idProp ( ) , 'https://id.acdh.oeaw.ac.at/acl/' . microtime ( true ) . rand ( 0 , 1000 ) ) ; $ res = $ this -> fedora -> createResource ( $ meta , '' , $ location , 'POST' ) ; $ this -> uri = $ res -> getUri ( ) ; $ this -> fedora -> getCache ( ) -> delete ( $ res ) ; $ this -> fedora -> getCache ( ) -> add ( $ this ) ; } return $ this ; }
Saves the ACL rule.

If there is no corresponging Fedora resource, it is created as a Fedora
child of a resource denpted by the `$location` parameter.
@param string $location URI of the parent resource (typically an ACL
collection)
@return FedoraResource
Saves the ACL rule .