Example #1
0
 protected function __construct()
 {
     $this->array = ArrayUtils::instance();
     $this->file = FileUtils::instance();
     $this->object = ObjectUtils::instance();
     $this->string = StringUtils::instance();
 }
Example #2
0
 function testIsNull()
 {
     $null = null;
     // valid true values
     $this->assertTrue(ObjectUtils::isNull(null));
     $this->assertTrue(ObjectUtils::isNull(NULL));
     $this->assertTrue(ObjectUtils::isNull($this->notInitialized));
     $this->assertTrue(ObjectUtils::isNull($null));
     // valid false values
     $this->assertFalse(ObjectUtils::isNull(false));
     $this->assertFalse(ObjectUtils::isNull(0));
 }
Example #3
0
 /**
  * Get boolean value for key. This is the same as get() but attempts to
  * cast the value too boolean for convenience.
  *
  * @param string $key Key to message you're looking for.
  * @param boolean $default Default value if key was not found.
  *
  * @throws Exception if the property or default could not be cast to
  * boolean.
  */
 public function getBool($key, $default = NULL)
 {
     $value = self::get($key, $default, FALSE);
     try {
         return ObjectUtils::toBoolean($value);
     } catch (Exception $e) {
         throw new Exception("The property found, " . $value . ", with the key \"" . $key . "\" could not be converted to a boolean value in the file \"" . $this->file . "\".");
     }
 }