for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AcquiaCloudApi\Response;
use AcquiaCloudApi\Exception\NoLinkedResourceException;
use AcquiaCloudApi\Exception\LinkedResourceNotFoundException;
abstract class GenericResponse
{
/**
* @param string $name
* @return string
* @throws NoLinkedResourceException
* @throws LinkedResourceNotFoundException
*/
public function getLink(string $name)
if (!property_exists($this, 'links')) {
throw new NoLinkedResourceException('No linked resources for' . get_called_class());
} elseif (!property_exists($this->links, $name)) {
throw new LinkedResourceNotFoundException('No property exists for ' . $name);
} elseif (!property_exists($this->links->$name, 'href')) {
throw new LinkedResourceNotFoundException('href property not found on ' . $name);
}
return $this->links->$name->href;