<?php

class Form {

	public static function input($title, $name, $value, $attrs = []) {
		$at = [];
		foreach ($attrs as $k=>$v) {
			$at[] = "$k = \"$v\"";
		}

		return blade("forms.input", [
			"title" => $title,
			"name" => $name,
			"value" => $value,
			"attrs" => implode(" ", $at)
		]);
	}

	public static function password($title, $name, $value, $attrs = []) {
		$at = [];
		foreach ($attrs as $k=>$v) {
			$at[] = "$k = \"$v\"";
		}

		return blade("forms.password", [
			"title" => $title,
			"name" => $name,
			"value" => $value,
			"attrs" => implode(" ", $at)
		]);
	}

	public static function submit($title, $attrs = []) {
		$at = [];
		foreach ($attrs as $k=>$v) {
			$at[] = "$k = \"$v\"";
		}

		return blade("forms.submit", [
			"title" => $title,
			"attrs" => implode(" ", $at)
		]);
	}
}
