mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 13:57:10 +02:00
Formated code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\SourceManagement;
|
||||
|
||||
use App\Entity\Source\Collection\TreeCollectionSourceInterface;
|
||||
@@ -11,14 +12,12 @@ use App\Entity\Source\SourceInterface;
|
||||
* Allows to iterate over a tree.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*
|
||||
* @todo Maybe lazy loading would be helpfull for performance
|
||||
*/
|
||||
final class TreeSourceService extends AbstractSourceService implements TreeSourceServiceInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TreeCollectionSourceInterface
|
||||
*/
|
||||
private $source;
|
||||
@@ -67,7 +66,6 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @todo Remove the optional parameter and put the logic in a private funtion.
|
||||
* @todo Remove the getAllBranches use inside the function.
|
||||
* {@inheritdoc}
|
||||
@@ -89,7 +87,7 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
foreach ((new self($branch))->getBranches() as $branchBranch) {
|
||||
if (!$allBranches->contains($branchBranch)) {
|
||||
$allBranches->add($branchBranch);
|
||||
if($branchBranch instanceof TreeCollectionSourceInterface){
|
||||
if ($branchBranch instanceof TreeCollectionSourceInterface) {
|
||||
$this->itterateOverBranch($branchBranch, $allBranches);
|
||||
}
|
||||
}
|
||||
@@ -106,11 +104,12 @@ final class TreeSourceService extends AbstractSourceService implements TreeSourc
|
||||
$leaves = new ArrayCollection($this->getLeaves()->toArray());
|
||||
foreach ($this->getAllBranches() as $branch) {
|
||||
foreach ((new self($branch))->getLeaves() as $leave) {
|
||||
if (! $leaves->contains($leave)) {
|
||||
if (!$leaves->contains($leave)) {
|
||||
$leaves->add($leave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $leaves;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user