예제 #1
0
 /**
  * @param array|string|self $input
  * @return static
  */
 public static function cast($input, callable $escape = null)
 {
     if ($input instanceof self) {
         $input->setEscape($escape);
     } else {
         $input = new static($input, $escape);
     }
     return $input;
 }
예제 #2
0
파일: NavMenu.php 프로젝트: rakorium/okapi
 /**
  * @param array|Attributes $attribs
  * @return Attributes
  */
 protected function attribs($attribs)
 {
     return Attributes::cast($attribs, $this->escape);
 }
예제 #3
0
파일: Form.php 프로젝트: rakorium/okapi
 /**
  * Helper function for the Element nodes
  *
  * @param array $attributes
  * @return string
  */
 public function renderAttr(array $attributes)
 {
     $helper = new Attributes($attributes, $this->escape);
     return $helper->toString();
 }
예제 #4
0
 public function testRender()
 {
     $attr = new Attributes(['href' => '#', 'data-special' => "123"]);
     $exp = ' href="#" data-special="123"';
     $this->assertEquals($exp, $attr->toString());
 }