Index: trunk/extensions/GPoC/TableDisplay.php |
— | — | @@ -3,17 +3,33 @@ |
4 | 4 | exit( 1 ); |
5 | 5 | } |
6 | 6 | |
| 7 | +/** |
| 8 | + * @todo Document overall purpose of this class. |
| 9 | + */ |
7 | 10 | class TableDisplay { |
| 11 | + |
| 12 | + /** |
| 13 | + * Register our parser functions |
| 14 | + */ |
8 | 15 | public static function ParserFunctionInit( &$parser ) { |
9 | 16 | $parser->setFunctionHook( 'AssessmentStats', 'TableDisplay::AssessmentStatsRender' ); |
10 | 17 | return true; |
11 | 18 | } |
12 | 19 | |
| 20 | + /** |
| 21 | + * Register new magic words. |
| 22 | + */ |
13 | 23 | public static function LanguageGetMagic( &$magicWords, $langCode ) { |
14 | 24 | $magicWords['AssessmentStats'] = array( 0, 'AssessmentStats' ); |
15 | 25 | return true; |
16 | | - } |
| 26 | + } |
17 | 27 | |
| 28 | + /** |
| 29 | + * @todo Document! |
| 30 | + * @param string $projectName |
| 31 | + * @param unknown $projectStats |
| 32 | + * @return string A wikitable containing statistics for a project name |
| 33 | + */ |
18 | 34 | private static function formatTable( $projectName, $projectStats ) { |
19 | 35 | // Column Headers |
20 | 36 | $col_headers = array_keys($projectStats['top']); |
— | — | @@ -31,7 +47,12 @@ |
32 | 48 | $output .= "|}"; |
33 | 49 | return $output; |
34 | 50 | } |
35 | | - |
| 51 | + |
| 52 | + /** |
| 53 | + * Callback for AssessmentsStats parser function |
| 54 | + * @param Parser $parser Parser object passed by MW hook system (unused) |
| 55 | + * @param unknown A project object?? |
| 56 | + */ |
36 | 57 | public static function AssessmentStatsRender( $parser, $project ) { |
37 | 58 | $projectStats = Statistics::getProjectStats( $project ); |
38 | 59 | $output = TableDisplay::formatTable( $project, $projectStats ); |
Index: trunk/extensions/GPoC/AssessmentsExtractor.php |
— | — | @@ -5,12 +5,24 @@ |
6 | 6 | **/ |
7 | 7 | class AssessmentsExtractor |
8 | 8 | { |
| 9 | + /** @todo document */ |
9 | 10 | private $mText; |
10 | 11 | |
| 12 | + /** |
| 13 | + * @todo Document |
| 14 | + * @param string $preparedText TODO: what is it for? |
| 15 | + */ |
11 | 16 | function __construct( $preparedText ) { |
12 | 17 | $this->mText = $preparedText; |
13 | | - } |
| 18 | + } |
14 | 19 | |
| 20 | + /** |
| 21 | + * Once AssessmentsExtractor is build, call this method to generate |
| 22 | + * an array of assessment. |
| 23 | + * @todo Describe the returned array |
| 24 | + * @todo What happens if the preparedText does not match the expected format? |
| 25 | + * @return array Assessments |
| 26 | + */ |
15 | 27 | public function extractAssessments() { |
16 | 28 | $regex = '/<span data-project-name="(?P<project>.*)" data-importance="(?P<importance>.*)" data-quality="(?P<quality>.*)"\s*>/'; |
17 | 29 | $matches = array(); |
Index: trunk/extensions/GPoC/SpecialAssessmentLog.php |
— | — | @@ -1,5 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
| 4 | + * @todo Document this file |
4 | 5 | */ |
5 | 6 | |
6 | 7 | if ( !defined( 'MEDIAWIKI' ) ) { |
— | — | @@ -7,6 +8,9 @@ |
8 | 9 | die( 1 ); |
9 | 10 | } |
10 | 11 | |
| 12 | +/** |
| 13 | + * A special page showing various logs related to the assessment extension |
| 14 | + */ |
11 | 15 | class SpecialAssessmentLog extends SpecialPage { |
12 | 16 | |
13 | 17 | public function __construct() { |