コード例 #1
0
ファイル: AbstractUiExampleView.php プロジェクト: fortifi/ui
 /**
  * @return ISafeHtmlProducer
  */
 public function render()
 {
     $output = new Div();
     $groups = $this->getMethods();
     foreach ($groups as $group => $methods) {
         $output->appendContent(Div::create(new HeadingOne(Strings::titleize($group)))->addClass('content-container'));
         foreach ($methods as $method) {
             $reflect = new \ReflectionMethod($this, $method);
             $parsed = DocBlockParser::fromMethod($this, $method);
             $code = $this->_getCode($reflect);
             $id = Strings::randomString(4);
             $toggledCode = new Div();
             $toggledCode->appendContent(new HeadingFour((new Link('#', Strings::titleize($method)))->setAttribute('onclick', '$(\'#code-' . $id . '\')' . '.toggleClass(\'' . Ui::HIDE . '\');' . 'return false;')));
             $code = new SafeHtml(str_replace('<span style="color: #0000BB">&lt;?php&nbsp;</span>', '', highlight_string('<?php ' . $code, true)));
             $toggledCode->appendContent(Div::create()->appendContent(HtmlTag::createTag('pre', [], $code))->addClass(Ui::HIDE)->setId('code-' . $id));
             $methRow = Div::create()->addClass('content-container');
             $methRow->appendContent($toggledCode);
             $methRow->appendContent(new Paragraph($parsed->getSummary()));
             $methRow->appendContent($this->{$method}());
             $output->appendContent($methRow);
         }
     }
     return $output;
 }
コード例 #2
0
 public function testFromMethod()
 {
     $bloc = \Packaged\DocBlock\DocBlockParser::fromMethod(new DocBlockFiller(), 'getProperty');
     $this->assertTrue($bloc->hasTag('return'));
 }