本文整理汇总了PHP中Token::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::__toString方法的具体用法?PHP Token::__toString怎么用?PHP Token::__toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::__toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testReadAccessorsReturnPropertiesValues
public function testReadAccessorsReturnPropertiesValues()
{
$value = 'bob';
$type = new TokenType(TokenType::DYNAMIC_ARRAY_TYPE);
$token = new Token($value, $type);
$this->assertEquals($value, $token->getValue());
$this->assertEquals($type->getValue(), $token->getType());
$this->assertEquals('(DYNAMIC_ARRAY_TYPE) bob', $token->__toString());
}
示例2: testToString
public function testToString()
{
$p = new Position(5, 10);
$t = new Token(Token::IDENTIFIER, "ident", $p);
$this->assertEquals("<'ident', IDENTIFIER, (5, 10)>", $t->__toString());
$p = new Position(5, 10, "/foo/bar.ebnf");
$t = new Token(Token::IDENTIFIER, "ident", $p);
$this->assertEquals("<'ident', IDENTIFIER, /foo/bar.ebnf (5, 10)>", $t->__toString());
$p = new Position(5, 10, "/foo/bar.ebnf");
$t = new Token(Token::IDENTIFIER, "", $p);
$this->assertEquals("<IDENTIFIER, /foo/bar.ebnf (5, 10)>", $t->__toString());
$p = new Position(5, 10, "/foo/bar.ebnf");
$t = new Token(Token::IDENTIFIER, "a-very-very-very-very-long-identifier", $p);
$this->assertEquals("<'a-very-very-ver...', IDENTIFIER, /foo/bar.ebnf (5, 10)>", $t->__toString());
}
示例3: go
/**
* Main function: does the backup
*/
private function go()
{
$this->phpflickr = new oPhpFlickr($this->appid, $this->secret, true);
// Check for Flickr username
if ($this->flickr_username != false) {
$this->dialog->info(1, "Looking for Flickr id for username {$this->flickr_username}");
$r = $this->phpflickr->people_findByUsername($this->flickr_username);
$this->flickr_id = $r['nsid'];
}
// Check for Flickr ID
if (!$this->flickr_id) {
$this->dialog->error("Missing Flickr ID");
exit(1);
}
// Create phpFlickr object
$ini_array = parse_ini_file($this->configuration_file, true);
if (!is_array($ini_array) || !is_array($ini_array[$this->flickr_id]) || !$ini_array[$this->flickr_id][CONFIG_ACCESS_TOKEN] || !$ini_array[$this->flickr_id][CONFIG_ACCESS_TOKEN_SECRET]) {
$this->dialog->info(1, "No information about Flickr id {$this->flickr_id} in configuration file {$this->configuration_file}");
$token = $this->authorize();
} else {
$token = new Token($ini_array[$this->flickr_id][CONFIG_ACCESS_TOKEN], $ini_array[$this->flickr_id][CONFIG_ACCESS_TOKEN_SECRET]);
}
if (!$token || $token->getToken() == '' || $token->getSecret() == '') {
$this->dialog->error("No access token for Flickr id {$this->flickr_id} in configuration file {$this->configuration_file}: " . $token->__toString());
exit(1);
}
$this->phpflickr->setToken($token);
// Do the backup
if ($this->backup_all_photos) {
$this->get_photo_list();
}
$this->backup_photos();
if ($this->backup_all_sets) {
$this->get_set_list();
}
$this->backup_sets();
}