data/model/Behaviors.php
public static function actsAs($name, $config = [], $entry = null) {
		$self = static::_object();

		$class = Libraries::locate('behavior', $name);

		if ($config === true) {
			if (isset($self->_behaviors[$class])) {
				return $self->_behaviors[$class]->config($entry);
			}
			throw new RuntimeException("Unexisting Behavior named `{$class}`.");
		}
		if ($config === false) {
			unset($self->_behaviors[$class]);
			return true;
		}

		$model = get_called_class();
		if (isset($self->_behaviors[$class])) {
			$self->_behaviors[$class]->config($config + compact('model'));
			return true;
		} else {
			$object = new $class($config + compact('model'));
			if ($object) {
				$self->_behaviors[$class] = $object;
				return true;
			}
		}
		return false;
	}
public static function actsAs($name, $config = [], $entry = null) {
		$self = static::_object();

		$class = Libraries::locate('behavior', $name);

		if ($config === true) {
			if (isset($self->_behaviors[$class])) {
				return $self->_behaviors[$class]->config($entry);
			}
			throw new RuntimeException("Unexisting Behavior named `{$class}`.");
		}
		if ($config === false) {
			unset($self->_behaviors[$class]);
			return true;
		}

		$model = get_called_class();
		if (isset($self->_behaviors[$class])) {
			$self->_behaviors[$class]->config($config + compact('model'));
			return true;
		} else {
			$object = new $class($config + compact('model'));
			if ($object) {
				$self->_behaviors[$class] = $object;
				return true;
			}
		}
		return false;
	}
public static function actsAs ( $ name , $ config = [ ] , $ entry = null ) { $ self = static :: _object ( ) ; $ class = Libraries :: locate ( 'behavior' , $ name ) ; if ( $ config === true ) { if ( isset ( $ self -> _behaviors [ $ class ] ) ) { return $ self -> _behaviors [ $ class ] -> config ( $ entry ) ; } throw new RuntimeException ( "Unexisting Behavior named `{$class}`." ) ; } if ( $ config === false ) { unset ( $ self -> _behaviors [ $ class ] ) ; return true ; } $ model = get_called_class ( ) ; if ( isset ( $ self -> _behaviors [ $ class ] ) ) { $ self -> _behaviors [ $ class ] -> config ( $ config + compact ( 'model' ) ) ; return true ; } else { $ object = new $ class ( $ config + compact ( 'model' ) ) ; if ( $ object ) { $ self -> _behaviors [ $ class ] = $ object ; return true ; } } return false ; }
Bind a behavior class to the current model

@param string $name The name of the behavior
@param string $config If `$config === true` returns some configurations of the behavior,
if `$config === false` unbind the behavior, otherwise `$config` stands for
the configuration array to set for the behavior.
@param string $entry The name of the configuration option to get. If `null` all
configuration options will be returned.
(this parameter is only applicable if `$config === true`)
@return boolean `true` on success, `false` otherwise
Bind a behavior class to the current model