本文整理汇总了PHP中Artist::structureData方法的典型用法代码示例。如果您正苦于以下问题:PHP Artist::structureData方法的具体用法?PHP Artist::structureData怎么用?PHP Artist::structureData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artist
的用法示例。
在下文中一共展示了Artist::structureData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStructureData
/**
* @covers Artist::structureData
*/
public function testStructureData()
{
$this->object->id = '50';
$this->object->name = 'artistName50';
$artist = $this->object->structureData();
$this->assertInstanceOf(Artist::class, $artist, 'Result should be an instance of Artist class');
$this->assertEquals(50, $artist->id, 'Id should be convert in integer');
$this->assertEquals('artistName50', $artist->name, 'Name should be set to artistName50, but found:' . $artist->name);
}
示例2: Artist
$api->output(403, 'Admin scope is required for editing artist');
//indicate the requester do not have the required scope for updating artist
return;
}
if (!$api->checkParameterExists('id', $id)) {
$api->output(400, 'Artist identifier must be provided');
//artist was not provided, return an error
return;
}
$artist = new Artist($id);
if (!$artist->populate(['id' => $id])) {
$api->output(404, 'Artist not found');
//indicate the artist was not found
return;
}
//adapt and validate object received
$updatedArtist = $api->query['body'];
if (!$artist->validateModel($updatedArtist, $errorMessage)) {
$api->output(400, 'Artist is not valid: ' . $errorMessage);
//provided user is not valid
return;
}
if (!$artist->update($errorMessage)) {
$api->output(500, 'Error during artist update' . $errorMessage);
//something gone wrong :(
return;
}
$artist->getTracks();
$api->output(200, $artist->structureData());
break;
}