Example #1
0
 public function compare(Charcoal_Object $object)
 {
     if ($object instanceof Charcoal_Number) {
         return $this->value > $object->value;
     }
     return parent::equals($object);
 }
Example #2
0
 /**
  *    Constructor
  *
  *    @param mixed $value        boolean value to set
  */
 public function __construct($value = self::DEFAULT_VALUE)
 {
     parent::__construct();
     if ($value === TRUE || $value === FALSE) {
         $this->value = $value;
     } elseif ($value instanceof Charcoal_Boolean) {
         $this->value = $value->unbox();
     } elseif ($value === NULL) {
         $value = FALSE;
     } else {
         _throw(new Charcoal_NonBooleanException($value));
     }
 }
Example #3
0
 /**
  *    Constructor
  */
 public function __construct($value = self::DEFAULT_VALUE, $encoding = NULL)
 {
     parent::__construct();
     $this->is_mb = extension_loaded('mbstring');
     if ($this->is_mb) {
         $this->mb_encoding = $encoding ? $encoding : mb_internal_encoding();
     }
     if (is_string($value)) {
         $this->value = $value;
     } elseif ($value instanceof Charcoal_String) {
         $this->value = $value->unbox();
     } elseif ($value instanceof Charcoal_Object) {
         $this->value = $value->toString();
     } elseif (is_scalar($value)) {
         $this->value = strval($value);
     } elseif ($value === NULL) {
         $this->value = '';
     } else {
         _throw(new Charcoal_NonStringException($value));
     }
 }