Jackalope\Transport\Jackrabbit\Client::lockNode PHP Method

lockNode() public method

{@inheritDoc}
public lockNode ( $absPath, $isDeep, $isSessionScoped, $timeoutHint = PHP_INT_MAX, $ownerInfo = null )
    public function lockNode($absPath, $isDeep, $isSessionScoped, $timeoutHint = PHP_INT_MAX, $ownerInfo = null)
    {
        $timeout = $timeoutHint === PHP_INT_MAX ? 'infinite' : $timeoutHint;
        $ownerInfo = null === $ownerInfo ? $this->credentials->getUserID() : (string) $ownerInfo;
        $depth = $isDeep ? Request::INFINITY : 0;
        $lockScope = $isSessionScoped ? '<dcr:exclusive-session-scoped xmlns:dcr="http://www.day.com/jcr/webdav/1.0"/>' : '<D:exclusive/>';
        $request = $this->getRequest(Request::LOCK, $absPath);
        $request->addHeader('Timeout: Second-' . $timeout);
        $request->setDepth($depth);
        $request->setBody('<?xml version="1.0" encoding="utf-8"?>' . '<D:lockinfo xmlns:D="' . self::NS_DAV . '">' . '  <D:lockscope>' . $lockScope . '</D:lockscope>' . '  <D:locktype><D:write/></D:locktype>' . '  <D:owner>' . $ownerInfo . '</D:owner>' . '</D:lockinfo>');
        $dom = $request->executeDom();
        return $this->generateLockFromDavResponse($dom, true, $absPath);
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function lockNode($absPath, $isDeep, $isSessionScoped, $timeoutHint = PHP_INT_MAX, $ownerInfo = null)
 {
     return $this->transport->lockNode($absPath, $isDeep, $isSessionScoped, $timeoutHint, $ownerInfo);
 }