original_string: protected function copyViaClient(
          ObjectIdInterface $targetFolderId = null,
          array $properties = [],
          VersioningState $versioningState = null,
          array $policies = [],
          array $addAces = [],
          array $removeAces = []
      ) {
          $newProperties = [];
  
          $allPropertiesContext = $this->getSession()->createOperationContext();
          $allPropertiesContext->setFilterString('*');
          $allPropertiesContext->setIncludeAcls(false);
          $allPropertiesContext->setIncludeAllowableActions(false);
          $allPropertiesContext->setIncludePathSegments(false);
          $allPropertiesContext->setIncludePolicies(false);
          $allPropertiesContext->setIncludeRelationships(IncludeRelationships::cast(IncludeRelationships::NONE));
          $allPropertiesContext->setRenditionFilterString(Constants::RENDITION_NONE);
  
          $allPropertiesDocument = $this->getSession()->getObject($this, $allPropertiesContext);
          if (! $allPropertiesDocument instanceof DocumentInterface) {
              throw new CmisRuntimeException('Returned object is not of expected type DocumentInterface');
          }
  
          foreach ($allPropertiesDocument->getProperties() as $property) {
              if (Updatability::cast(Updatability::READWRITE)->equals($property->getDefinition()->getUpdatability())
                  || Updatability::cast(Updatability::ONCREATE)->equals($property->getDefinition()->getUpdatability())
              ) {
                  $newProperties[$property->getId()] = $property->isMultiValued() ? $property->getValues(
                  ) : $property->getFirstValue();
              }
          }
  
          $newProperties = array_merge($newProperties, $properties);
          $contentStream = $allPropertiesDocument->getContentStream();
  
          return $this->getSession()->createDocument(
              $newProperties,
              $targetFolderId,
              $contentStream,
              $versioningState,
              $policies,
              $addAces,
              $removeAces
          );
      }
code: protected function copyViaClient(
          ObjectIdInterface $targetFolderId = null,
          array $properties = [],
          VersioningState $versioningState = null,
          array $policies = [],
          array $addAces = [],
          array $removeAces = []
      ) {
          $newProperties = [];
  
          $allPropertiesContext = $this->getSession()->createOperationContext();
          $allPropertiesContext->setFilterString('*');
          $allPropertiesContext->setIncludeAcls(false);
          $allPropertiesContext->setIncludeAllowableActions(false);
          $allPropertiesContext->setIncludePathSegments(false);
          $allPropertiesContext->setIncludePolicies(false);
          $allPropertiesContext->setIncludeRelationships(IncludeRelationships::cast(IncludeRelationships::NONE));
          $allPropertiesContext->setRenditionFilterString(Constants::RENDITION_NONE);
  
          $allPropertiesDocument = $this->getSession()->getObject($this, $allPropertiesContext);
          if (! $allPropertiesDocument instanceof DocumentInterface) {
              throw new CmisRuntimeException('Returned object is not of expected type DocumentInterface');
          }
  
          foreach ($allPropertiesDocument->getProperties() as $property) {
              if (Updatability::cast(Updatability::READWRITE)->equals($property->getDefinition()->getUpdatability())
                  || Updatability::cast(Updatability::ONCREATE)->equals($property->getDefinition()->getUpdatability())
              ) {
                  $newProperties[$property->getId()] = $property->isMultiValued() ? $property->getValues(
                  ) : $property->getFirstValue();
              }
          }
  
          $newProperties = array_merge($newProperties, $properties);
          $contentStream = $allPropertiesDocument->getContentStream();
  
          return $this->getSession()->createDocument(
              $newProperties,
              $targetFolderId,
              $contentStream,
              $versioningState,
              $policies,
              $addAces,
              $removeAces
          );
      }
code_tokens: protected function copyViaClient ( ObjectIdInterface $ targetFolderId = null , array $ properties = [ ] , VersioningState $ versioningState = null , array $ policies = [ ] , array $ addAces = [ ] , array $ removeAces = [ ] ) { $ newProperties = [ ] ; $ allPropertiesContext = $ this -> getSession ( ) -> createOperationContext ( ) ; $ allPropertiesContext -> setFilterString ( '*' ) ; $ allPropertiesContext -> setIncludeAcls ( false ) ; $ allPropertiesContext -> setIncludeAllowableActions ( false ) ; $ allPropertiesContext -> setIncludePathSegments ( false ) ; $ allPropertiesContext -> setIncludePolicies ( false ) ; $ allPropertiesContext -> setIncludeRelationships ( IncludeRelationships :: cast ( IncludeRelationships :: NONE ) ) ; $ allPropertiesContext -> setRenditionFilterString ( Constants :: RENDITION_NONE ) ; $ allPropertiesDocument = $ this -> getSession ( ) -> getObject ( $ this , $ allPropertiesContext ) ; if ( ! $ allPropertiesDocument instanceof DocumentInterface ) { throw new CmisRuntimeException ( 'Returned object is not of expected type DocumentInterface' ) ; } foreach ( $ allPropertiesDocument -> getProperties ( ) as $ property ) { if ( Updatability :: cast ( Updatability :: READWRITE ) -> equals ( $ property -> getDefinition ( ) -> getUpdatability ( ) ) || Updatability :: cast ( Updatability :: ONCREATE ) -> equals ( $ property -> getDefinition ( ) -> getUpdatability ( ) ) ) { $ newProperties [ $ property -> getId ( ) ] = $ property -> isMultiValued ( ) ? $ property -> getValues ( ) : $ property -> getFirstValue ( ) ; } } $ newProperties = array_merge ( $ newProperties , $ properties ) ; $ contentStream = $ allPropertiesDocument -> getContentStream ( ) ; return $ this -> getSession ( ) -> createDocument ( $ newProperties , $ targetFolderId , $ contentStream , $ versioningState , $ policies , $ addAces , $ removeAces ) ; }
docstring: Copies the document manually. The content is streamed from the repository and back.
  
  @param ObjectIdInterface|null $targetFolderId the ID of the target folder, <code>null</code> to create an unfiled
  document
  @param array $properties The property values that MUST be applied to the object. This list of properties SHOULD
  only contain properties whose values differ from the source document. The array key is the property name
  the value is the property value.
  @param VersioningState|null $versioningState An enumeration specifying what the versioning state of the
  newly-created object MUST be. Valid values are:
  <code>none</code>
  (default, if the object-type is not versionable) The document MUST be created as a non-versionable
  document.
  <code>checkedout</code>
  The document MUST be created in the checked-out state. The checked-out document MAY be
  visible to other users.
  <code>major</code>
  (default, if the object-type is versionable) The document MUST be created as a major version.
  <code>minor</code>
  The document MUST be created as a minor version.
  @param PolicyInterface[] $policies A list of policy ids that MUST be applied to the newly-created document
  object.
  @param AceInterface[] $addAces A list of ACEs that MUST be added to the newly-created document object, either
  using the ACL from folderId if specified, or being applied if no folderId is specified.
  @param AceInterface[] $removeAces A list of ACEs that MUST be removed from the newly-created document object,
  either using the ACL from folderId if specified, or being ignored if no folderId is specified.
  @return ObjectIdInterface The id of the newly-created document.
  @throws CmisRuntimeException
docstring_tokens: Copies the document manually . The content is streamed from the repository and back .