/**
* @param array $array
* @param ExceptionFactoryInterface $exceptionFactory
* @return $this
* @throw \Exception
*/
public static function fromArray(array $array, ExceptionFactoryInterface $exceptionFactory)
{
if (isset($array["type"]) === false) {
throw $exceptionFactory->createResourceIdentifierTypeMissing($array);
}
if (isset($array["id"]) === false) {
throw $exceptionFactory->createResourceIdentifierIdMissing($array);
}
$resourceIdentifier = new self();
$resourceIdentifier->setType($array["type"]);
$resourceIdentifier->setId($array["id"]);
if (isset($array["meta"]) === true) {
$resourceIdentifier->setMeta($array["meta"]);
}
return $resourceIdentifier;
}