Skip to content

Commit 84dab25

Browse files
committed
added doc comments to the different classes
1 parent ce7daa3 commit 84dab25

20 files changed

+185
-0
lines changed

src/CG/Core/AbstractClassGenerator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
use CG\Generator\PhpClass;
66

7+
/**
8+
* Abstract base class for all class generators.
9+
*
10+
* @author Johannes M. Schmitt <[email protected]>
11+
*/
712
abstract class AbstractClassGenerator implements ClassGeneratorInterface
813
{
914
private $namingStrategy;

src/CG/Core/ClassGeneratorInterface.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22

33
namespace CG\Core;
44

5+
use CG\Generator\PhpClass;
6+
7+
/**
8+
* Interface for class generators.
9+
*
10+
* @author Johannes M. Schmitt <[email protected]>
11+
*/
512
interface ClassGeneratorInterface
613
{
14+
/**
15+
* Generates the PHP class.
16+
*
17+
* @return string
18+
*/
719
function generateClass();
820
}

src/CG/Generator/AbstractPhpMember.php

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

33
namespace CG\Generator;
44

5+
/**
6+
* Abstract PHP member class.
7+
*
8+
* @author Johannes M. Schmitt <[email protected]>
9+
*/
510
abstract class AbstractPhpMember
611
{
712
const VISIBILITY_PRIVATE = 'private';

src/CG/Generator/DefaultNavigator.php

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

33
namespace CG\Generator;
44

5+
/**
6+
* The default navigator.
7+
*
8+
* This class is responsible for the default traversal algorithm of the different
9+
* code elements.
10+
*
11+
* Unlike other visitor pattern implementations, this allows to separate the
12+
* traversal logic from the objects that are traversed.
13+
*
14+
* @author Johannes M. Schmitt <[email protected]>
15+
*/
516
class DefaultNavigator
617
{
718
private $constantSortFunc;
819
private $propertySortFunc;
920
private $methodSortFunc;
1021

22+
/**
23+
* Sets a custom constant sorting function.
24+
*
25+
* @param \Closure $func
26+
*/
1127
public function setConstantSortFunc(\Closure $func = null)
1228
{
1329
$this->constantSortFunc = $func;
1430
}
1531

32+
/**
33+
* Sets a custom property sorting function.
34+
*
35+
* @param \Closure $func
36+
*/
1637
public function setPropertySortFunc(\Closure $func = null)
1738
{
1839
$this->propertySortFunc = $func;
1940
}
2041

42+
/**
43+
* Sets a custom method sorting function.
44+
*
45+
* @param \Closure $func
46+
*/
2147
public function setMethodSortFunc(\Closure $func = null)
2248
{
2349
$this->methodSortFunc = $func;

src/CG/Generator/DefaultVisitor.php

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

33
namespace CG\Generator;
44

5+
/**
6+
* The default code generation visitor.
7+
*
8+
* @author Johannes M. Schmitt <[email protected]>
9+
*/
510
class DefaultVisitor implements DefaultVisitorInterface
611
{
712
private $writer;

src/CG/Generator/DefaultVisitorInterface.php

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

33
namespace CG\Generator;
44

5+
/**
6+
* The visitor interface required by the DefaultNavigator.
7+
*
8+
* @author Johannes M. Schmitt <[email protected]>
9+
*/
510
interface DefaultVisitorInterface
611
{
12+
/**
13+
* Resets the visitors internal state to allow re-using the same instance.
14+
*
15+
* @return void
16+
*/
717
function reset();
18+
819
function startVisitingClass(PhpClass $class);
920
function startVisitingConstants();
1021
function visitConstant($name, $value);

src/CG/Generator/GeneratorUtils.php

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

33
namespace CG\Generator;
44

5+
/**
6+
* Some Generator utils.
7+
*
8+
* @author Johannes M. Schmitt <[email protected]>
9+
*/
510
abstract class GeneratorUtils
611
{
712
private final function __construct() {}

src/CG/Generator/PhpClass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
use CG\Core\ReflectionUtils;
66

7+
/**
8+
* Represents a PHP class.
9+
*
10+
* @author Johannes M. Schmitt <[email protected]>
11+
*/
712
class PhpClass
813
{
914
private $name;

src/CG/Generator/PhpMethod.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
use CG\Core\ReflectionUtils;
66

7+
/**
8+
* Represents a PHP method.
9+
*
10+
* @author Johannes M. Schmitt <[email protected]>
11+
*/
712
class PhpMethod extends AbstractPhpMember
813
{
914
private $final = false;

src/CG/Generator/PhpParameter.php

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

33
namespace CG\Generator;
44

5+
/**
6+
* Represents a PHP parameter.
7+
*
8+
* @author Johannes M. Schmitt <[email protected]>
9+
*/
510
class PhpParameter
611
{
712
private $name;

0 commit comments

Comments
 (0)