src/Thybag/SharePointAPI.php
public function prepBatch (array $items, $method) {
		// Check if method is supported
		assert(in_array($method, array('New', 'Update', 'Delete')));

		// Get var's needed
		$batch = '';
		$counter = 1;

		// Foreach item to be converted in to a SharePoint Soap Command
		foreach ($items as $data) {
			// Wrap item in command for given method
			$batch .= '<Method Cmd="' . $method . '" ID="' . $counter . '">';

			// Add required attributes
			foreach ($data as $itm => $val) {
				// Add entry
				$batch .= '<Field Name="' . $itm . '">' . htmlspecialchars($val) . '</Field>' . PHP_EOL;
			}

			$batch .= '</Method>';

			// Inc counter
			$counter++;
		}

		// Return XML data.
		return $batch;
	}
public function prepBatch (array $items, $method) {
		// Check if method is supported
		assert(in_array($method, array('New', 'Update', 'Delete')));

		// Get var's needed
		$batch = '';
		$counter = 1;

		// Foreach item to be converted in to a SharePoint Soap Command
		foreach ($items as $data) {
			// Wrap item in command for given method
			$batch .= '<Method Cmd="' . $method . '" ID="' . $counter . '">';

			// Add required attributes
			foreach ($data as $itm => $val) {
				// Add entry
				$batch .= '<Field Name="' . $itm . '">' . htmlspecialchars($val) . '</Field>' . PHP_EOL;
			}

			$batch .= '</Method>';

			// Inc counter
			$counter++;
		}

		// Return XML data.
		return $batch;
	}
public function prepBatch ( array $ items , $ method ) { // Check if method is supported assert ( in_array ( $ method , array ( 'New' , 'Update' , 'Delete' ) ) ) ; // Get var's needed $ batch = '' ; $ counter = 1 ; // Foreach item to be converted in to a SharePoint Soap Command foreach ( $ items as $ data ) { // Wrap item in command for given method $ batch .= '<Method Cmd="' . $ method . '" ID="' . $ counter . '">' ; // Add required attributes foreach ( $ data as $ itm => $ val ) { // Add entry $ batch .= '<Field Name="' . $ itm . '">' . htmlspecialchars ( $ val ) . '</Field>' . PHP_EOL ; } $ batch .= '</Method>' ; // Inc counter $ counter ++ ; } // Return XML data. return $ batch ; }
prepBatch
Convert an array of new items or change sets in to XML commands to be run on
the sharepoint SOAP API.

@param $items array of new items/change sets
@param $method New/Update/Delete
@return XML
prepBatch Convert an array of new items or change sets in to XML commands to be run on the sharepoint SOAP API .