Neos\ContentRepository\Domain\Model\Workspace::getNodeCount PHP Method

getNodeCount() public method

If $includeBaseWorkspaces is enabled, also nodes of base workspaces are taken into account. If it is disabled (default) then the number of nodes is the actual number (+1) of changes related to its base workspaces. A node count of 1 means that no changes are pending in this workspace because a workspace always contains at least its Root Node.
public getNodeCount ( ) : integer
return integer
    public function getNodeCount()
    {
        return $this->nodeDataRepository->countByWorkspace($this);
    }

Usage Example

 /**
  * Returns the number of unpublished nodes contained in the given workspace
  *
  * @param Workspace $workspace
  * @return integer
  * @api
  */
 public function getUnpublishedNodesCount(Workspace $workspace)
 {
     return $workspace->getNodeCount() - 1;
 }