/** * @param RelationshipDefinition $relationship * @param ObjectCollection $targetNodes * @return int */ public function getTargetNodesCount(RelationshipDefinition $relationship, ObjectCollection $targetNodes) { $targetCount = $targetNodes->count(); if ($relationship->hasPercentage()) { $pct = $relationship->getPercentage(); } else { $pct = $targetCount <= 100 ? 60 : 20; } $percentage = $pct / 100; $count = round($targetCount * $percentage); return (int) $count; }