示例#1
0
 /**
  * @param Placeholder $placeholder
  */
 public function append($placeholder)
 {
     /**
      * @var $thisPlaceholder Placeholder
      */
     foreach ($this as &$thisPlaceholder) {
         if (strtolower($thisPlaceholder->getName()) == strtolower($placeholder->getName())) {
             $thisPlaceholder = $placeholder;
             return;
         }
     }
     parent::append($placeholder);
 }
示例#2
0
 public function testValidate()
 {
     $this->assertTrue(Placeholder::validate("FOO"));
     $this->assertTrue(Placeholder::validate("bar"));
     $this->assertTrue(Placeholder::validate("fooBar"));
     $this->assertTrue(Placeholder::validate("foo-bar"));
     $this->assertTrue(Placeholder::validate("foo_bar"));
     $this->assertFalse(Placeholder::validate("foo+bar"));
     $this->assertFalse(Placeholder::validate("foo~bar"));
     $this->assertFalse(Placeholder::validate("Foo!Bar"));
 }