# defender-security/3.0.1/src/component/timer.php

Defender Security – Malware Scanner, Login Security &amp; Firewall, version 3.0.1. 38 lines.

- Page: https://pluginprobe.com/plugins/defender-security/3.0.1/code/src/component/timer.php
- Raw: https://pluginprobe.com/plugins/defender-security/3.0.1/raw/src/component/timer.php
- Modified: 2020-12-28T12:52:54+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/defender-security/3.0.1/code/src/component/timer.php#L10-L20`.

```php
<?php

namespace WP_Defender\Component;

use Calotes\Base\Component;

class Timer extends Component {
	protected $clock;

	public function __construct() {
		$this->start();
	}

	public function get_max_time() {
		$max = ini_get( 'max_execution_time' );
		if ( ! filter_var( $max, FILTER_VALIDATE_INT ) ) {
			$max = 30;
		}

		return $max / 2;
	}

	public function start() {
		$this->clock = time();
	}

	/**
	 * @return bool
	 */
	public function check() {
		$eslaped = time() - $this->clock;
		if ( ( $eslaped / 1000 ) >= $this->get_max_time() ) {
			return false;
		}

		return true;
	}
}
```
