Skip to content

Commit

Permalink
Replace code using Value Objects
Browse files Browse the repository at this point in the history
This changeset was created with a new rector ruleset (see neos/rector#11)
  • Loading branch information
bwaidelich committed Apr 1, 2023
1 parent a0b79fe commit 6a21d6d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Classes/Authorization/Privilege/Node/NodePrivilegeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function isAncestorNodeOf(string $nodePathOrIdentifier): bool
return $nodePathOrResult;
}

return str_starts_with($nodePathOrResult, (string)$this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId));
return str_starts_with($nodePathOrResult, $this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId)->value);
}

/**
Expand All @@ -80,7 +80,7 @@ public function isDescendantNodeOf(string $nodePathOrIdentifier): bool
return $nodePathOrResult;
}

return str_starts_with((string)$this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId), $nodePathOrResult);
return str_starts_with($this->getSubgraph()->retrieveNodePath($this->node->nodeAggregateId)->value, $nodePathOrResult);
}

/**
Expand Down Expand Up @@ -138,7 +138,7 @@ public function isInWorkspace(array $workspaceNames): bool
$workspace = $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId(
$this->node->subgraphIdentity->contentStreamId
);
return !is_null($workspace) && in_array((string)$workspace->workspaceName, $workspaceNames);
return !is_null($workspace) && in_array($workspace->workspaceName->value, $workspaceNames);
}

/**
Expand Down Expand Up @@ -186,7 +186,7 @@ protected function resolveNodePathOrResult(string $nodePathOrIdentifier): bool|s
if (is_null($otherNode)) {
return false;
}
return $this->getSubgraph()->retrieveNodePath($otherNode->nodeAggregateId) . '/';
return $this->getSubgraph()->retrieveNodePath($otherNode->nodeAggregateId)->value . '/';
} catch (\InvalidArgumentException $e) {
return rtrim($nodePathOrIdentifier, '/') . '/';
}
Expand Down

0 comments on commit 6a21d6d

Please sign in to comment.