Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix doctype references and remove unneeded imports #164

Merged
merged 1 commit into from
Sep 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 22 additions & 24 deletions src/Edge/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,40 @@

namespace Fhaculty\Graph\Edge;

use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Set\Edges;
use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Set\VerticesAggregate;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Exception\LogicException;
use Fhaculty\Graph\Exception\RangeException;
use Fhaculty\Graph\Exception\UnderflowException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Exception\BadMethodCallException;
use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Attribute\AttributeBagReference;
use Fhaculty\Graph\Exception\BadMethodCallException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Exception\LogicException;
use Fhaculty\Graph\Exception\RangeException;
use Fhaculty\Graph\Graph;
use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Set\VerticesAggregate;
use Fhaculty\Graph\Vertex;

abstract class Base implements VerticesAggregate, AttributeAware
{
/**
* weight of this edge
*
* @var float|int|NULL
* @see Edge::getWeight()
* @see self::getWeight()
*/
protected $weight = NULL;

/**
* maximum capacity (maximum flow)
*
* @var float|int|NULL
* @see Edge::getCapacity()
* @see self::getCapacity()
*/
protected $capacity = NULL;

/**
* flow (capacity currently in use)
*
* @var float|int|NULL
* @see Edge::getFlow()
* @see self::getFlow()
*/
protected $flow = NULL;

Expand Down Expand Up @@ -90,17 +88,17 @@ abstract public function isLoop();
* @param Vertex $startVertex
* @return Vertex
* @throws InvalidArgumentException if given $startVertex is not a valid start
* @see Edge::hasEdgeFrom() to check if given start is valid
* @see self::hasEdgeFrom() to check if given start is valid
*/
abstract public function getVertexToFrom(Vertex $startVertex);

/**
* get start vertex which can reach us(the given end vertex) with this edge
*
* @param Vertex $startVertex
* @param Vertex $endVertex
* @return Vertex
* @throws InvalidArgumentException if given $startVertex is not a valid end
* @see Edge::hasEdgeFrom() to check if given start is valid
* @see self::hasEdgeFrom() to check if given start is valid
*/
abstract public function getVertexFromTo(Vertex $endVertex);

Expand All @@ -117,9 +115,9 @@ public function getWeight()
/**
* set new weight for edge
*
* @param float|int|NULL $weight new numeric weight of edge or NULL=unset weight
* @return Edge $this (chainable)
* @throws DomainException if given weight is not numeric
* @param float|int|NULL $weight new numeric weight of edge or NULL=unset weight
* @return self $this (chainable)
* @throws InvalidArgumentException if given weight is not numeric
*/
public function setWeight($weight)
{
Expand Down Expand Up @@ -159,7 +157,7 @@ public function getCapacityRemaining()
* set new total capacity of this edge
*
* @param float|int|NULL $capacity
* @return Edge $this (chainable)
* @return self $this (chainable)
* @throws InvalidArgumentException if $capacity is invalid (not numeric or negative)
* @throws RangeException if current flow exceeds new capacity
*/
Expand Down Expand Up @@ -195,7 +193,7 @@ public function getFlow()
* set new total flow (capacity currently in use)
*
* @param float|int|NULL $flow
* @return Edge $this (chainable)
* @return self $this (chainable)
* @throws InvalidArgumentException if $flow is invalid (not numeric or negative)
* @throws RangeException if flow exceeds current maximum capacity
*/
Expand Down Expand Up @@ -262,7 +260,7 @@ public function destroy()
/**
* create new clone of this edge between adjacent vertices
*
* @return Edge new edge
* @return self new edge
* @uses Graph::createEdgeClone()
*/
public function createEdgeClone()
Expand All @@ -273,7 +271,7 @@ public function createEdgeClone()
/**
* create new clone of this edge inverted (in opposite direction) between adjacent vertices
*
* @return Edge new edge
* @return self new edge
* @uses Graph::createEdgeCloneInverted()
*/
public function createEdgeCloneInverted()
Expand All @@ -284,7 +282,7 @@ public function createEdgeCloneInverted()
/**
* do NOT allow cloning of objects
*
* @throws Exception
* @throws BadMethodCallException
*/
private function __clone()
{
Expand Down
4 changes: 1 addition & 3 deletions src/Edge/Directed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
namespace Fhaculty\Graph\Edge;

use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Exception\LogicException;
use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Set\Edges;
use Fhaculty\Graph\Vertex;

class Directed extends Base
{
Expand Down
21 changes: 8 additions & 13 deletions src/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

namespace Fhaculty\Graph;

use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Attribute\AttributeBagReference;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
use Fhaculty\Graph\Exception\BadMethodCallException;
use Fhaculty\Graph\Exception\UnexpectedValueException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Exception\OverflowException;
use Fhaculty\Graph\Exception\UnderflowException;
use Fhaculty\Graph\Exception\RuntimeException;
use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Algorithm\ConnectedComponents as AlgorithmConnectedComponents;
use Fhaculty\Graph\Algorithm\Bipartit as AlgorithmBipartit;
use Fhaculty\Graph\Algorithm\Eulerian as AlgorithmEulerian;
use Fhaculty\Graph\Algorithm\Groups as AlgorithmGroups;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
use Fhaculty\Graph\Exception\UnderflowException;
use Fhaculty\Graph\Set\DualAggregate;
use Fhaculty\Graph\Set\Edges;
use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Set\VerticesMap;
use Fhaculty\Graph\Set\Edges;
use Fhaculty\Graph\Set\DualAggregate;
use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Attribute\AttributeBagReference;

class Graph implements DualAggregate, AttributeAware
{
Expand Down
3 changes: 0 additions & 3 deletions src/Set/DualAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Fhaculty\Graph\Set;

use Fhaculty\Graph\Set\VerticesAggregate;
use Fhaculty\Graph\Set\EdgesAggregate;

/**
* DualAggregate provides access to both its Vertices and its Edges
*
Expand Down
20 changes: 7 additions & 13 deletions src/Set/Edges.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
namespace Fhaculty\Graph\Set;

use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Exception\UnderflowException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Exception\UnexpectedValueException;
use Countable;
use IteratorAggregate;
use IteratorIterator;
use ArrayIterator;
use Fhaculty\Graph\Set\EdgesAggregate;
use Fhaculty\Graph\Exception\UnderflowException;

/**
* A Set of Edges
Expand All @@ -22,7 +16,7 @@
* instances or to get a new Set of Edges. This way it's safe to pass around
* the original Set of Edges, because it will never be modified.
*/
class Edges implements Countable, IteratorAggregate, EdgesAggregate
class Edges implements \Countable, \IteratorAggregate, EdgesAggregate
{
/**
* order by edge weight
Expand Down Expand Up @@ -184,7 +178,7 @@ public function getEdgeIndex($index)
/**
* return first Edge that matches the given callback filter function
*
* @param callback $callbackCheck
* @param callable $callbackCheck
* @return Edge
* @throws UnderflowException if no Edge matches the given callback filter function
* @uses self::getEdgeMatchOrNull()
Expand All @@ -202,7 +196,7 @@ public function getEdgeMatch($callbackCheck)
/**
* checks whethere there's an Edge that matches the given callback filter function
*
* @param callback $callbackCheck
* @param callable $callbackCheck
* @return boolean
* @see self::getEdgeMatch() to return the Edge instance that matches the given callback filter function
* @uses self::getEdgeMatchOrNull()
Expand Down Expand Up @@ -413,11 +407,11 @@ public function isEmpty()
* This method implements the IteratorAggregate interface and allows this
* Set of Edges to be used in foreach loops.
*
* @return IteratorIterator
* @return \IteratorIterator
*/
public function getIterator()
{
return new IteratorIterator(new ArrayIterator($this->edges));
return new \IteratorIterator(new \ArrayIterator($this->edges));
}

/**
Expand Down Expand Up @@ -458,7 +452,7 @@ private function getEdgeMatchOrNull($callbackCheck)
*
* @param callable|int $callback
* @throws InvalidArgumentException
* @return Closure
* @return callable
*/
private function getCallback($callback)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Set/EdgesAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Fhaculty\Graph\Set;

use Fhaculty\Graph\Set\Edges;

/**
* Basic interface for every class that provides access to its Set of Edges
*/
Expand Down
21 changes: 7 additions & 14 deletions src/Set/Vertices.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
namespace Fhaculty\Graph\Set;

use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Exception\UnderflowException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Exception\UnexpectedValueException;
use Countable;
use IteratorAggregate;
use IteratorIterator;
use ArrayIterator;
use Fhaculty\Graph\Set\VerticesAggregate;
use Fhaculty\Graph\Set\VerticesMap;
use Fhaculty\Graph\Exception\UnderflowException;

/**
* A Set of Vertices
Expand All @@ -23,7 +16,7 @@
* instances or to get a new Set of Vertices. This way it's safe to pass around
* the original Set of Vertices, because it will never be modified.
*/
class Vertices implements Countable, IteratorAggregate, VerticesAggregate
class Vertices implements \Countable, \IteratorAggregate, VerticesAggregate
{
/**
* order by vertex ID
Expand Down Expand Up @@ -187,7 +180,7 @@ public function getVertexLast()
/**
* return first Vertex that matches the given callback filter function
*
* @param callback $callbackCheck
* @param callable $callbackCheck
* @return Vertex
* @throws UnderflowException if no Vertex matches the given callback filter function
* @uses self::getVertexMatchOrNull()
Expand All @@ -205,7 +198,7 @@ public function getVertexMatch($callbackCheck)
/**
* checks whether there's a Vertex that matches the given callback filter function
*
* @param callback $callbackCheck
* @param callable $callbackCheck
* @return boolean
* @see self::getVertexMatch() to return the Vertex instance that matches the given callback filter function
* @uses self::getVertexMatchOrNull()
Expand Down Expand Up @@ -453,11 +446,11 @@ public function hasDuplicates()
* This method implements the IteratorAggregate interface and allows this
* Set of Vertices to be used in foreach loops.
*
* @return IteratorIterator
* @return \IteratorIterator
*/
public function getIterator()
{
return new IteratorIterator(new ArrayIterator($this->vertices));
return new \IteratorIterator(new \ArrayIterator($this->vertices));
}

/**
Expand Down Expand Up @@ -505,7 +498,7 @@ private function getVertexMatchOrNull($callbackCheck)
*
* @param callable|int $callback
* @throws InvalidArgumentException
* @return Closure
* @return callable
*/
private function getCallback($callback)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Set/VerticesAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Fhaculty\Graph\Set;

use Fhaculty\Graph\Set\Vertices;

/**
* Basic interface for every class that provides access to its Set of Vertices
*/
Expand Down
4 changes: 1 addition & 3 deletions src/Set/VerticesMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace Fhaculty\Graph\Set;

use Fhaculty\Graph\Vertex;
use Fhaculty\Graph\Exception\OutOfBoundsException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Vertex;

/**
* A set of Vertices that are already stored in a vertex ID => Vertex instance mapping array
Expand Down
11 changes: 5 additions & 6 deletions src/Vertex.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

namespace Fhaculty\Graph;

use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Attribute\AttributeBagReference;
use Fhaculty\Graph\Edge\Base as Edge;
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
use Fhaculty\Graph\Edge\Undirected as EdgeUndirected;
use Fhaculty\Graph\Exception\BadMethodCallException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Set\Edges;
use Fhaculty\Graph\Set\EdgesAggregate;
use Fhaculty\Graph\Set\Vertices;
use Fhaculty\Graph\Exception\BadMethodCallException;
use Fhaculty\Graph\Exception\UnexpectedValueException;
use Fhaculty\Graph\Exception\InvalidArgumentException;
use Fhaculty\Graph\Attribute\AttributeAware;
use Fhaculty\Graph\Attribute\AttributeBagReference;

class Vertex implements EdgesAggregate, AttributeAware
{
Expand All @@ -31,7 +30,7 @@ class Vertex implements EdgesAggregate, AttributeAware
/**
* vertex balance
*
* @var float|NULL
* @var int|float|NULL
* @see Vertex::setBalance()
*/
private $balance;
Expand Down
Loading