52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
/**
|
|
* Set version updates
|
|
*
|
|
* @param object $item The item data
|
|
*
|
|
* @return void
|
|
* @since 3.2.0
|
|
*/
|
|
public function set(object &$item)
|
|
{
|
|
// set the version updates
|
|
$item->version_update = (isset($item->version_update)
|
|
&& JsonHelper::check($item->version_update))
|
|
? json_decode((string) $item->version_update, true) : null;
|
|
if (ArrayHelper::check($item->version_update))
|
|
{
|
|
$item->version_update = array_values(
|
|
$item->version_update
|
|
);
|
|
|
|
// set the change log details
|
|
$this->changelog($item);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Set changelog values to component changelog
|
|
*
|
|
* @param object $item The item data
|
|
*
|
|
* @return void
|
|
* @since 3.2.0
|
|
*/
|
|
protected function changelog(object &$item)
|
|
{
|
|
// set the version updates
|
|
$bucket = [];
|
|
foreach ($item->version_update as $update)
|
|
{
|
|
if (isset($update['change_log']) && StringHelper::check($update['change_log'])
|
|
&& isset($update['version']) && StringHelper::check($update['version']))
|
|
{
|
|
$bucket[] = '# v' . $update['version'] . PHP_EOL . PHP_EOL . $update['change_log'];
|
|
}
|
|
}
|
|
|
|
if (ArrayHelper::check($bucket))
|
|
{
|
|
$item->changelog = implode(PHP_EOL . PHP_EOL, $bucket);
|
|
}
|
|
}
|