Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Small docs and style fixes

  • Loading branch information...
commit 25dab15d2b569eef451f0d165c326a989a5969c1 1 parent c4ad2d3
@sirpengi sirpengi authored
View
3  irclogger/protected/controllers/LoggerController.php
@@ -1,9 +1,6 @@
<?php
class LoggerController extends Controller{
- /**
- * Declares class-based actions.
- */
public function actions(){
return array(
// page action renders "static" pages stored under 'protected/views/site/pages'
View
18 irclogger/protected/models/LogsModel.php
@@ -37,19 +37,22 @@ public function getLogDates(){
}
public function getLogFromDate($date){
+ /* Return a LogFile object from a particular date */
$fn = $this->_filenameFromDate($date);
return new LogFile($fn);
}
public function validateDate($date){
+ /* Makes sure the date is valid. */
return ctype_digit($date) && strlen($date) === 8;
}
}
class LogLine{
- private $raw;
+ /* Encapsulates behavior of a line of a log */
+ private $raw; // Raw string
public $time;
- public $type;
+ public $type; // 'speech' or 'action'
public $speaker;
public $text;
@@ -60,20 +63,25 @@ public function __construct($line){
}
private function parse(){
- $pieces = explode(" ", $this->raw, 3);
+ /* Figure out what all the parts are */
+ // We currently assume logs look like:
+ // [12:34] <someguy> This is what I said
+ // TODO: Give constructor a format string (logs won't always be in this format)
+ $pieces = explode(' ', $this->raw, 3);
$this->time = substr($pieces[0], 1, 5);
if ($pieces[1][0] === '<'){
- $this->type = "speech";
+ $this->type = 'speech';
$this->speaker = substr($pieces[1], 1, -1);
$this->text = $pieces[2];
}else{
- $this->type = "action";
+ $this->type = 'action';
$this->speaker = $pieces[1];
$this->text = $pieces[2];
}
}
private function funkify(){
+ /* During development/testing we'll funk up all the text */
if ($this->type === 'speech'){
$arr = range('a', 'z');
$arrb = $arr;
Please sign in to comment.
Something went wrong with that request. Please try again.