Skip to content

Commit

Permalink
Add helper method that was missing to get the transient.
Browse files Browse the repository at this point in the history
  • Loading branch information
thefrosty committed Mar 5, 2024
1 parent 59278a8 commit c1fdf6b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Api/TransientsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ public function getTransientKey(string $input, ?string $key_prefix = null): stri
}

/**
* Get the transient value.
* @param string $transient Transient name.
* @return mixed
*/
public function getTransient(string $transient): mixed

Check warning on line 51 in src/Api/TransientsTrait.php

View check run for this annotation

Codecov / codecov/patch

src/Api/TransientsTrait.php#L51

Added line #L51 was not covered by tests
{
return get_transient($transient);

Check warning on line 53 in src/Api/TransientsTrait.php

View check run for this annotation

Codecov / codecov/patch

src/Api/TransientsTrait.php#L53

Added line #L53 was not covered by tests
}

/**
* Set the transient value.
* @param string $transient Transient name. Expected to not be SQL-escaped. Must be 172 characters or fewer.
* @param mixed $value Transient value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
* @param int $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
Expand Down

0 comments on commit c1fdf6b

Please sign in to comment.