Skip to content

Commit

Permalink
Remove dependency for Doctrine Collection (#48)
Browse files Browse the repository at this point in the history
* ExecutionPath uses array instead of Doctrine Collection

* Remove doctrine/collections
  • Loading branch information
softius authored Jul 23, 2018
1 parent 9ac765a commit 4e72f4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 77 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"php": "^7.1.3",
"symfony/expression-language": "^4.1",
"psr/log": "^1.0",
"doctrine/collections": "^1.5",
"dusank/knapsack": "^10.0"
},
"require-dev": {
Expand Down
69 changes: 1 addition & 68 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions src/Engine/ExecutionPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

namespace Phlow\Engine;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Phlow\Model\WorkflowObject;
use Traversable;

class ExecutionPath implements \IteratorAggregate, \Countable
{
/**
* @var Collection Sequence of Workflow Connectors and Nodes
* @var array Sequence of Workflow Connectors and Nodes
*/
private $sequence;

Expand All @@ -19,7 +17,7 @@ class ExecutionPath implements \IteratorAggregate, \Countable
*/
public function __construct()
{
$this->sequence = new ArrayCollection();
$this->sequence = [];
}

/**
Expand All @@ -29,7 +27,7 @@ public function __construct()
*/
public function add(WorkflowObject $element)
{
$this->sequence->add($element);
array_push($this->sequence, $element);
}

/**
Expand All @@ -41,7 +39,7 @@ public function add(WorkflowObject $element)
*/
public function getIterator()
{
return $this->sequence->getIterator();
return new \ArrayIterator($this->sequence);
}

/**
Expand All @@ -55,7 +53,7 @@ public function getIterator()
*/
public function count()
{
return $this->sequence->count();
return count($this->sequence);
}

/**
Expand All @@ -65,6 +63,6 @@ public function count()
*/
public function contains(WorkflowObject $workflowObject)
{
return $this->sequence->contains($workflowObject);
return in_array($workflowObject, $this->sequence, true);
}
}

0 comments on commit 4e72f4c

Please sign in to comment.