PluginProbe
Packeta / trunk
Packeta vtrunk
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / Framework / TransientTrait.php

TransientTrait.php in Packeta trunk, at src/Packetery/Module/Framework/TransientTrait.php

45 lines 986 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Trait TransientTrait.
4 *
5 * @package Packetery
6 */
7
8 declare( strict_types=1 );
9
10 namespace Packetery\Module\Framework;
11
12 use function get_transient;
13
14 /**
15 * Trait TransientTrait.
16 *
17 * @package Packetery
18 */
19 trait TransientTrait {
20 /**
21 * @return mixed|false False when not set.
22 */
23 public function getTransient( string $transientName ) {
24 return get_transient( $transientName );
25 }
26
27 /**
28 * @param string $transientName
29 * @param mixed $transientValue
30 * @param int $expiration
31 *
32 * @return mixed Because the function set_transient applies hooks, it can return anything
33 */
34 public function setTransient( string $transientName, $transientValue, int $expiration = 0 ) {
35 return set_transient( $transientName, $transientValue, $expiration );
36 }
37
38 /**
39 * @return mixed Because the function delete_transient applies hooks, it can return anything
40 */
41 public function deleteTransient( string $transientName ) {
42 return delete_transient( $transientName );
43 }
44 }
45