Scalr\Api\Service\User\V1beta0\Controller\Scripts::getScript PHP Method

getScript() public method

Gets specified Script taking into account both scope and authentication token
public getScript ( string $scriptId, boolean $modify = false ) : Script
$scriptId string Numeric identifier of the Script
$modify boolean optional Flag checking write permissions
return Scalr\Model\Entity\Script Returns the Script Entity on success
    public function getScript($scriptId, $modify = false)
    {
        /* @var $script Script */
        $script = Script::findPk($scriptId);
        if (!$script) {
            throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "Requested Script either does not exist or is not owned by your environment.");
        }
        if (!$this->hasPermissions($script, $modify)) {
            //Checks entity level write access permissions
            throw new ApiErrorException(403, ErrorMessage::ERR_PERMISSION_VIOLATION, "Insufficient permissions");
        }
        return $script;
    }