src/PNDP/NixGenerator.php
public static function sequentialArrayToIndentedNix(array $array, $indentLevel, $format)
	{
		if(count($array) == 0)
			return "[]"; // Not strictly required, but printing an empty list like this is better than putting a newline between the brackets
		else
		{
			$expr = "[\n";

			foreach($array as $value)
			{
				$listMemberExpr = NixGenerator::phpToIndentedNix($value, $indentLevel + 1, $format);

				/* Some objects in a list require ( ) wrapped around them to make them work, because whitespaces are in principle the delimiter symbols in lists */
				if($value instanceof NixBlock) {
					$listMemberExpr = $value->wrapInParenthesis($listMemberExpr);
				}

				$expr .= NixGenerator::generateIndentation($indentLevel + 1, $format).$listMemberExpr."\n";
			}

			$expr .= NixGenerator::generateIndentation($indentLevel, $format)."]";

			return $expr;
		}
	}
public static function sequentialArrayToIndentedNix(array $array, $indentLevel, $format)
	{
		if(count($array) == 0)
			return "[]"; // Not strictly required, but printing an empty list like this is better than putting a newline between the brackets
		else
		{
			$expr = "[\n";

			foreach($array as $value)
			{
				$listMemberExpr = NixGenerator::phpToIndentedNix($value, $indentLevel + 1, $format);

				/* Some objects in a list require ( ) wrapped around them to make them work, because whitespaces are in principle the delimiter symbols in lists */
				if($value instanceof NixBlock) {
					$listMemberExpr = $value->wrapInParenthesis($listMemberExpr);
				}

				$expr .= NixGenerator::generateIndentation($indentLevel + 1, $format).$listMemberExpr."\n";
			}

			$expr .= NixGenerator::generateIndentation($indentLevel, $format)."]";

			return $expr;
		}
	}
public static function sequentialArrayToIndentedNix ( array $ array , $ indentLevel , $ format ) { if ( count ( $ array ) == 0 ) return "[]" ; // Not strictly required, but printing an empty list like this is better than putting a newline between the brackets else { $ expr = "[\n" ; foreach ( $ array as $ value ) { $ listMemberExpr = NixGenerator :: phpToIndentedNix ( $ value , $ indentLevel + 1 , $ format ) ; /* Some objects in a list require ( ) wrapped around them to make them work, because whitespaces are in principle the delimiter symbols in lists */ if ( $ value instanceof NixBlock ) { $ listMemberExpr = $ value -> wrapInParenthesis ( $ listMemberExpr ) ; } $ expr .= NixGenerator :: generateIndentation ( $ indentLevel + 1 , $ format ) . $ listMemberExpr . "\n" ; } $ expr .= NixGenerator :: generateIndentation ( $ indentLevel , $ format ) . "]" ; return $ expr ; } }
Converts an array to a Nix list.

@param array $array Array to convert
@param int $indentLevel The indentation level of the resulting sub expression
@param bool $format Indicates whether to nicely format to expression (i.e. generating whitespaces) or not
@return A string representing the corresponding Nix list
Converts an array to a Nix list .