当前位置: 首页>>代码示例>>PHP>>正文


PHP optional函数代码示例

本文整理汇总了PHP中optional函数的典型用法代码示例。如果您正苦于以下问题:PHP optional函数的具体用法?PHP optional怎么用?PHP optional使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了optional函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: yay_parse

function yay_parse(string $source, Directives $directives = null, BlueContext $blueContext = null) : string
{
    if ($gc = gc_enabled()) {
        gc_disable();
    }
    // important optimization!
    static $globalDirectives = null;
    if (null === $globalDirectives) {
        $globalDirectives = new ArrayObject();
    }
    $directives = $directives ?: new Directives();
    $blueContext = $blueContext ?: new BlueContext();
    $cg = (object) ['ts' => TokenStream::fromSource($source), 'directives' => $directives, 'cycle' => new Cycle($source), 'globalDirectives' => $globalDirectives, 'blueContext' => $blueContext];
    foreach ($cg->globalDirectives as $d) {
        $cg->directives->add($d);
    }
    traverse(midrule(function (TokenStream $ts) use($directives, $blueContext) {
        $token = $ts->current();
        tail_call:
        if (null === $token) {
            return;
        }
        // skip when something looks like a new macro to be parsed
        if ('macro' === (string) $token) {
            return;
        }
        // here we do the 'magic' to match and expand userland macros
        $directives->apply($ts, $token, $blueContext);
        $token = $ts->next();
        goto tail_call;
    }), consume(chain(token(T_STRING, 'macro')->as('declaration'), optional(repeat(rtoken('/^·\\w+$/')))->as('tags'), lookahead(token('{')), commit(chain(braces()->as('pattern'), operator('>>'), braces()->as('expansion')))->as('body'), optional(token(';'))), CONSUME_DO_TRIM)->onCommit(function (Ast $macroAst) use($cg) {
        $scope = Map::fromEmpty();
        $tags = Map::fromValues(array_map('strval', $macroAst->{'tags'}));
        $pattern = new Pattern($macroAst->{'declaration'}->line(), $macroAst->{'body pattern'}, $tags, $scope);
        $expansion = new Expansion($macroAst->{'body expansion'}, $tags, $scope);
        $macro = new Macro($tags, $pattern, $expansion, $cg->cycle);
        $cg->directives->add($macro);
        // allocate the userland macro
        // allocate the userland macro globally if it's declared as global
        if ($macro->tags()->contains('·global')) {
            $cg->globalDirectives[] = $macro;
        }
    }))->parse($cg->ts);
    $expansion = (string) $cg->ts;
    if ($gc) {
        gc_enable();
    }
    return $expansion;
}
开发者ID:lastguest,项目名称:yay,代码行数:49,代码来源:yay_parse.php

示例2: testBatchSendReturnCummulativeSendCount

 public function testBatchSendReturnCummulativeSendCount()
 {
     $transport = $this->_createTransport();
     $message = $this->_createMessage();
     $this->_checking(Expectations::create()->allowing($message)->getTo()->returns(array('one@domain.com' => 'One', 'two@domain.com' => 'Two', 'three@domain.com' => 'Three'))->one($message)->setTo(array('one@domain.com' => 'One'))->one($message)->setTo(array('two@domain.com' => 'Two'))->one($message)->setTo(array('three@domain.com' => 'Three'))->one($message)->setTo(array('one@domain.com' => 'One', 'two@domain.com' => 'Two', 'three@domain.com' => 'Three'))->one($transport)->send($message, optional())->returns(1)->one($transport)->send($message, optional())->returns(0)->one($transport)->send($message, optional())->returns(1)->ignoring($transport)->ignoring($message));
     $mailer = $this->_createMailer($transport);
     $this->assertEqual(2, $mailer->batchSend($message));
 }
开发者ID:Fyflon,项目名称:MTA-XyzzyRP,代码行数:8,代码来源:MailerTest.php

示例3: testSendReturnsCountFromTransport

 public function testSendReturnsCountFromTransport()
 {
     $transport = $this->_createTransport();
     $message = $this->_createMessage();
     $this->_checking(Expectations::create()->one($transport)->send($message, optional())->returns(57)->ignoring($transport)->ignoring($message));
     $mailer = $this->_createMailer($transport);
     $this->assertEqual(57, $mailer->send($message));
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:8,代码来源:MailerTest.php

示例4: testByteStreamAndStringCanBeAppended

 public function testByteStreamAndStringCanBeAppended()
 {
     $os = $this->_createOutputStream();
     $this->_checking(Expectations::create()->one($os)->read(optional())->returns('abc')->one($os)->read(optional())->returns('def')->one($os)->read(optional())->returns(false)->ignoring($os));
     $is = $this->_createKeyCacheInputStream(true);
     $cache = $this->_createCache($is);
     $cache->setString($this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND);
     $cache->importFromByteStream($this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND);
     $this->assertEqual('testabcdef', $cache->getString($this->_key1, 'foo'));
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:10,代码来源:ArrayKeyCacheTest.php

示例5: compile

 private function compile(array $tokens)
 {
     $cg = (object) ['ts' => TokenStream::fromSlice($tokens), 'parsers' => []];
     traverse(rtoken('/^(T_\\w+)·(\\w+)$/')->onCommit(function (Ast $result) use($cg) {
         $token = $result->token();
         $id = $this->lookupCapture($token);
         $type = $this->lookupTokenType($token);
         $cg->parsers[] = token($type)->as($id);
     }), ($parser = chain(rtoken('/^·\\w+$/')->as('type'), token('('), optional(ls(either(future($parser)->as('parser'), chain(token(T_FUNCTION), parentheses()->as('args'), braces()->as('body'))->as('function'), string()->as('string'), rtoken('/^T_\\w+·\\w+$/')->as('token'), rtoken('/^T_\\w+$/')->as('constant'), rtoken('/^·this$/')->as('this'), label()->as('label'))->as('parser'), token(',')))->as('args'), commit(token(')')), optional(rtoken('/^·\\w+$/')->as('label'), null)))->onCommit(function (Ast $result) use($cg) {
         $cg->parsers[] = $this->compileParser($result->type, $result->args, $result->label);
     }), $this->layer('{', '}', braces(), $cg), $this->layer('[', ']', brackets(), $cg), $this->layer('(', ')', parentheses(), $cg), rtoken('/^···(\\w+)$/')->onCommit(function (Ast $result) use($cg) {
         $id = $this->lookupCapture($result->token());
         $cg->parsers[] = layer()->as($id);
     }), token(T_STRING, '·')->onCommit(function (Ast $result) use($cg) {
         $offset = \count($cg->parsers);
         if (0 !== $this->dominance || 0 === $offset) {
             $this->fail(self::E_BAD_DOMINANCE, $offset, $result->token()->line());
         }
         $this->dominance = $offset;
     }), rtoken('/·/')->onCommit(function (Ast $result) {
         $token = $result->token();
         $this->fail(self::E_BAD_CAPTURE, $token, $token->line());
     }), any()->onCommit(function (Ast $result) use($cg) {
         $cg->parsers[] = token($result->token());
     }))->parse($cg->ts);
     // check if macro dominance '·' is last token
     if ($this->dominance === \count($cg->parsers)) {
         $this->fail(self::E_BAD_DOMINANCE, $this->dominance, $cg->ts->last()->line());
     }
     $this->specificity = \count($cg->parsers);
     if ($this->specificity > 1) {
         if (0 === $this->dominance) {
             $pattern = chain(...$cg->parsers);
         } else {
             /*
               dominat macros are partially wrapped in commit()s and dominance
               is the offset used as the 'event horizon' point... once the entry
               point is matched, there is no way back and a parser error arises
             */
             $prefix = array_slice($cg->parsers, 0, $this->dominance);
             $suffix = array_slice($cg->parsers, $this->dominance);
             $pattern = chain(...array_merge($prefix, array_map(commit::class, $suffix)));
         }
     } else {
         /*
           micro optimization to save one function call for every token on the subject
           token stream whenever the macro pattern consists of a single parser
         */
         $pattern = $cg->parsers[0];
     }
     return $pattern;
 }
开发者ID:lastguest,项目名称:yay,代码行数:52,代码来源:Pattern.php

示例6: testFirstLineCanHaveShorterLength

 public function testFirstLineCanHaveShorterLength()
 {
     $charStream = $this->_mock('Swift_CharacterStream');
     $seq = $this->_sequence('byte-sequence');
     $string = '';
     for ($x = 0; $x < 200; ++$x) {
         $char = 'a';
         $string .= $char;
         $this->_checking(Expectations::create()->one($charStream)->read(optional())->inSequence($seq)->returns($char));
     }
     $this->_checking(Expectations::create()->atLeast(1)->of($charStream)->read(optional())->inSequence($seq)->returns(false)->one($charStream)->importString($string)->ignoring($charStream)->flushContents());
     $encoder = new Swift_Encoder_Rfc2231Encoder($charStream);
     $encoded = $encoder->encodeString($string, 25, 75);
     $this->assertEqual(str_repeat('a', 50) . "\r\n" . str_repeat('a', 75) . "\r\n" . str_repeat('a', 75), $encoded, '%s: First line should be 25 bytes shorter than the others.');
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:15,代码来源:Rfc2231EncoderTest.php

示例7: _createFileStream

 protected function _createFileStream($path, $data, $stub = true)
 {
     $file = $this->_mock('Swift_FileStream');
     $pos = $this->_mockery()->states('position')->startsAs('at start');
     $this->_checking(Expectations::create()->ignoring($file)->getPath()->returns($path)->ignoring($file)->read(optional())->returns($data)->when($pos->isNot('at end'))->then($pos->is('at end'))->ignoring($file)->read(optional())->returns(false));
     if ($stub) {
         $this->_checking(Expectations::create()->ignoring($file));
     }
     return $file;
 }
开发者ID:Nyaan,项目名称:meintagebuchonline,代码行数:10,代码来源:AttachmentTest.php

示例8: testCanonicEncodeByteStreamGeneratesCorrectCrlf_5

 public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_5()
 {
     $encoder = $this->_getEncoder('7bit', true);
     $os = $this->_createOutputByteStream();
     $is = $this->_createInputByteStream();
     $collection = new Swift_StreamCollector();
     $this->_checking(Expectations::create()->allowing($is)->write(any(), optional())->will($collection)->ignoring($is)->one($os)->read(optional())->returns('a')->one($os)->read(optional())->returns("\r\r")->one($os)->read(optional())->returns('b')->allowing($os)->read(optional())->returns(false)->ignoring($os));
     $encoder->encodeByteStream($os, $is);
     $this->assertEqual("a\r\n\r\nb", $collection->content);
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:10,代码来源:PlainContentEncoderTest.php

示例9: jumpMenu

}
function jumpMenu() { 
	var newIndex = document.sizejumpform.sizejump.selectedIndex; 
	cururl = document.sizejumpform.sizejump.options[ newIndex ].value; 
	window.location.assign( cururl );
}

$(function() {
	$("#synctoserver").click(function() {
		syncPlaylist();
	});
});
-->
</script>
<div id="box" style="width:<?php 
echo optional($opt["width"], $cfg["media-player"]["default-width"]) + 300;
?>
px;height:480px;">
	<?php 
include 'modules/media/player.php';
?>
	<?php 
include 'modules/media/browser.php';
?>
	<div id="mediasettings">
		<label for="synctoserver"><input id="synctoserver" name="synctoserver" type="checkbox" value="1" /> Sync to Server</label>&nbsp;&nbsp;
		<form name="sizejumpform" action="media.php">
			<select name="sizejump" onchange="jumpMenu()">
				<option value="media.php?width=720&amp;height=480" <?php 
if ($opt["width"] == 720) {
    echo "selected";
开发者ID:DevdutttaBain,项目名称:nanoserv,代码行数:31,代码来源:media.php

示例10: testFirstLineLengthCanBeDifferent

 public function testFirstLineLengthCanBeDifferent()
 {
     $os = $this->_createOutputByteStream();
     $is = $this->_createInputByteStream();
     $collection = new Swift_StreamCollector();
     $this->_checking(Expectations::create()->allowing($is)->write(any(), optional())->will($collection)->ignoring($is)->one($os)->read(optional())->returns('abcdefghijkl')->one($os)->read(optional())->returns('mnopqrstuvwx')->one($os)->read(optional())->returns('yzabc1234567')->one($os)->read(optional())->returns('890ABCDEFGHI')->one($os)->read(optional())->returns('JKLMNOPQRSTU')->one($os)->read(optional())->returns('VWXYZ1234567')->one($os)->read(optional())->returns('abcdefghijkl')->allowing($os)->read(optional())->returns(false)->ignoring($os));
     $this->_encoder->encodeByteStream($os, $is, 19);
     $this->assertEqual("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDR\r\n" . "EVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts", $collection->content);
 }
开发者ID:Nyaan,项目名称:meintagebuchonline,代码行数:9,代码来源:Base64ContentEncoderTest.php

示例11: testRestartingTransportRestartsDeadDelegates

 public function testRestartingTransportRestartsDeadDelegates()
 {
     $e = new Swift_TransportException('b0rken');
     $context = new Mockery();
     $message1 = $context->mock('Swift_Mime_Message');
     $message2 = $context->mock('Swift_Mime_Message');
     $t1 = $context->mock('Swift_Transport');
     $t2 = $context->mock('Swift_Transport');
     $con1 = $context->states('Connection')->startsAs('off');
     $con2 = $context->states('Connection')->startsAs('off');
     $context->checking(Expectations::create()->ignoring($message1)->ignoring($message2)->allowing($t1)->isStarted()->returns(false)->when($con1->is('off'))->allowing($t1)->isStarted()->returns(true)->when($con1->is('on'))->exactly(2)->of($t1)->start()->when($con1->isNot('on'))->then($con1->is('on'))->one($t1)->send($message1, optional())->throws($e)->when($con1->is('on'))->then($con1->is('off'))->one($t1)->send($message2, optional())->returns(10)->when($con1->is('on'))->ignoring($t1)->allowing($t2)->isStarted()->returns(false)->when($con2->is('off'))->allowing($t2)->isStarted()->returns(true)->when($con2->is('on'))->one($t2)->start()->when($con2->isNot('on'))->then($con2->is('on'))->one($t2)->send($message1, optional())->throws($e)->when($con2->is('on'))->never($t2)->send($message2, optional())->ignoring($t2));
     $transport = $this->_getTransport(array($t1, $t2));
     $transport->start();
     $this->assertTrue($transport->isStarted());
     try {
         $transport->send($message1);
         $this->fail('All transports failed so Exception should be thrown');
     } catch (Exception $e) {
         $this->assertFalse($transport->isStarted());
     }
     //Restart and re-try
     $transport->start();
     $this->assertTrue($transport->isStarted());
     $this->assertEqual(10, $transport->send($message2));
     $context->assertIsSatisfied();
 }
开发者ID:Nyaan,项目名称:meintagebuchonline,代码行数:26,代码来源:FailoverTransportTest.php

示例12: mutate

 private function mutate(TokenStream $ts, Ast $context, Cycle $cycle, Directives $directives, BlueContext $blueContext) : TokenStream
 {
     if ($this->constant) {
         return $ts;
     }
     static $states, $parser;
     $states = $states ?? new Stack();
     $parser = $parser ?? traverse(token(Token::CLOAKED), consume(chain(rtoken('/^··\\w+$/')->as('expander'), either(parentheses(), braces())->as('args')))->onCommit(function (Ast $result) use($states) {
         $cg = $states->current();
         $expander = $result->expander;
         if (\count($result->args) === 0) {
             $cg->this->fail(self::E_EMPTY_EXPANDER_SLICE, (string) $expander, $expander->line());
         }
         $context = Map::fromKeysAndValues(['scope' => $cg->cycle->id(), 'directives' => $cg->directives, 'blueContext' => $cg->blueContext]);
         $expansion = TokenStream::fromSlice($result->args);
         $mutation = $cg->this->mutate(clone $expansion, $cg->context, $cg->cycle, $cg->directives, $cg->blueContext);
         $mutation = $cg->this->lookupExpander($expander)($mutation, $context);
         $cg->ts->inject($mutation);
     }), consume(chain(rtoken('/^·\\w+|···\\w+$/')->as('label'), operator('···'), optional(parentheses()->as('delimiters')), braces()->as('expansion')))->onCommit(function (Ast $result) use($states) {
         $cg = $states->current();
         $context = $cg->this->lookupContext($result->label, $cg->context, self::E_UNDEFINED_EXPANSION);
         $expansion = TokenStream::fromSlice($result->expansion);
         $delimiters = $result->delimiters;
         // normalize single context
         if (array_values($context) !== $context) {
             $context = [$context];
         }
         foreach (array_reverse($context) as $i => $subContext) {
             $mutation = $cg->this->mutate(clone $expansion, (new Ast(null, $subContext))->withParent($cg->context), $cg->cycle, $cg->directives, $cg->blueContext);
             if ($i !== 0) {
                 foreach ($delimiters as $d) {
                     $mutation->push($d);
                 }
             }
             $cg->ts->inject($mutation);
         }
     }), consume(rtoken('/^(T_\\w+·\\w+|·\\w+|···\\w+)$/')->as('label'))->onCommit(function (Ast $result) use($states) {
         $cg = $states->current();
         $context = $cg->this->lookupContext($result->label, $cg->context, self::E_UNDEFINED_EXPANSION);
         if ($context instanceof Token) {
             $cg->ts->inject(TokenStream::fromSequence($context));
         } elseif (is_array($context) && \count($context)) {
             $tokens = [];
             array_walk_recursive($context, function (Token $token) use(&$tokens) {
                 $tokens[] = $token;
             });
             $cg->ts->inject(TokenStream::fromSlice($tokens));
         }
     }));
     $cg = (object) ['ts' => $ts, 'context' => $context, 'directives' => $directives, 'cycle' => $cycle, 'this' => $this, 'blueContext' => $blueContext];
     $states->push($cg);
     $parser->parse($cg->ts);
     $states->pop();
     $cg->ts->reset();
     if ($this->cloaked) {
         traverse(consume(token(Token::CLOAKED))->onCommit(function (Ast $result) use($cg) {
             $cg->ts->inject(TokenStream::fromSourceWithoutOpenTag((string) $result->token()));
         }))->parse($cg->ts);
         $cg->ts->reset();
     }
     return $cg->ts;
 }
开发者ID:lastguest,项目名称:yay,代码行数:62,代码来源:Expansion.php

示例13: compilePattern

 private function compilePattern(int $line, array $tokens) : Parser
 {
     if (!$tokens) {
         $this->fail(self::E_EMPTY_PATTERN, $line);
     }
     $ts = TokenStream::fromSlice($tokens);
     traverse(either(consume(chain(token(T_NS_SEPARATOR), token(T_NS_SEPARATOR), parentheses()->as('cloaked')))->onCommit(function (Ast $result) use($ts) {
         $ts->inject(TokenStream::fromSequence(...$result->cloaked));
         $ts->skip(...TokenStream::SKIPPABLE);
     }), rtoken('/^(T_\\w+)·(\\w+)$/')->onCommit(function (Ast $result) {
         $token = $result->token();
         $id = $this->lookupCapture($token);
         $type = $this->lookupTokenType($token);
         $this->parsers[] = token($type)->as($id);
     }), ($parser = chain(rtoken('/^·\\w+$/')->as('parser_type'), token('('), optional(ls(either(future($parser)->as('parser'), string()->as('string'), rtoken('/^T_\\w+·\\w+$/')->as('token'), rtoken('/^T_\\w+$/')->as('constant'), word()->as('word')), token(',')))->as('args'), commit(token(')')), optional(rtoken('/^·\\w+$/')->as('label'))))->onCommit(function (Ast $result) {
         $this->parsers[] = $this->compileParser($result->array());
     }), $this->layer('{', '}', braces()), $this->layer('[', ']', brackets()), $this->layer('(', ')', parentheses()), rtoken('/^···(\\w+)$/')->onCommit(function (Ast $result) {
         $id = $this->lookupCapture($result->token());
         $this->parsers[] = layer()->as($id);
     }), token(T_STRING, '·')->onCommit(function (Ast $result) use($ts) {
         $offset = \count($this->parsers);
         if (0 !== $this->dominance || 0 === $offset) {
             $this->fail(self::E_BAD_DOMINANCE, $offset, $result->token()->line());
         }
         $this->dominance = $offset;
     }), rtoken('/·/')->onCommit(function (Ast $result) {
         $token = $result->token();
         $this->fail(self::E_BAD_CAPTURE, $token, $token->line());
     }), any()->onCommit(function (Ast $result) {
         $this->parsers[] = token($result->token());
     })))->parse($ts);
     // check if macro dominance '·' is last token
     if ($this->dominance === \count($this->parsers)) {
         $this->fail(self::E_BAD_DOMINANCE, $this->dominance, $ts->last()->line());
     }
     $this->specificity = \count($this->parsers);
     if ($this->specificity > 1) {
         if (0 === $this->dominance) {
             $pattern = chain(...$this->parsers);
         } else {
             /*
               dominat macros are partially wrapped in commit()s and dominance
               is the offset used as the 'event horizon' point... once the entry
               point is matched, there is no way back and a parser error arises
             */
             $prefix = array_slice($this->parsers, 0, $this->dominance);
             $suffix = array_slice($this->parsers, $this->dominance);
             $pattern = chain(...array_merge($prefix, array_map(commit::class, $suffix)));
         }
     } else {
         /*
           micro optimization to save one function call for every token on the subject
           token stream whenever the macro pattern consists of a single parser
         */
         $pattern = $this->parsers[0];
     }
     return $pattern;
 }
开发者ID:assertchris,项目名称:yay,代码行数:58,代码来源:Macro.php

示例14: fetch_phpbb2

    //lets see if we need to begin the install of phpBB2.
    if (isset($HTTP_POST_VARS['install_phpbb2'])) {
        fetch_phpbb2();
    }
    printf("<BR><BR>Your site should now be running FishCMS.  For security reasons you");
    printf(" must now delete the install directory.  If you are installing phpBB2 from");
    printf(" FishCMS you should follow the instructions in the phpBB2 installer regarding");
    printf(" deleting directories and setting permissions.<BR>");
}
//===Main code================================================================
//lets write the header.
install_header();
//now we will perform the install steps.
if (!isset($HTTP_GET_VARS['mode'])) {
    pre_install();
} elseif ($HTTP_GET_VARS['mode'] == "selectdb") {
    selectdb();
} elseif ($HTTP_GET_VARS['mode'] == "selectauth") {
    selectauth();
} elseif ($HTTP_GET_VARS['mode'] == "siteconfig") {
    siteconfig();
} elseif ($HTTP_GET_VARS['mode'] == "optional") {
    optional();
} elseif ($HTTP_GET_VARS['mode'] == "finalize") {
    finalize();
}
/*   else
      unknown ();
*/
//now we write the footer.
install_footer();
开发者ID:BackupTheBerlios,项目名称:fishcms-svn,代码行数:31,代码来源:install.php

示例15: testastNestedAst

 function testastNestedAst()
 {
     $ts = TokenStream::fromSource('<?php
         interface Foo
         {
             public abstract function foo();
             public abstract static function bar();
             function baz();
         }
     ');
     $modifier = either(token(T_PUBLIC), token(T_STATIC), token(T_PRIVATE));
     $modifiers = optional(either(chain($modifier, $modifier), $modifier));
     $ast = chain(token(T_OPEN_TAG), chain(token(T_INTERFACE), token(T_STRING)->as('name'), token('{'), optional(repeat(chain(optional(either(repeat(either(token(T_PUBLIC)->as('public'), token(T_STATIC)->as('static'), token(T_ABSTRACT)->as('abstract'))), always(new Token(T_PUBLIC, 'public'))->as('public')))->as('is'), token(T_FUNCTION), token(T_STRING)->as('name'), token('('), token(')'), token(';')), token('}')))->as('methods'), token('}'))->as('interface'))->parse($ts);
     $this->assertEquals('Foo', (string) $ast->{'interface name'});
     $this->assertEquals('foo', (string) $ast->{'interface methods 0 name'});
     $this->assertEquals('public', (string) $ast->{'interface methods 0 is public'});
     $this->assertEquals('abstract', (string) $ast->{'interface methods 0 is abstract'});
     $this->assertEmpty($ast->{'interface methods 0 is static'});
     $this->assertEquals('bar', (string) $ast->{'interface methods 1 name'});
     $this->assertEquals('public', (string) $ast->{'interface methods 1 is public'});
     $this->assertEquals('abstract', (string) $ast->{'interface methods 1 is abstract'});
     $this->assertEquals('static', (string) $ast->{'interface methods 1 is static'});
     $this->assertEquals('baz', (string) $ast->{'interface methods 2 name'});
     $this->assertEquals('public', (string) $ast->{'interface methods 2 is public'});
     $this->assertNull($ast->{'interface methods 2 is abstract'});
     $this->assertNull($ast->{'interface methods 2 is static'});
 }
开发者ID:assertchris,项目名称:yay,代码行数:27,代码来源:ParserTest.php


注:本文中的optional函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。