private function cleanup()
	{
		foreach ($this->installationMap as $path => $packages) {
			if ($path == '__CHECKSUMS__') {
				continue;
			}

			if (count($packages)) {
				sort($this->installationMap[$path]);
				continue;
			}

			$installation_path = ltrim($path, '/\\' . DIRECTORY_SEPARATOR);
			$installation_path = getcwd() . DIRECTORY_SEPARATOR . $installation_path;

			if (is_dir($installation_path)) {

				//
				// Here's what to do with a directory
				//

				$children = array_merge(
					glob($installation_path . DIRECTORY_SEPARATOR . '/*'),
					glob($installation_path . DIRECTORY_SEPARATOR . '/.*')
				);

				//
				// Children should be at least two (one entry for current dir and another)
				// for parent dir.  Our install map is sorted by the length of the path
				// so we should only be trying to remove directories which have already had
				// other opus related/created children removed.
				//

				if (count($children) > 2) {
					continue;
				}

				if (!@rmdir($installation_path)) {
					switch ($this->integrity) {
						case 'low':
							break;

						case 'medium':
							$this->io->write(sprintf(
								self::TAB . 'Warning: unable to remove empty directory %s',
								$path
							));
							break;

						case 'high':
							throw new \Exception(sprintf(
								'Error removing empty directory %s',
								$path
							));
					}
				}

			} else {

				//
				// Here's what to do with a file
				//

				if (!@unlink($installation_path)) {
					switch ($this->integrity) {
						case 'low':
							break;

						case 'medium':
							$this->io->write(sprintf(
								self::TAB . 'Warning: unable to remove unused file %s; remove manually',
								$path
							));
							break;

						case 'high':
							throw new \Exception(sprintf(
								'Error removing unused file %s, restore file or check permissions and try again',
								$path
							));
					}
				}
			}

			unset($this->installationMap[$path]);
			unset($this->installationMap['__CHECKSUMS__'][$path]);
		}

		//
		// Sort our paths by length
		//

		uksort($this->installationMap, function($a, $b) {
			if (strlen($a) == strlen($b)) {
				return 0;
			}

			if (strlen($a) > strlen($b)) {
				return -1;
			}

			return 1;
		});
	}
private function cleanup()
	{
		foreach ($this->installationMap as $path => $packages) {
			if ($path == '__CHECKSUMS__') {
				continue;
			}

			if (count($packages)) {
				sort($this->installationMap[$path]);
				continue;
			}

			$installation_path = ltrim($path, '/\\' . DIRECTORY_SEPARATOR);
			$installation_path = getcwd() . DIRECTORY_SEPARATOR . $installation_path;

			if (is_dir($installation_path)) {

				//
				// Here's what to do with a directory
				//

				$children = array_merge(
					glob($installation_path . DIRECTORY_SEPARATOR . '/*'),
					glob($installation_path . DIRECTORY_SEPARATOR . '/.*')
				);

				//
				// Children should be at least two (one entry for current dir and another)
				// for parent dir.  Our install map is sorted by the length of the path
				// so we should only be trying to remove directories which have already had
				// other opus related/created children removed.
				//

				if (count($children) > 2) {
					continue;
				}

				if (!@rmdir($installation_path)) {
					switch ($this->integrity) {
						case 'low':
							break;

						case 'medium':
							$this->io->write(sprintf(
								self::TAB . 'Warning: unable to remove empty directory %s',
								$path
							));
							break;

						case 'high':
							throw new \Exception(sprintf(
								'Error removing empty directory %s',
								$path
							));
					}
				}

			} else {

				//
				// Here's what to do with a file
				//

				if (!@unlink($installation_path)) {
					switch ($this->integrity) {
						case 'low':
							break;

						case 'medium':
							$this->io->write(sprintf(
								self::TAB . 'Warning: unable to remove unused file %s; remove manually',
								$path
							));
							break;

						case 'high':
							throw new \Exception(sprintf(
								'Error removing unused file %s, restore file or check permissions and try again',
								$path
							));
					}
				}
			}

			unset($this->installationMap[$path]);
			unset($this->installationMap['__CHECKSUMS__'][$path]);
		}

		//
		// Sort our paths by length
		//

		uksort($this->installationMap, function($a, $b) {
			if (strlen($a) == strlen($b)) {
				return 0;
			}

			if (strlen($a) > strlen($b)) {
				return -1;
			}

			return 1;
		});
	}
private function cleanup ( ) { foreach ( $ this -> installationMap as $ path => $ packages ) { if ( $ path == '__CHECKSUMS__' ) { continue ; } if ( count ( $ packages ) ) { sort ( $ this -> installationMap [ $ path ] ) ; continue ; } $ installation_path = ltrim ( $ path , '/\\' . DIRECTORY_SEPARATOR ) ; $ installation_path = getcwd ( ) . DIRECTORY_SEPARATOR . $ installation_path ; if ( is_dir ( $ installation_path ) ) { // // Here's what to do with a directory // $ children = array_merge ( glob ( $ installation_path . DIRECTORY_SEPARATOR . '/*' ) , glob ( $ installation_path . DIRECTORY_SEPARATOR . '/.*' ) ) ; // // Children should be at least two (one entry for current dir and another) // for parent dir.  Our install map is sorted by the length of the path // so we should only be trying to remove directories which have already had // other opus related/created children removed. // if ( count ( $ children ) > 2 ) { continue ; } if ( ! @ rmdir ( $ installation_path ) ) { switch ( $ this -> integrity ) { case 'low' : break ; case 'medium' : $ this -> io -> write ( sprintf ( self :: TAB . 'Warning: unable to remove empty directory %s' , $ path ) ) ; break ; case 'high' : throw new \ Exception ( sprintf ( 'Error removing empty directory %s' , $ path ) ) ; } } } else { // // Here's what to do with a file // if ( ! @ unlink ( $ installation_path ) ) { switch ( $ this -> integrity ) { case 'low' : break ; case 'medium' : $ this -> io -> write ( sprintf ( self :: TAB . 'Warning: unable to remove unused file %s; remove manually' , $ path ) ) ; break ; case 'high' : throw new \ Exception ( sprintf ( 'Error removing unused file %s, restore file or check permissions and try again' , $ path ) ) ; } } } unset ( $ this -> installationMap [ $ path ] ) ; unset ( $ this -> installationMap [ '__CHECKSUMS__' ] [ $ path ] ) ; } // // Sort our paths by length // uksort ( $ this -> installationMap , function ( $ a , $ b ) { if ( strlen ( $ a ) == strlen ( $ b ) ) { return 0 ; } if ( strlen ( $ a ) > strlen ( $ b ) ) { return - 1 ; } return 1 ; } ) ; }
Cleans up our map and installations, removing any files no longer mapped to packages

@access private
@return void
Cleans up our map and installations removing any files no longer mapped to packages