/** * This test checks the Strng's equal method. * * @return void */ public function testEquals() { // initialize a new Strng instance $string = new Strng('Mustermann'); // check that the two Strng's are equal $this->assertTrue($string->equals(new Strng('Mustermann'))); }
/** * Returns a Boolean with a value represented by the specified String. * * If the passed string has the primitive value TRUE or 1 then the * returned object is initialized with the primitive value TRUE else * with FALSE. * * @param \AppserverIo\Lang\Strng $string Holds the String object to get the Boolean representation for * * @return \AppserverIo\Lang\Boolean The Boolean object representing the specified String. */ public static function valueOf(Strng $string) { // if the passed value is "true" or "1" then return a new Boolean // object initialized with true if ($string->equals(new Strng("1")) || $string->equals(new Strng("true")) || $string->equals(new Strng("yes")) || $string->equals(new Strng("on")) || $string->equals(new Strng("y"))) { return new Boolean(true); } // else return a new Boolean object initialized with false return new Boolean(false); }