public static function hasBehavior($subject, $behavior, $throwException=false)
	{
		//only components allowed
		if (!$subject instanceof \yii\base\Component) {
			throw new InvalidParamException(Yii::t('app', 'Subject must extend Component'));
		}

		//prepare vars
		$behavior = $behavior instanceof \yii\base\Behavior ? $behavior::className() : $behavior;

		//check if behavior is attached
		$found = false;
		foreach ($subject->behaviors() as $name=>$config) {
			$className = is_array($config) ? $config['class'] : $config;
			if (strcmp($className, $behavior) === 0) {
				$found = true;
				break;
			}
		}

		if ($throwException && !$found) {
			$msg = Yii::t('app', '{subject} needs to have behavior {behavior} attached', [
				'subject'=>$subject->className(),
				'behavior'=>$behavior,
			]);
			throw new InvalidConfigException($msg);
		}

		return $found;
	}