Vote Details for "PGraph" by gauthierm

» Details
  • Voter: Michael Gauthier 
  • Vote: +1 (conditional)
  • Reviews: Cursory source review
» Comment
This does a nice job of implementing a graph datastructure using PHP 5.3 features. There are a few issues preventing PEAR inclusion:

1.) The issues Till pointed out have not been addressed. Especially the private vs protected should be sorted out.

2.) PEAR classes shouldn't set up their own autoloader. You can provide one but make it optional so people can use their own autoloader.

3.) The package name PHP::PGraph doesn't mean anything. The current graph library in pear (PHP4 code!) is called Structures_Graph. Your package should be Structures_Graph2 if it's going in PEAR.

4.) The class names should match the directory structure according to PEAR convention. Something like:

- Structures/
- Graph2.php (Structures_Graph2)
- Graph2/
- LinkedList.php (Structures_Graph2_LinkedList)
- Vertext.php (Structures_Graph2_Vertex)

5.) Your package lacks features present in PEAR::Structures_Graph. Specifically topological sorting and cycle detection. Both are features people want if they're using a graph library.

6.) Why is there a "type" property for stack and queue instead of an abstract base class and two separate subclasses? In a lot of methods you do if stack {} else {}. This seems messy.

I don't see this begin accepted in PEAR in its current state, but don't be discouraged! It's a great start and there is precedent for PHP 5.x replacements for legacy PHP 4.x packages.