Skip to content

Commit a5455ed

Browse files
authored
Merge pull request #164 from clue-labs/imports
Fix doctype references and remove unneeded imports
2 parents f546a45 + ad3d107 commit a5455ed

17 files changed

Lines changed: 61 additions & 103 deletions

src/Edge/Base.php

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,40 @@
22

33
namespace Fhaculty\Graph\Edge;
44

5-
use Fhaculty\Graph\Vertex;
6-
use Fhaculty\Graph\Set\Edges;
7-
use Fhaculty\Graph\Set\Vertices;
8-
use Fhaculty\Graph\Set\VerticesAggregate;
9-
use Fhaculty\Graph\Graph;
10-
use Fhaculty\Graph\Exception\LogicException;
11-
use Fhaculty\Graph\Exception\RangeException;
12-
use Fhaculty\Graph\Exception\UnderflowException;
13-
use Fhaculty\Graph\Exception\InvalidArgumentException;
14-
use Fhaculty\Graph\Exception\BadMethodCallException;
155
use Fhaculty\Graph\Attribute\AttributeAware;
166
use Fhaculty\Graph\Attribute\AttributeBagReference;
7+
use Fhaculty\Graph\Exception\BadMethodCallException;
8+
use Fhaculty\Graph\Exception\InvalidArgumentException;
9+
use Fhaculty\Graph\Exception\LogicException;
10+
use Fhaculty\Graph\Exception\RangeException;
11+
use Fhaculty\Graph\Graph;
12+
use Fhaculty\Graph\Set\Vertices;
13+
use Fhaculty\Graph\Set\VerticesAggregate;
14+
use Fhaculty\Graph\Vertex;
1715

1816
abstract class Base implements VerticesAggregate, AttributeAware
1917
{
2018
/**
2119
* weight of this edge
2220
*
2321
* @var float|int|NULL
24-
* @see Edge::getWeight()
22+
* @see self::getWeight()
2523
*/
2624
protected $weight = NULL;
2725

2826
/**
2927
* maximum capacity (maximum flow)
3028
*
3129
* @var float|int|NULL
32-
* @see Edge::getCapacity()
30+
* @see self::getCapacity()
3331
*/
3432
protected $capacity = NULL;
3533

3634
/**
3735
* flow (capacity currently in use)
3836
*
3937
* @var float|int|NULL
40-
* @see Edge::getFlow()
38+
* @see self::getFlow()
4139
*/
4240
protected $flow = NULL;
4341

@@ -90,17 +88,17 @@ abstract public function isLoop();
9088
* @param Vertex $startVertex
9189
* @return Vertex
9290
* @throws InvalidArgumentException if given $startVertex is not a valid start
93-
* @see Edge::hasEdgeFrom() to check if given start is valid
91+
* @see self::hasEdgeFrom() to check if given start is valid
9492
*/
9593
abstract public function getVertexToFrom(Vertex $startVertex);
9694

9795
/**
9896
* get start vertex which can reach us(the given end vertex) with this edge
9997
*
100-
* @param Vertex $startVertex
98+
* @param Vertex $endVertex
10199
* @return Vertex
102100
* @throws InvalidArgumentException if given $startVertex is not a valid end
103-
* @see Edge::hasEdgeFrom() to check if given start is valid
101+
* @see self::hasEdgeFrom() to check if given start is valid
104102
*/
105103
abstract public function getVertexFromTo(Vertex $endVertex);
106104

@@ -117,9 +115,9 @@ public function getWeight()
117115
/**
118116
* set new weight for edge
119117
*
120-
* @param float|int|NULL $weight new numeric weight of edge or NULL=unset weight
121-
* @return Edge $this (chainable)
122-
* @throws DomainException if given weight is not numeric
118+
* @param float|int|NULL $weight new numeric weight of edge or NULL=unset weight
119+
* @return self $this (chainable)
120+
* @throws InvalidArgumentException if given weight is not numeric
123121
*/
124122
public function setWeight($weight)
125123
{
@@ -159,7 +157,7 @@ public function getCapacityRemaining()
159157
* set new total capacity of this edge
160158
*
161159
* @param float|int|NULL $capacity
162-
* @return Edge $this (chainable)
160+
* @return self $this (chainable)
163161
* @throws InvalidArgumentException if $capacity is invalid (not numeric or negative)
164162
* @throws RangeException if current flow exceeds new capacity
165163
*/
@@ -195,7 +193,7 @@ public function getFlow()
195193
* set new total flow (capacity currently in use)
196194
*
197195
* @param float|int|NULL $flow
198-
* @return Edge $this (chainable)
196+
* @return self $this (chainable)
199197
* @throws InvalidArgumentException if $flow is invalid (not numeric or negative)
200198
* @throws RangeException if flow exceeds current maximum capacity
201199
*/
@@ -262,7 +260,7 @@ public function destroy()
262260
/**
263261
* create new clone of this edge between adjacent vertices
264262
*
265-
* @return Edge new edge
263+
* @return self new edge
266264
* @uses Graph::createEdgeClone()
267265
*/
268266
public function createEdgeClone()
@@ -273,7 +271,7 @@ public function createEdgeClone()
273271
/**
274272
* create new clone of this edge inverted (in opposite direction) between adjacent vertices
275273
*
276-
* @return Edge new edge
274+
* @return self new edge
277275
* @uses Graph::createEdgeCloneInverted()
278276
*/
279277
public function createEdgeCloneInverted()
@@ -284,7 +282,7 @@ public function createEdgeCloneInverted()
284282
/**
285283
* do NOT allow cloning of objects
286284
*
287-
* @throws Exception
285+
* @throws BadMethodCallException
288286
*/
289287
private function __clone()
290288
{

src/Edge/Directed.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
namespace Fhaculty\Graph\Edge;
44

55
use Fhaculty\Graph\Exception\InvalidArgumentException;
6-
use Fhaculty\Graph\Exception\LogicException;
7-
use Fhaculty\Graph\Vertex;
86
use Fhaculty\Graph\Set\Vertices;
9-
use Fhaculty\Graph\Set\Edges;
7+
use Fhaculty\Graph\Vertex;
108

119
class Directed extends Base
1210
{

src/Graph.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,20 @@
22

33
namespace Fhaculty\Graph;
44

5+
use Fhaculty\Graph\Attribute\AttributeAware;
6+
use Fhaculty\Graph\Attribute\AttributeBagReference;
7+
use Fhaculty\Graph\Edge\Base as Edge;
8+
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
59
use Fhaculty\Graph\Exception\BadMethodCallException;
6-
use Fhaculty\Graph\Exception\UnexpectedValueException;
710
use Fhaculty\Graph\Exception\InvalidArgumentException;
11+
use Fhaculty\Graph\Exception\OutOfBoundsException;
812
use Fhaculty\Graph\Exception\OverflowException;
9-
use Fhaculty\Graph\Exception\UnderflowException;
1013
use Fhaculty\Graph\Exception\RuntimeException;
11-
use Fhaculty\Graph\Exception\OutOfBoundsException;
12-
use Fhaculty\Graph\Algorithm\ConnectedComponents as AlgorithmConnectedComponents;
13-
use Fhaculty\Graph\Algorithm\Bipartit as AlgorithmBipartit;
14-
use Fhaculty\Graph\Algorithm\Eulerian as AlgorithmEulerian;
15-
use Fhaculty\Graph\Algorithm\Groups as AlgorithmGroups;
16-
use Fhaculty\Graph\Edge\Base as Edge;
17-
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
14+
use Fhaculty\Graph\Exception\UnderflowException;
15+
use Fhaculty\Graph\Set\DualAggregate;
16+
use Fhaculty\Graph\Set\Edges;
1817
use Fhaculty\Graph\Set\Vertices;
1918
use Fhaculty\Graph\Set\VerticesMap;
20-
use Fhaculty\Graph\Set\Edges;
21-
use Fhaculty\Graph\Set\DualAggregate;
22-
use Fhaculty\Graph\Attribute\AttributeAware;
23-
use Fhaculty\Graph\Attribute\AttributeBagReference;
2419

2520
class Graph implements DualAggregate, AttributeAware
2621
{

src/Set/DualAggregate.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace Fhaculty\Graph\Set;
44

5-
use Fhaculty\Graph\Set\VerticesAggregate;
6-
use Fhaculty\Graph\Set\EdgesAggregate;
7-
85
/**
96
* DualAggregate provides access to both its Vertices and its Edges
107
*

src/Set/Edges.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
namespace Fhaculty\Graph\Set;
44

55
use Fhaculty\Graph\Edge\Base as Edge;
6-
use Fhaculty\Graph\Exception\UnderflowException;
76
use Fhaculty\Graph\Exception\InvalidArgumentException;
87
use Fhaculty\Graph\Exception\OutOfBoundsException;
9-
use Fhaculty\Graph\Exception\UnexpectedValueException;
10-
use Countable;
11-
use IteratorAggregate;
12-
use IteratorIterator;
13-
use ArrayIterator;
14-
use Fhaculty\Graph\Set\EdgesAggregate;
8+
use Fhaculty\Graph\Exception\UnderflowException;
159

1610
/**
1711
* A Set of Edges
@@ -22,7 +16,7 @@
2216
* instances or to get a new Set of Edges. This way it's safe to pass around
2317
* the original Set of Edges, because it will never be modified.
2418
*/
25-
class Edges implements Countable, IteratorAggregate, EdgesAggregate
19+
class Edges implements \Countable, \IteratorAggregate, EdgesAggregate
2620
{
2721
/**
2822
* order by edge weight
@@ -184,7 +178,7 @@ public function getEdgeIndex($index)
184178
/**
185179
* return first Edge that matches the given callback filter function
186180
*
187-
* @param callback $callbackCheck
181+
* @param callable $callbackCheck
188182
* @return Edge
189183
* @throws UnderflowException if no Edge matches the given callback filter function
190184
* @uses self::getEdgeMatchOrNull()
@@ -202,7 +196,7 @@ public function getEdgeMatch($callbackCheck)
202196
/**
203197
* checks whethere there's an Edge that matches the given callback filter function
204198
*
205-
* @param callback $callbackCheck
199+
* @param callable $callbackCheck
206200
* @return boolean
207201
* @see self::getEdgeMatch() to return the Edge instance that matches the given callback filter function
208202
* @uses self::getEdgeMatchOrNull()
@@ -413,11 +407,11 @@ public function isEmpty()
413407
* This method implements the IteratorAggregate interface and allows this
414408
* Set of Edges to be used in foreach loops.
415409
*
416-
* @return IteratorIterator
410+
* @return \IteratorIterator
417411
*/
418412
public function getIterator()
419413
{
420-
return new IteratorIterator(new ArrayIterator($this->edges));
414+
return new \IteratorIterator(new \ArrayIterator($this->edges));
421415
}
422416

423417
/**
@@ -458,7 +452,7 @@ private function getEdgeMatchOrNull($callbackCheck)
458452
*
459453
* @param callable|int $callback
460454
* @throws InvalidArgumentException
461-
* @return Closure
455+
* @return callable
462456
*/
463457
private function getCallback($callback)
464458
{

src/Set/EdgesAggregate.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Fhaculty\Graph\Set;
44

5-
use Fhaculty\Graph\Set\Edges;
6-
75
/**
86
* Basic interface for every class that provides access to its Set of Edges
97
*/

src/Set/Vertices.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
namespace Fhaculty\Graph\Set;
44

55
use Fhaculty\Graph\Vertex;
6-
use Fhaculty\Graph\Exception\UnderflowException;
76
use Fhaculty\Graph\Exception\InvalidArgumentException;
87
use Fhaculty\Graph\Exception\OutOfBoundsException;
9-
use Fhaculty\Graph\Exception\UnexpectedValueException;
10-
use Countable;
11-
use IteratorAggregate;
12-
use IteratorIterator;
13-
use ArrayIterator;
14-
use Fhaculty\Graph\Set\VerticesAggregate;
15-
use Fhaculty\Graph\Set\VerticesMap;
8+
use Fhaculty\Graph\Exception\UnderflowException;
169

1710
/**
1811
* A Set of Vertices
@@ -23,7 +16,7 @@
2316
* instances or to get a new Set of Vertices. This way it's safe to pass around
2417
* the original Set of Vertices, because it will never be modified.
2518
*/
26-
class Vertices implements Countable, IteratorAggregate, VerticesAggregate
19+
class Vertices implements \Countable, \IteratorAggregate, VerticesAggregate
2720
{
2821
/**
2922
* order by vertex ID
@@ -187,7 +180,7 @@ public function getVertexLast()
187180
/**
188181
* return first Vertex that matches the given callback filter function
189182
*
190-
* @param callback $callbackCheck
183+
* @param callable $callbackCheck
191184
* @return Vertex
192185
* @throws UnderflowException if no Vertex matches the given callback filter function
193186
* @uses self::getVertexMatchOrNull()
@@ -205,7 +198,7 @@ public function getVertexMatch($callbackCheck)
205198
/**
206199
* checks whether there's a Vertex that matches the given callback filter function
207200
*
208-
* @param callback $callbackCheck
201+
* @param callable $callbackCheck
209202
* @return boolean
210203
* @see self::getVertexMatch() to return the Vertex instance that matches the given callback filter function
211204
* @uses self::getVertexMatchOrNull()
@@ -453,11 +446,11 @@ public function hasDuplicates()
453446
* This method implements the IteratorAggregate interface and allows this
454447
* Set of Vertices to be used in foreach loops.
455448
*
456-
* @return IteratorIterator
449+
* @return \IteratorIterator
457450
*/
458451
public function getIterator()
459452
{
460-
return new IteratorIterator(new ArrayIterator($this->vertices));
453+
return new \IteratorIterator(new \ArrayIterator($this->vertices));
461454
}
462455

463456
/**
@@ -505,7 +498,7 @@ private function getVertexMatchOrNull($callbackCheck)
505498
*
506499
* @param callable|int $callback
507500
* @throws InvalidArgumentException
508-
* @return Closure
501+
* @return callable
509502
*/
510503
private function getCallback($callback)
511504
{

src/Set/VerticesAggregate.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Fhaculty\Graph\Set;
44

5-
use Fhaculty\Graph\Set\Vertices;
6-
75
/**
86
* Basic interface for every class that provides access to its Set of Vertices
97
*/

src/Set/VerticesMap.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
namespace Fhaculty\Graph\Set;
44

5-
use Fhaculty\Graph\Vertex;
65
use Fhaculty\Graph\Exception\OutOfBoundsException;
7-
use Fhaculty\Graph\Exception\InvalidArgumentException;
8-
use Fhaculty\Graph\Set\Vertices;
6+
use Fhaculty\Graph\Vertex;
97

108
/**
119
* A set of Vertices that are already stored in a vertex ID => Vertex instance mapping array

src/Vertex.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
namespace Fhaculty\Graph;
44

5+
use Fhaculty\Graph\Attribute\AttributeAware;
6+
use Fhaculty\Graph\Attribute\AttributeBagReference;
57
use Fhaculty\Graph\Edge\Base as Edge;
68
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
79
use Fhaculty\Graph\Edge\Undirected as EdgeUndirected;
10+
use Fhaculty\Graph\Exception\BadMethodCallException;
11+
use Fhaculty\Graph\Exception\InvalidArgumentException;
812
use Fhaculty\Graph\Set\Edges;
913
use Fhaculty\Graph\Set\EdgesAggregate;
1014
use Fhaculty\Graph\Set\Vertices;
11-
use Fhaculty\Graph\Exception\BadMethodCallException;
12-
use Fhaculty\Graph\Exception\UnexpectedValueException;
13-
use Fhaculty\Graph\Exception\InvalidArgumentException;
14-
use Fhaculty\Graph\Attribute\AttributeAware;
15-
use Fhaculty\Graph\Attribute\AttributeBagReference;
1615

1716
class Vertex implements EdgesAggregate, AttributeAware
1817
{
@@ -31,7 +30,7 @@ class Vertex implements EdgesAggregate, AttributeAware
3130
/**
3231
* vertex balance
3332
*
34-
* @var float|NULL
33+
* @var int|float|NULL
3534
* @see Vertex::setBalance()
3635
*/
3736
private $balance;

0 commit comments

Comments
 (0)