Permalink
Browse files

Adding boolean property type

git-svn-id: http://mongodb-morph.googlecode.com/svn/trunk@137 406649b4-5d4b-11de-8abc-d1c337b90d21
  • Loading branch information...
1 parent d4fc24d commit 44f63273d9188f839917c7660b805fe389931c75 XirisR committed Mar 24, 2010
Showing with 60 additions and 0 deletions.
  1. +60 −0 mongodb-morph/src/Morph/Property/Boolean.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * @package Morph
+ * @subpackage Property
+ * @author Jonathan Moss <xirisr@gmail.com>
+ * @copyright Jonathan Moss 2009
+ */
+
+/**
+ * Class to represent an boolean property
+ *
+ * @package Morph
+ * @subpackage Property
+ */
+class Morph_Property_Boolean extends Morph_Property_Generic
+{
+
+ /**
+ * The minimum allowed value
+ * @var integer
+ */
+ protected $Minimum;
+
+ /**
+ * The maximum allowed value
+ * @var integer
+ */
+ protected $Maximum;
+
+ /**
+ * @param string $name
+ * @param boolean $default
+ */
+ public function __construct($name, $default = null){
+ if (!is_null($default)) {
+ $default = (boolean)$default;
+ }
+ parent::__construct($name, $default);
+ }
+
+ /**
+ * Sets the value of this attribute
+ *
+ * @param boolean $Value
+ */
+ public function setValue($value){
+ $cleanValue = (boolean)$value;
+ parent::setValue($cleanValue);
+ }
+
+ /**
+ * Returns this attributes value
+ *
+ * @return boolean
+ */
+ public function getValue(){
+ return (boolean)parent::getValue();
+ }
+
+}

0 comments on commit 44f6327

Please sign in to comment.