# assistant/0.3.1/backend/src/Data/Transformers/PluginUpdatesTransformer.php

Assistant – Every Day Productivity Apps, version 0.3.1. 54 lines.

- Page: https://pluginprobe.com/plugins/assistant/0.3.1/code/backend/src/Data/Transformers/PluginUpdatesTransformer.php
- Raw: https://pluginprobe.com/plugins/assistant/0.3.1/raw/backend/src/Data/Transformers/PluginUpdatesTransformer.php
- Modified: 2020-03-27T18:04:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/assistant/0.3.1/code/backend/src/Data/Transformers/PluginUpdatesTransformer.php#L10-L20`.

```php
<?php


namespace FL\Assistant\Data\Transformers;


class PluginUpdatesTransformer {

	public function __invoke( \stdClass $plugin ) {
		$update = $plugin->update;
		$thumbnail = null;
		$banner = null;

		if ( isset( $update->icons ) ) {
			if ( isset( $update->icons['2x'] ) ) {
				$thumbnail = $update->icons['2x'];
			} elseif ( isset( $update->icons['1x'] ) ) {
				$thumbnail = $update->icons['1x'];
			}
		}

		if ( isset( $update->banners ) ) {
			$update->banners = (array) $update->banners;
			
			if ( isset( $update->banners['2x'] ) ) {
				$banner = $update->banners['2x'];
			} elseif ( isset( $update->banners['1x'] ) ) {
				$banner = $update->banners['1x'];
			}
		}

		return [
			'author'         => $plugin->AuthorName,
			'authorURI'      => $plugin->AuthorURI,
			'banner'         => $banner,
			'bannerSizes'    => $update->banners,
			'content'        => $plugin->Description,
			'id'             => $update->plugin,
			'meta'           => $plugin->Version . ' by ' . $plugin->AuthorName,
			'metaUpdated'    => $update->new_version . ' by ' . $plugin->AuthorName,
			'plugin'         => $update->plugin,
			'thumbnail'      => $thumbnail,
			'thumbnailSizes' => $update->icons,
			'title'          => $plugin->Name,
			'type'           => 'plugin',
			'version'        => $plugin->Version,
			'updatedVersion' => $update->new_version,
			'tested'         => $update->tested,
			'requiresPHP'    => $update->requires_php,
			'pluginURI'      => $plugin->PluginURI,
		];
	}
}

```
