for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://flipboxfactory.com/software/hubspot/license
* @link https://www.flipboxfactory.com/software/hubspot/
*/
namespace flipbox\hubspot\actions\traits;
use Craft;
use craft\base\Element;
use craft\base\ElementInterface;
use yii\web\HttpException;
* @author Flipbox Factory <[email protected]>
* @since 1.0.0
trait ElementResolverTrait
{
* @param string $element
* @return ElementInterface|Element
* @throws HttpException
protected function resolveElement(string $element): ElementInterface
if (null === ($element = Craft::$app->getElements()->getElementById($element))) {
throw new HttpException(400, 'Invalid element');
};
return $element;
}