changeset 74:1d5166aba2c5

Documentation fixes. codeFromHeader now throws an exception if the header is malformed.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Fri, 12 Oct 2012 01:16:30 +0200
parents 947d53f95ccd
children 5e76b6feb2ad
files FileCacheSet.inc Sitemap.inc StatusCodes.inc sitemap.php
diffstat 4 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/FileCacheSet.inc	Fri Oct 12 01:06:32 2012 +0200
+++ b/FileCacheSet.inc	Fri Oct 12 01:16:30 2012 +0200
@@ -37,7 +37,7 @@
   /**
    * List a set of files which contributes to this pages cacheset.
    *
-   * @param $humanReadable If the timestamp should be humand readable.
+   * @param $humanReadable If the timestamp should be human readable.
    *
    * @return an associative array of file, and timestamp
    */
--- a/Sitemap.inc	Fri Oct 12 01:06:32 2012 +0200
+++ b/Sitemap.inc	Fri Oct 12 01:16:30 2012 +0200
@@ -8,11 +8,19 @@
 $cache->includeOnce('Options.inc', dirname(__FILE__));
 /// @endcond
 
+/**
+ * Functionality for generating a sitemap
+ */
 class Sitemap
 {
   private $master;
   private $options;
 
+  /**
+   * Constructs a sitemap object from a master document
+   *
+   * @param $path location of master document
+   */
   function __construct($path) {
     $this->master = new DOMDocument();
     $this->master->load($path);
--- a/StatusCodes.inc	Fri Oct 12 01:06:32 2012 +0200
+++ b/StatusCodes.inc	Fri Oct 12 01:16:30 2012 +0200
@@ -294,12 +294,16 @@
   }
 
   /**
+   * Extract the numeric code from a header
    *
+   * @param $header an http top header
    */
   public static function codeFromHeader($header)
   {
     $matches = array();
     preg_match('/HTTP\/\S+\s(\d+)/', $header, $matches);
+    if ($matches->length < 1)
+      throw new Exception("Not an http header");
     $n = $matches[1];
     return $n;
   }
--- a/sitemap.php	Fri Oct 12 01:06:32 2012 +0200
+++ b/sitemap.php	Fri Oct 12 01:16:30 2012 +0200
@@ -10,8 +10,8 @@
 $baseDir = dirname(__FILE__);
 $cache = ScriptIncludeCache::instance(__FILE__);
 $cache->includeOnce('Sitemap.inc', dirname(__FILE__));
-/// @endcond
 
 $sitemap = new Sitemap("master.xml");
 $sitemap->genPage();
+/// @endcond
 ?>