# defender-security/3.0.1/framework/component/behavior.php

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

- Page: https://pluginprobe.com/plugins/defender-security/3.0.1/code/framework/component/behavior.php
- Raw: https://pluginprobe.com/plugins/defender-security/3.0.1/raw/framework/component/behavior.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/framework/component/behavior.php#L10-L20`.

```php
<?php
/**
 * Author: Hoang Ngo
 */

namespace Calotes\Component;

use Calotes\Base\Component;

class Behavior extends Component {
	/**
	 * The component this behavior tied to
	 *
	 * @var object
	 */
	public $owner;

	/**
	 * Attach this behavior to a component
	 *
	 * @param $owner
	 */
	public function attach( Component $owner ) {
		$owner->attach_behavior( $this );
	}

	/**
	 * Detach behavior from a component
	 *
	 * @return $this|bool
	 */
	public function detach() {
		if ( ! $this->owner instanceof Component ) {
			return false;
		}
		$this->owner->detach_behavior( self::class );
		$this->owner = null;

		return $this;
	}
}

```
