# solid-performance/1.9.0/src/Performance/Timer/Duration_Factory.php

Solid Performance – Your No-Code Caching, Performance, &amp; Page Speed Solution, version 1.9.0. 48 lines.

- Page: https://pluginprobe.com/plugins/solid-performance/1.9.0/code/src/Performance/Timer/Duration_Factory.php
- Raw: https://pluginprobe.com/plugins/solid-performance/1.9.0/raw/src/Performance/Timer/Duration_Factory.php
- Modified: 2025-02-13T01:04:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/solid-performance/1.9.0/code/src/Performance/Timer/Duration_Factory.php#L10-L20`.

```php
<?php
/**
 * Creates a Duration object from the duration in seconds.
 *
 * @package SolidWP\Performance
 */

declare( strict_types=1 );

namespace SolidWP\Performance\Timer;

use SolidWP\Performance\Container;

/**
 * Creates a Duration object from the duration in seconds.
 *
 * @package SolidWP\Performance
 */
final class Duration_Factory {

	/**
	 * @var Container
	 */
	private Container $container;

	/**
	 * @param  Container $container The container.
	 */
	public function __construct( Container $container ) {
		$this->container = $container;
	}

	/**
	 * Make a duration object.
	 *
	 * @param  float $seconds The duration in seconds.
	 *
	 * @return Duration
	 */
	public function make( float $seconds ): Duration {
		$this->container->when( Duration::class )
						->needs( '$seconds' )
						->give( $seconds );

		return $this->container->get( Duration::class );
	}
}

```
