PluginProbe
WooCommerce / 11.1.0-rc.2
WooCommerce v11.1.0-rc.2
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / src / Blocks / Registry / SharedType.php
SharedType.php
33 lines 740 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Automattic\WooCommerce\Blocks\Registry;
3
4 /**
5 * A definition for the SharedType dependency type.
6 *
7 * @since 2.5.0
8 */
9 class SharedType extends AbstractDependencyType {
10
11 /**
12 * Holds a cached instance of the value stored (or returned) internally.
13 *
14 * @var mixed
15 */
16 private $shared_instance;
17
18 /**
19 * Returns the internal stored and shared value after initial generation.
20 *
21 * @param Container $container An instance of the dependency injection
22 * container.
23 *
24 * @return mixed
25 */
26 public function get( Container $container ) {
27 if ( empty( $this->shared_instance ) ) {
28 $this->shared_instance = $this->resolve_value( $container );
29 }
30 return $this->shared_instance;
31 }
32 }
33