Browse Source

phpdoc compatibility

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
a1ba8e940c
  1. 2
      lib.php
  2. 5
      snakes/createboard.php
  3. 40
      sudoku/class.Sudoku.php
  4. 4
      sudoku/create.php
  5. 124
      sudoku/play.php
  6. 91
      sudoku/sdd/class.SDD.php
  7. 2
      translate.php

2
lib.php

@ -664,7 +664,7 @@ function game_print_recent_mod_activity($activity, $courseid, $detail, $modnames
* Removes all grades from gradebook
*
* @param int $courseid
* @param string optional $type
* @param string $type
**/
function game_reset_gradebook($courseid, $type='') {
global $DB;

5
snakes/createboard.php

@ -122,7 +122,7 @@ function computexy( $pos, &$x, &$y, $colsx, $colsy) {
* @param object $im
* @param int $cs
* @param int $cy
* @param $object $board
* @param object $board
* @param int $colsx
* @param int $colsy
* @param int $ofsleft
@ -146,6 +146,7 @@ function makeboard( $im, $dir, $cx, $cy, $board, $colsx, $colsy, $ofsleft, $ofst
* @param object $im
* @param string $dir
* @param int $cx
* @param int $cy
* @param string $s
* @param int $colsx
* @param int $colsy
@ -213,7 +214,7 @@ function makeboardl( $im, $dir, $cx, $cy, $s, $colsx, $colsy, $ofsleft, $ofstop)
* Make board snakes
*
* @param object $im
* @param string $dit
* @param string $dir
* @param int $cx
* @param int $cy
* @param string $s

40
sudoku/class.Sudoku.php

@ -104,7 +104,7 @@ class objects {
/*
* Deep copy anything.
*
* @param array $theArray [optional] Something to be deep copied. Default is the current
* @param array $thearray [optional] Something to be deep copied. Default is the current
* ObjectS.
* @return mixed The deep copy of the input. All references embedded within
* the array have been resolved into copies allowing things like the
@ -229,7 +229,7 @@ class cell extends objects {
}
}
/*
/**
* Assert pending solution.
* Used to make sure that solved positions show up at print time.
* The value is used as a candidate for "slicing and dicing" by elimination in
@ -241,7 +241,7 @@ class cell extends objects {
$this->state = array($value => $value);
}
/*
/**
* return the state of a cell.
*
* @return mixed Either solved state or array of state pending solution.
@ -250,7 +250,7 @@ class cell extends objects {
return $this->state;
}
/*
/**
* Has the state of this cell been applied to the board.
*
* @return boolean True if it has, false otherwise. Implies that IsSolved is true as well.
@ -259,7 +259,7 @@ class cell extends objects {
return $this->applied;
}
/*
/**
* Has this cell been solved?
*
* @return boolean True if this cell has hit a single state.
@ -268,7 +268,7 @@ class cell extends objects {
return !is_array($this->state);
}
/*
/**
* This is used primarily by the pretty printer, but has other applications in the code.
*
* Return information about the state of a cell.
@ -289,7 +289,7 @@ class cell extends objects {
}
}
/*
/**
* Eliminate one or more values from the state information of the cell.
*
* This is the negative inference of Sudoku. By eliminating values the
@ -691,7 +691,7 @@ class rcs extends ObjectS {
return true;
}
/*
/**
* Check to see if the RCS contains a valid state.
*
* @return boolean True if the state of the RCS could be part of a valid
@ -828,7 +828,7 @@ class c extends r {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class s extends rcs {
/*
/**
* The cells within the 3x3 sudoku which participate in the coupling calculation for a square.
* Remember that the missing cells have already participated in the row or column coupling
* calculation.
@ -971,7 +971,7 @@ class sudoku extends ObjectS {
$this->_buildrcs();
}
/*
/**
* Apply a pending solved position to the row/square/column.
*
* At this point, the board has been populated with any pending solutions.
@ -998,7 +998,7 @@ class sudoku extends ObjectS {
$this->thesquares[$i]->un_set($thevalue);
}
/*
/**
* Apply all pending solved positions to the board.
*
* @return boolean True if at least one solved position was applied, false
@ -1028,7 +1028,7 @@ class sudoku extends ObjectS {
return $thereturn;
}
/*
/**
* build the row/column/square structures for the board.
*/
protected function _buildrcs() {
@ -1073,7 +1073,7 @@ class sudoku extends ObjectS {
}
}
/*
/**
* Seek alternate solutions in a solution set.
*
* Given a solution, see if there are any alternates within the solution.
@ -1102,7 +1102,7 @@ class sudoku extends ObjectS {
return $theinitialstate;
}
/*
/**
* Initialize Sudoku puzzle generation and generate a puzzle.
*
* Turns out that while the solution of Sudoku is mechanical, the creation of
@ -1195,7 +1195,7 @@ class sudoku extends ObjectS {
return array();
}
/*
/**
* Sudoku puzzle generator.
*
* This is the routine that does the heavy lifting
@ -1360,7 +1360,7 @@ class sudoku extends ObjectS {
return array();
}
/*
/**
* Get the current state of the board as a string.
*
* Return the contents of the board as a string of digits and blanks. Blanks
@ -1379,7 +1379,7 @@ class sudoku extends ObjectS {
return $thestring;
}
/*
/**
* Get cel
*
* @param int $r
@ -1389,7 +1389,7 @@ class sudoku extends ObjectS {
return $this->theboard[$r][$c];
}
/*
/**
* Each element of the input array is a triple consisting of (row, column, value).
* Each of these values is in the range 1..9.
*
@ -1402,7 +1402,7 @@ class sudoku extends ObjectS {
}
}
/*
/**
* Initialize puzzle from an input file.
*
* The input file is a text file, blank or tab delimited, with each line being a
@ -1470,7 +1470,7 @@ class sudoku extends ObjectS {
$this->initializepuzzlefromrray($therray);
}
/*
/**
* predicate to determine if the current puzzle has been solved.
*
* @return boolean true if the puzzle has been solved.

4
sudoku/create.php

@ -96,8 +96,8 @@ function appendsudokub() {
/**
* Pack sudoku
*
* @param $si
* @param $sp
* @param object $si
* @param object $sp
*
* @return the packed sudoku
*/

124
sudoku/play.php

@ -29,12 +29,12 @@ require_once( "../../lib/questionlib.php");
/**
* Plays the game Sudoku
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $endofgame
* @param $context
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param boolean $endofgame
* @param stdClass $context
*/
function game_sudoku_continue( $id, $game, $attempt, $sudoku, $endofgame, $context) {
global $CFG, $DB, $USER;
@ -129,13 +129,13 @@ function game_sudoku_continue( $id, $game, $attempt, $sudoku, $endofgame, $conte
/**
* Plays the game Sudoku
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $onlyshow
* @param $showsolution
* @param $context
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param boolean $onlyshow
* @param boolean $showsolution
* @param stdClass $context
*/
function game_sudoku_play( $id, $game, $attempt, $sudoku, $onlyshow, $showsolution, $context) {
$offsetquestions = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions);
@ -166,10 +166,10 @@ function game_sudoku_play( $id, $game, $attempt, $sudoku, $onlyshow, $showsoluti
/**
* Returns a map with an offset and id of each question.
*
* @param $sourcemodule
* @param $attemp
* @param $numbers
* @param $correctquestions
* @param string $sourcemodule
* @param stdClass $attempt
* @param int $numbers
* @param int $correctquestions
*/
function game_sudoku_compute_offsetquestions( $sourcemodule, $attempt, &$numbers, &$correctquestions) {
global $CFG, $DB;
@ -237,7 +237,7 @@ function getrandomsudoku() {
/**
* Get closed
*
* @param $data
* @param string $data
*/
function game_sudoku_getclosed( $data) {
$a = array();
@ -256,11 +256,15 @@ function game_sudoku_getclosed( $data) {
/**
* Shows the sudoku
*
* @param $data
* @param $guess
* @param string $data
* @param string $guess
* @param boolean $bshowlegend
* @param boolean $bshowsolution
* @param $offsetquestions
* @param int $offsetquestions
* @param int $correctquestions
* @param int $id
* @param stdClass $attempt
* @param stdClass $game
*/
function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $offsetquestions,
$correctquestions, $id, $attempt, $game) {
@ -367,7 +371,7 @@ function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $o
/**
* Get question list
*
* @param $offsetquestions
* @param int $offsetquestions
*/
function game_sudoku_getquestionlist( $offsetquestions) {
$questionlist = '';
@ -388,10 +392,10 @@ function game_sudoku_getquestionlist( $offsetquestions) {
/**
* Get glossary entries
*
* @param $game
* @param $offsetentries
* @param $entrylist
* @param $numbers
* @param stdClass $game
* @param int $offsetentries
* @param string $entrylist
* @param int $numbers
*/
function game_sudoku_getglossaryentries( $game, $offsetentries, &$entrylist, $numbers) {
global $DB;
@ -413,12 +417,12 @@ function game_sudoku_getglossaryentries( $game, $offsetentries, &$entrylist, $nu
/**
* Plays the game hangman
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $offsetquestions
* @param $numbers
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param int $offsetquestions
* @param string $numbers
*/
function game_sudoku_showquestions_quiz( $id, $game, $attempt, $sudoku, $offsetquestions, $numbers,
$correctquestions, $onlyshow, $showsolution, $context) {
@ -492,12 +496,12 @@ function game_sudoku_showquestions_quiz( $id, $game, $attempt, $sudoku, $offsetq
/**
* Show the sudoku and glossaryentries.
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $offsetentries
* @param $numbers
* @param int $id
* @param string $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param int $offsetentries
* @param int $numbers
*/
function game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $offsetentries, $numbers,
$correctentries, $onlyshow, $showsolution) {
@ -576,10 +580,10 @@ function game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $off
/**
* Show question onfinish
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
*/
function game_sudoku_showquestion_onfinish( $id, $game, $attempt, $sudoku) {
if (!set_field( 'game_attempts', 'finish', 1, 'id', $attempt->id)) {
@ -605,12 +609,12 @@ function game_sudoku_checkanswers() {
/**
* Checks questions
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $finishattempt
* @param $course
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param boolean $finishattempt
* @param stdClass $course
*/
function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishattempt, $course) {
global $DB;
@ -654,12 +658,12 @@ function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishatte
/**
* Check glossary entries
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $finishattempt
* @param $course
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param boolean $finishattempt
* @param string $course
*/
function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $finishattempt, $course) {
global $DB;
@ -734,12 +738,12 @@ function game_sudoku_check_last( $id, $game, $attempt, $sudoku, $finishattempt,
/**
* Check number
*
* @param $id
* @param $game
* @param $attempt
* @param $sudoku
* @param $pos
* @param $num
* @param int $id
* @param stdClass $game
* @param stdClass $attempt
* @param stdClass $sudoku
* @param int $pos
* @param int $num
* @param stdClass $context
*/
function game_sudoku_check_number( $id, $game, $attempt, $sudoku, $pos, $num, $context) {

91
sudoku/sdd/class.SDD.php

@ -19,9 +19,6 @@
* html. This is a class wrapper for a couple of utility routines that I use
* all the time. It's handier to have them as a class.
*
* Its also the class interface for logging functions that I use in developing
* web enabled applications.
*
* @author Dick Munroe <munroe@csworks.com>
* @copyright copyright @ by Dick Munroe, 2004
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
@ -44,38 +41,23 @@ class sdd {
/** @var HTML to be generated flag. */
protected $m_htmlflag;
/** @var logging flag. */
protected $m_logging = false;
/** @var In memory log file. */
protected $m_log = array();
/*
/**
* Constructor.
*
* @param boolean $theHTMLFlag [optional] True if HTML is to be generated.
* If omitted, $_SERVER is used to "guess" the state of
* the HTML flag. Be default, HTML is generated when
* accessed by a web server.
* @param boolean $theLoggingFlag [optional] the state of logging for
* this object. By default, logging is off.
*/
public function init($thehtmlflag = null, $theloggingflag = false) {
public function init($thehtmlflag = null) {
if ($thehtmlflag === null) {
$thehtmlflag = (!empty($_SERVER['DOCUMENT_ROOT']));
}
$this->m_htmlflag = $thehtmlflag;
$this->m_logging = $theloggingflag;
}
/*
* Close the log file.
*/
public function close() {
}
/*
/**
* Dump a structured variable.
*
* @static
@ -109,7 +91,7 @@ class sdd {
}
}
/*
/**
* Dump the contents of an array.
*
* @param array $thearray the array whose contents are to be displayed.
@ -157,7 +139,7 @@ class sdd {
return $thestring;
}
/*
/**
* Dump the contents of an object.
*
* Provide a structured display of an object and all the
@ -274,38 +256,12 @@ class sdd {
return $thestring;
}
/*
* Write a debugging value to a log file.
/**
* Generate context specific new line equivalents.
*
* @param mixed Data to be logged.
* @param string $theHeader [optional] string to be emitted prior to
* logging the data. By default it is a date/time
* stamp.
*/
public function log(&$thedata, $theheader = null) {
$theheader = date('[Y-m-d H:i:s]: ') . $theheader;
if ($this->m_logging) {
if ($this->m_htmlflag) {
$xxx = $this->dump($thedata);
if (substr($xxx, 0, 5) == '<pre>') {
$xxx = '<pre>' . $theheader . substr($xxx, 5);
} else {
$xxx = $theheader . $xxx;
}
$this->writeLog($xxx);
} else {
$xxx = $theheader . $this->dump($thedata);
$this->writelog($xxx);
}
}
}
/*
* @desc Generate context specific new line equivalents.
* @param integer [optional] the number of newlines.
* @param boolean [optional] true if generating html newlines.
*
* @return string newlines.
*/
public function newline($thecount = 1, $thehtmlflag = null) {
@ -328,7 +284,7 @@ class sdd {
}
}
/*
/**
* Dump any scalar value
*
* @param mixed $theVariable the variable to be dumped.
@ -341,33 +297,4 @@ class sdd {
return var_export($thevariable, true);
}
}
/*
* Write data to the log file.
*
* @parameter string $theData [by reference] the data to be written
* into the log file.
* @return integer the number of bytes written into the log file.
*/
public function writelog(&$thedata) {
return strlen($this->m_log[] = $thedata);
}
/*
* Return the state of the logging flag.
*
* @return boolean
*/
public function getlogging() {
return $this->m_logging;
}
/*
* Set the state of the logging flag.
*
* @return boolean
*/
public function setlogging($thelogging=false) {
$this->m_logging = $thelogging;
}
}

2
translate.php

@ -479,7 +479,7 @@ function read_dir($dir, $ext) {
* @param string $langname
* @param int $sum
* @param string $outdir
* @param int $utranslated
* @param int $untranslated
*/
function computediff( $en, $lang, $strings, $langname, &$sum, $outdir, &$untranslated) {
global $CFG;

Loading…
Cancel
Save