\Iqrf\Repository\Entities Product

Product entity

Summary

Methods
Properties
Constants
__construct
fromApiResponse
getLatestProfileByHwpidVersion
jsonSerialize
hwpid
name
manufacturerId
companyName
homepage
picture
rfMode
metadata
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$hwpid

$hwpid : int

Type

int

$name

$name : string

Type

string

$manufacturerId

$manufacturerId : int

Type

int

$companyName

$companyName : string

Type

string

$homepage

$homepage : string

Type

string

$picture

$picture : string

Type

string

$rfMode

$rfMode : \Iqrf\Repository\Enums\RfModes

Type

RfModes

$metadata

$metadata : array

Type

array<string|int, mixed>

Methods

__construct()

__construct(int  $hwpid, string  $name, int  $manufacturerId, string  $companyName, string  $homepage, string  $picture, \Iqrf\Repository\Enums\RfModes  $rfMode, \Iqrf\Repository\Entities\Metadata[]  $metadata = []) : mixed

Constructor

Parameters

int $hwpid

Product HWPID

string $name

Product name

int $manufacturerId

Manufacturer ID

string $companyName

Company name

string $homepage

Product homepage

string $picture

Product picture

\Iqrf\Repository\Enums\RfModes $rfMode

Product RF mode

\Iqrf\Repository\Entities\Metadata[] $metadata

Product metadata

Returns

mixed —

fromApiResponse()

fromApiResponse(array{hwpid: int, name: string, manufacturerID: int, companyName: string, homePage: string, picture: string, rfMode: int, metadata: array}  $response) : \Iqrf\Repository\Entities\Product

Creates a new product entity from the API response

Parameters

array{hwpid: int, name: string, manufacturerID: int, companyName: string, homePage: string, picture: string, rfMode: int, metadata: array} $response

API response data

Throws

\Iqrf\Repository\Exceptions\CorruptedData

Thrown when the API response data are corrupted

Returns

\Iqrf\Repository\Entities\Product —

Created product entity

getLatestProfileByHwpidVersion()

getLatestProfileByHwpidVersion(int  $hwpidVersion) : array{version: int, profile: \Iqrf\Repository\Entities\MetadataProfile}|null

Get latest metadata profile for specified HWPID version of a product

Parameters

int $hwpidVersion

HWPID version

Returns

array{version: int, profile: \Iqrf\Repository\Entities\MetadataProfile}|null —

Metadata profile if one exists

jsonSerialize()

jsonSerialize() : array{hwpid: int, name: string, manufacturerId: int, companyName: string, homepage: string, picture: string, rfMode: string, metadata: array}

Serializes the product entity into JSON

Returns

array{hwpid: int, name: string, manufacturerId: int, companyName: string, homepage: string, picture: string, rfMode: string, metadata: array} —

JSON serialized product entity