Swagger\StaticAnalyser::fromCode PHP Метод

fromCode() публичный Метод

Extract and process all doc-comments from the contents.
public fromCode ( string $code, Context $context ) : Analysis
$code string PHP code. (including
$context Context The original location of the contents.
Результат Analysis
    public function fromCode($code, $context)
    {
        $tokens = token_get_all($code);
        return $this->fromTokens($tokens, $context);
    }

Usage Example

Пример #1
0
 public function testWrongCommentType()
 {
     $analyser = new StaticAnalyser();
     $this->assertSwaggerLogEntryStartsWith('Annotations are only parsed inside `/**` DocBlocks');
     $analyser->fromCode("<?php\n/*\n * @SWG\\Parameter() */", new Context([]));
 }