src/PNDP/NixGenerator.php
public static function phpToIndentedNix($obj, $indentLevel, $format)
	{
		$expr = "";

		switch(gettype($obj))
		{
			case "boolean":
				$expr .= NixGenerator::booleanToIndentedNix($obj);
				break;
			case "integer":
				$expr .= $obj;
				break;
			case "double":
				$expr .= $obj;
				break;
			case "string":
				$expr .= NixGenerator::stringToIndentedNix($obj);
				break;
			case "array":
				$expr .= NixGenerator::arrayToIndentedNix($obj, $indentLevel, $format);
				break;
			case "object":
				$expr .= NixGenerator::objectToIndentedNix($obj, $indentLevel, $format);
				break;
			case "resource":
				throw new Exception("Cannot convert a resource to a Nix expression");
				break;
			case "NULL":
				$expr .= "null";
				break;
			case "unknown type":
				throw new Exception("Cannot convert object of unknown type: ".$obj);
			default:
				throw new Exception("Encountered a totally unrecognizable type: ".$obj);
		}

		return $expr;
	}
public static function phpToIndentedNix($obj, $indentLevel, $format)
	{
		$expr = "";

		switch(gettype($obj))
		{
			case "boolean":
				$expr .= NixGenerator::booleanToIndentedNix($obj);
				break;
			case "integer":
				$expr .= $obj;
				break;
			case "double":
				$expr .= $obj;
				break;
			case "string":
				$expr .= NixGenerator::stringToIndentedNix($obj);
				break;
			case "array":
				$expr .= NixGenerator::arrayToIndentedNix($obj, $indentLevel, $format);
				break;
			case "object":
				$expr .= NixGenerator::objectToIndentedNix($obj, $indentLevel, $format);
				break;
			case "resource":
				throw new Exception("Cannot convert a resource to a Nix expression");
				break;
			case "NULL":
				$expr .= "null";
				break;
			case "unknown type":
				throw new Exception("Cannot convert object of unknown type: ".$obj);
			default:
				throw new Exception("Encountered a totally unrecognizable type: ".$obj);
		}

		return $expr;
	}
public static function phpToIndentedNix ( $ obj , $ indentLevel , $ format ) { $ expr = "" ; switch ( gettype ( $ obj ) ) { case "boolean" : $ expr .= NixGenerator :: booleanToIndentedNix ( $ obj ) ; break ; case "integer" : $ expr .= $ obj ; break ; case "double" : $ expr .= $ obj ; break ; case "string" : $ expr .= NixGenerator :: stringToIndentedNix ( $ obj ) ; break ; case "array" : $ expr .= NixGenerator :: arrayToIndentedNix ( $ obj , $ indentLevel , $ format ) ; break ; case "object" : $ expr .= NixGenerator :: objectToIndentedNix ( $ obj , $ indentLevel , $ format ) ; break ; case "resource" : throw new Exception ( "Cannot convert a resource to a Nix expression" ) ; break ; case "NULL" : $ expr .= "null" ; break ; case "unknown type" : throw new Exception ( "Cannot convert object of unknown type: " . $ obj ) ; default : throw new Exception ( "Encountered a totally unrecognizable type: " . $ obj ) ; } return $ expr ; }
Converts a PHP variable of any type to a semantically equivalent or
similar Nix expression language object. It also uses indentation to
format the resulting sub expression more nicely.

@param mixed $obj A variable of any type
@param int $indentLevel Contains the indentation level
@param bool $format Indicates whether to nicely format the generated expression
@return string A string containing the converted Nix expression language object
Converts a PHP variable of any type to a semantically equivalent or similar Nix expression language object . It also uses indentation to format the resulting sub expression more nicely .