private function resolve(&$result)
	{
		if (!isset($result['conflicts']) || !count($result['conflicts'])) {
			return;
		}

		$original_checksums = isset($this->installationMap['__CHECKSUMS__'])
			? $this->installationMap['__CHECKSUMS__']
			: array();

		foreach ($result['conflicts'] as $a => $b) {
			$base_path        = str_replace(DIRECTORY_SEPARATOR, '/', getcwd());
			$opus_path        = str_replace($base_path, '', $b);
			$current_checksum = md5(@file_get_contents($b));
			$new_checksum     = md5(@file_get_contents($a));
			$old_checksum     = isset($original_checksums[$opus_path])
				? $original_checksums[$opus_path]
				: md5(FALSE);

			switch ($this->integrity) {
				case 'low':
					copy ($a, $b);
					break;

				case 'medium':
					if ($new_checksum == $old_checksum) {

						//
						// A conflict is only raised if the destinaton differs from the source.
						// However, if we "keep" a file on a previous conflict, the map will be
						// updated with the new checksum even though the file is not copied.  By
						// checking if the new checksum is equal to the old, we can determine if
						// the file has actually changed in the package.  If it has not, we
						// don't need to do anything.
						//

						break;

					} elseif ($old_checksum == $current_checksum) {

						//
						// If we didn't pass the previous condition, then it means that the file
						// in the package has changed since the previous copy or keep.  So now
						// we want to see if the old checksum is equivalent to the current file.
						// This would imply we have not changed it.  If we have no customizations
						// then we can  safely copy the file and update the checksum in the map.
						//

						copy($a, $b);
						$result['updates'][$opus_path] = $new_checksum;
						break;

					} else {

						//
						// Lastly, if our new checksum is not the same as our old one and our
						// old one is not our current one, we want to give the user the option
						// to resolve this as if it were 'high' integrity.
						//

					}

				case 'high':
					$answer = NULL;
					$this->io->write(
						PHP_EOL . self::TAB . 'The following conflicts were found:' . PHP_EOL
					);

					while (!$answer) {
						$answer = $this->io->ask(sprintf(
							self::TAB . '- %s [o=overwrite (default), k=keep, d=diff]: ',
							$opus_path
						), 'o');

						switch(strtolower($answer[0])) {
							case 'o':
								copy($a, $b);
								$result['updates'][$opus_path] = $new_checksum;
								break;

							case 'k':
								$result['updates'][$opus_path] = $new_checksum;
								break;

							case 'd':
								$this->io->write(PHP_EOL . self::diff($a, $b) . PHP_EOL);
							default:
								$answer = NULL;
								break;
						}
					}

					break;
			}
		}
	}
private function resolve(&$result)
	{
		if (!isset($result['conflicts']) || !count($result['conflicts'])) {
			return;
		}

		$original_checksums = isset($this->installationMap['__CHECKSUMS__'])
			? $this->installationMap['__CHECKSUMS__']
			: array();

		foreach ($result['conflicts'] as $a => $b) {
			$base_path        = str_replace(DIRECTORY_SEPARATOR, '/', getcwd());
			$opus_path        = str_replace($base_path, '', $b);
			$current_checksum = md5(@file_get_contents($b));
			$new_checksum     = md5(@file_get_contents($a));
			$old_checksum     = isset($original_checksums[$opus_path])
				? $original_checksums[$opus_path]
				: md5(FALSE);

			switch ($this->integrity) {
				case 'low':
					copy ($a, $b);
					break;

				case 'medium':
					if ($new_checksum == $old_checksum) {

						//
						// A conflict is only raised if the destinaton differs from the source.
						// However, if we "keep" a file on a previous conflict, the map will be
						// updated with the new checksum even though the file is not copied.  By
						// checking if the new checksum is equal to the old, we can determine if
						// the file has actually changed in the package.  If it has not, we
						// don't need to do anything.
						//

						break;

					} elseif ($old_checksum == $current_checksum) {

						//
						// If we didn't pass the previous condition, then it means that the file
						// in the package has changed since the previous copy or keep.  So now
						// we want to see if the old checksum is equivalent to the current file.
						// This would imply we have not changed it.  If we have no customizations
						// then we can  safely copy the file and update the checksum in the map.
						//

						copy($a, $b);
						$result['updates'][$opus_path] = $new_checksum;
						break;

					} else {

						//
						// Lastly, if our new checksum is not the same as our old one and our
						// old one is not our current one, we want to give the user the option
						// to resolve this as if it were 'high' integrity.
						//

					}

				case 'high':
					$answer = NULL;
					$this->io->write(
						PHP_EOL . self::TAB . 'The following conflicts were found:' . PHP_EOL
					);

					while (!$answer) {
						$answer = $this->io->ask(sprintf(
							self::TAB . '- %s [o=overwrite (default), k=keep, d=diff]: ',
							$opus_path
						), 'o');

						switch(strtolower($answer[0])) {
							case 'o':
								copy($a, $b);
								$result['updates'][$opus_path] = $new_checksum;
								break;

							case 'k':
								$result['updates'][$opus_path] = $new_checksum;
								break;

							case 'd':
								$this->io->write(PHP_EOL . self::diff($a, $b) . PHP_EOL);
							default:
								$answer = NULL;
								break;
						}
					}

					break;
			}
		}
	}
private function resolve ( & $ result ) { if ( ! isset ( $ result [ 'conflicts' ] ) || ! count ( $ result [ 'conflicts' ] ) ) { return ; } $ original_checksums = isset ( $ this -> installationMap [ '__CHECKSUMS__' ] ) ? $ this -> installationMap [ '__CHECKSUMS__' ] : array ( ) ; foreach ( $ result [ 'conflicts' ] as $ a => $ b ) { $ base_path = str_replace ( DIRECTORY_SEPARATOR , '/' , getcwd ( ) ) ; $ opus_path = str_replace ( $ base_path , '' , $ b ) ; $ current_checksum = md5 ( @ file_get_contents ( $ b ) ) ; $ new_checksum = md5 ( @ file_get_contents ( $ a ) ) ; $ old_checksum = isset ( $ original_checksums [ $ opus_path ] ) ? $ original_checksums [ $ opus_path ] : md5 ( FALSE ) ; switch ( $ this -> integrity ) { case 'low' : copy ( $ a , $ b ) ; break ; case 'medium' : if ( $ new_checksum == $ old_checksum ) { // // A conflict is only raised if the destinaton differs from the source. // However, if we "keep" a file on a previous conflict, the map will be // updated with the new checksum even though the file is not copied.  By // checking if the new checksum is equal to the old, we can determine if // the file has actually changed in the package.  If it has not, we // don't need to do anything. // break ; } elseif ( $ old_checksum == $ current_checksum ) { // // If we didn't pass the previous condition, then it means that the file // in the package has changed since the previous copy or keep.  So now // we want to see if the old checksum is equivalent to the current file. // This would imply we have not changed it.  If we have no customizations // then we can  safely copy the file and update the checksum in the map. // copy ( $ a , $ b ) ; $ result [ 'updates' ] [ $ opus_path ] = $ new_checksum ; break ; } else { // // Lastly, if our new checksum is not the same as our old one and our // old one is not our current one, we want to give the user the option // to resolve this as if it were 'high' integrity. // } case 'high' : $ answer = NULL ; $ this -> io -> write ( PHP_EOL . self :: TAB . 'The following conflicts were found:' . PHP_EOL ) ; while ( ! $ answer ) { $ answer = $ this -> io -> ask ( sprintf ( self :: TAB . '- %s [o=overwrite (default), k=keep, d=diff]: ' , $ opus_path ) , 'o' ) ; switch ( strtolower ( $ answer [ 0 ] ) ) { case 'o' : copy ( $ a , $ b ) ; $ result [ 'updates' ] [ $ opus_path ] = $ new_checksum ; break ; case 'k' : $ result [ 'updates' ] [ $ opus_path ] = $ new_checksum ; break ; case 'd' : $ this -> io -> write ( PHP_EOL . self :: diff ( $ a , $ b ) . PHP_EOL ) ; default : $ answer = NULL ; break ; } } break ; } } }
Resolve conflicts by prompting the user for action

@access private
@param array $result A copymap result containing updates and conflicts
@return boolean TRUE if the user overwrite with the new version, FALSE otherwise
Resolve conflicts by prompting the user for action