Permalink
Browse files

[DMS] Adding documentation, build.xml phing file and updating ignores

[Filter] Fixing documentation for Exceptions and adding Version class for version tracking
  • Loading branch information...
1 parent 3297ef2 commit 8bfbd3f809d3390a9f2aea90fcb36cb806147cd3 @rdohms committed Jul 21, 2011
@@ -2,6 +2,13 @@
namespace DMS\Filter\Exception;
+/**
+ * Base Exception for Filter Package
+ *
+ * @package DMS
+ * @subpackage Filter
+ * @category Exception
+ */
class FilterException extends \RuntimeException
{
@@ -2,6 +2,13 @@
namespace DMS\Filter\Exception;
+/**
+ * Invalid option passed to rule
+ *
+ * @package DMS
+ * @subpackage Filter
+ * @category Exception
+ */
class InvalidOptionsException extends RuleOptionsException
{
@@ -2,6 +2,13 @@
namespace DMS\Filter\Exception;
+/**
+ * Required options were not passed to rule
+ *
+ * @package DMS
+ * @subpackage Filter
+ * @category Exception
+ */
class MissingOptionsException extends RuleOptionsException
{
@@ -2,6 +2,13 @@
namespace DMS\Filter\Exception;
+/**
+ * Malformed Rule definition
+ *
+ * @package DMS
+ * @subpackage Filter
+ * @category Exception
+ */
class RuleDefinitionException extends FilterException
{
@@ -2,17 +2,38 @@
namespace DMS\Filter\Exception;
+/**
+ * Base Exception for errors with rule options
+ *
+ * @package DMS
+ * @subpackage Filter
+ * @category Exception
+ */
class RuleOptionsException extends FilterException
{
+ /**
+ * @var array
+ */
private $options;
+ /**
+ * Constructor
+ *
+ * @param string $message
+ * @param array $options
+ */
public function __construct($message, array $options)
{
parent::__construct($message);
$this->options = $options;
}
+ /**
+ * Retrieve options that triggered exception
+ *
+ * @return array
+ */
public function getOptions()
{
return $this->options;
View
@@ -0,0 +1,29 @@
+<?php
+
+namespace DMS\Filter;
+
+/**
+ * Holds version information for the Filter package
+ *
+ * @package DMS
+ * @subpackage Filter
+ */
+class Version
+{
+ const VERSION = "0.1-DEV";
+
+ /**
+ * Compares a version with the current one.
+ *
+ * @param string $version Version to compare.
+ * @return int Returns -1 if older, 0 if it is the same, 1 if version
+ * passed as argument is newer.
+ */
+ public static function compare($version)
+ {
+ $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
+ $version = str_replace(' ', '', $version);
+
+ return version_compare($version, $currentVersion);
+ }
+}

0 comments on commit 8bfbd3f

Please sign in to comment.