r88540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88539‎ | r88540 | r88541 >
Date:19:54, 21 May 2011
Author:reedy
Status:ok
Tags:
Comment:
More documentation tweaks and updates
Modified paths:
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/includes/MacBinary.php (modified) (history)
  • /trunk/phase3/includes/RawPage.php (modified) (history)
  • /trunk/phase3/includes/SquidPurgeClient.php (modified) (history)
  • /trunk/phase3/includes/StringUtils.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SquidPurgeClient.php
@@ -33,6 +33,8 @@
3434 /**
3535 * Open a socket if there isn't one open already, return it.
3636 * Returns false on error.
 37+ *
 38+ * @return false|resource
3739 */
3840 protected function getSocket() {
3941 if ( $this->socket !== null ) {
@@ -64,6 +66,7 @@
6567
6668 /**
6769 * Get read socket array for select()
 70+ * @return array
6871 */
6972 public function getReadSocketsForSelect() {
7073 if ( $this->readState == 'idle' ) {
@@ -78,6 +81,7 @@
7982
8083 /**
8184 * Get write socket array for select()
 85+ * @return array
8286 */
8387 public function getWriteSocketsForSelect() {
8488 if ( !strlen( $this->writeBuffer ) ) {
@@ -225,6 +229,10 @@
226230 while ( $this->socket && $this->processReadBuffer() === 'continue' );
227231 }
228232
 233+ /**
 234+ * @throws MWException
 235+ * @return string
 236+ */
229237 protected function processReadBuffer() {
230238 switch ( $this->readState ) {
231239 case 'idle':
@@ -264,6 +272,10 @@
265273 }
266274 }
267275
 276+ /**
 277+ * @param $line
 278+ * @return
 279+ */
268280 protected function processStatusLine( $line ) {
269281 if ( !preg_match( '!^HTTP/(\d+)\.(\d+) (\d{3}) (.*)$!', $line, $m ) ) {
270282 $this->log( 'invalid status line' );
@@ -280,6 +292,9 @@
281293 $this->readState = 'header';
282294 }
283295
 296+ /**
 297+ * @param $line string
 298+ */
284299 protected function processHeaderLine( $line ) {
285300 if ( preg_match( '/^Content-Length: (\d+)$/i', $line, $m ) ) {
286301 $this->bodyRemaining = intval( $m[1] );
Index: trunk/phase3/includes/RawPage.php
@@ -223,6 +223,10 @@
224224 return $this->parseArticleText( $text );
225225 }
226226
 227+ /**
 228+ * @param $text
 229+ * @return string
 230+ */
227231 function parseArticleText( $text ) {
228232 if( $text === '' ) {
229233 return '';
Index: trunk/phase3/includes/MacBinary.php
@@ -31,6 +31,8 @@
3232 $this->loadHeader();
3333 }
3434
 35+ private $valid, $version, $filename, $dataLength, $resourceLength, $handle;
 36+
3537 /**
3638 * The file must be seekable, such as local filesystem.
3739 * Remote URLs probably won't work.
Index: trunk/phase3/includes/LogPage.php
@@ -56,6 +56,9 @@
5757 $this->sendToUDP = ( $udp == 'UDP' );
5858 }
5959
 60+ /**
 61+ * @return bool|int|null
 62+ */
6063 protected function saveContent() {
6164 global $wgLogRestrictions;
6265
Index: trunk/phase3/includes/StringUtils.php
@@ -13,6 +13,13 @@
1414 * Compared to delimiterReplace(), this implementation is fast but memory-
1515 * hungry and inflexible. The memory requirements are such that I don't
1616 * recommend using it on anything but guaranteed small chunks of text.
 17+ *
 18+ * @param $startDelim
 19+ * @param $endDelim
 20+ * @param $replace
 21+ * @param $subject
 22+ *
 23+ * @return string
1724 */
1825 static function hungryDelimiterReplace( $startDelim, $endDelim, $replace, $subject ) {
1926 $segments = explode( $startDelim, $subject );
@@ -36,17 +43,19 @@
3744 * This implementation is slower than hungryDelimiterReplace but uses far less
3845 * memory. The delimiters are literal strings, not regular expressions.
3946 *
 47+ * If the start delimiter ends with an initial substring of the end delimiter,
 48+ * e.g. in the case of C-style comments, the behaviour differs from the model
 49+ * regex. In this implementation, the end must share no characters with the
 50+ * start, so e.g. /*\/ is not considered to be both the start and end of a
 51+ * comment. /*\/xy/*\/ is considered to be a single comment with contents /xy/.
 52+ *
4053 * @param $startDelim String: start delimiter
4154 * @param $endDelim String: end delimiter
4255 * @param $callback Callback: function to call on each match
4356 * @param $subject String
4457 * @param $flags String: regular expression flags
 58+ * @return string
4559 */
46 - # If the start delimiter ends with an initial substring of the end delimiter,
47 - # e.g. in the case of C-style comments, the behaviour differs from the model
48 - # regex. In this implementation, the end must share no characters with the
49 - # start, so e.g. /*/ is not considered to be both the start and end of a
50 - # comment. /*/xy/*/ is considered to be a single comment with contents /xy/.
5160 static function delimiterReplaceCallback( $startDelim, $endDelim, $callback, $subject, $flags = '' ) {
5261 $inputPos = 0;
5362 $outputPos = 0;
@@ -180,6 +189,9 @@
181190 /**
182191 * Workalike for explode() with limited memory usage.
183192 * Returns an Iterator
 193+ * @param $separator
 194+ * @param $subject
 195+ * @return \ArrayIterator|\ExplodeIterator
184196 */
185197 static function explode( $separator, $subject ) {
186198 if ( substr_count( $subject, $separator ) > 1000 ) {

Status & tagging log