Skip to content

Add a Check that asset is not falsey #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: widget
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Traits/AudioCodec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ trait AudioCodec
*/
public function AudioCodec($audioCodec)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->transcode(Transcode::audioCodec($audioCodec));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/AudioFrequency.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ trait AudioFrequency
*/
public function AudioFrequency($audioFrequency)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->transcode(Transcode::audioFrequency($audioFrequency));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/BitRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ trait BitRate
*/
public function BitRate($bitRate)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->bitRate($bitRate);
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Crop.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait Crop
*/
public function Crop($width, $height, $gravity = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

if (empty($gravity) === true) {
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/DPR.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ trait DPR
*/
public function DPR($dpr)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->delivery(Delivery::dpr($dpr));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Fill.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait Fill
*/
public function Fill($width, $height, $gravity = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

if (empty($gravity) === true) {
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Fit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait Fit
*/
public function Fit($width, $height, $aspectRatio = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->resize(Resize::fit($width, $height, $aspectRatio));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Flag.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ trait Flag
*/
public function Flag($flag, ...$options)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->addFlag(TransformationFlag::$flag(...$options));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ trait Format
*/
public function Format($format)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->delivery(Delivery::format(TransformationFormat::$format()));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/KeyframeInterval.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ trait KeyframeInterval
*/
public function KeyframeInterval($keyframeInterval)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->keyframeInterval($keyframeInterval);
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Limit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait Limit
*/
public function Limit($width, $height, $aspectRatio = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->resize(Resize::limitFit($width, $height, $aspectRatio));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/LimitFill.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait LimitFill
*/
public function LimitFill($width, $height, $gravity = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

if (empty($gravity) === true) {
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/MinimumFit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait MinimumFit
*/
public function MinimumFit($width, $height, $aspectRatio = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->resize(Resize::minimumFit($width, $height, $aspectRatio));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Quality.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ trait Quality
*/
public function Quality($quality)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->quality($quality);
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Scale.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait Scale
*/
public function Scale($width, $height, $aspectRatio = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->resize(Resize::scale($width, $height, $aspectRatio));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/Thumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ trait Thumb
*/
public function Thumb($width, $height, $gravity = null)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

if (empty($gravity) === true) {
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/VideoCodec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ trait VideoCodec
*/
public function VideoCodec($videoCodec)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->transcode(Transcode::videoCodec($videoCodec));
Expand Down
3 changes: 3 additions & 0 deletions src/Traits/VideoSampling.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ trait VideoSampling
*/
public function VideoSampling($videoSampling)
{
if (!$this->asset) {
return null;
}
$clone = $this->clone();

$clone->asset->videoSampling($videoSampling);
Expand Down