Neos.ContentRepository/Classes/Domain/Service/PublishingService.php
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null)
    {
        if ($targetWorkspace === null) {
            $targetWorkspace = $node->getWorkspace()->getBaseWorkspace();
        }
        if ($targetWorkspace instanceof Workspace) {
            $node->getWorkspace()->publishNode($node, $targetWorkspace);
            $this->emitNodePublished($node, $targetWorkspace);
        }
    }
public function publishNode(NodeInterface $node, Workspace $targetWorkspace = null)
    {
        if ($targetWorkspace === null) {
            $targetWorkspace = $node->getWorkspace()->getBaseWorkspace();
        }
        if ($targetWorkspace instanceof Workspace) {
            $node->getWorkspace()->publishNode($node, $targetWorkspace);
            $this->emitNodePublished($node, $targetWorkspace);
        }
    }
public function publishNode ( NodeInterface $ node , Workspace $ targetWorkspace = null ) { if ( $ targetWorkspace === null ) { $ targetWorkspace = $ node -> getWorkspace ( ) -> getBaseWorkspace ( ) ; } if ( $ targetWorkspace instanceof Workspace ) { $ node -> getWorkspace ( ) -> publishNode ( $ node , $ targetWorkspace ) ; $ this -> emitNodePublished ( $ node , $ targetWorkspace ) ; } }
Publishes the given node to the specified target workspace. If no workspace is specified, the source workspace's
base workspace is assumed.

@param NodeInterface $node
@param Workspace $targetWorkspace If not set the base workspace is assumed to be the publishing target
@return void
@api
Publishes the given node to the specified target workspace . If no workspace is specified the source workspace s base workspace is assumed .