Code Duplication    Length = 12-12 lines in 3 locations

packages/autoloader/src/AutoloadGenerator.php 3 locations

@@ 129-140 (lines=12) @@
126
				$installPath = substr( $installPath, 0, -strlen( '/' . $package->getTargetDir() ) );
127
			}
128
129
			if ( 'psr-4' === $type && isset( $autoload['psr-4'] ) && is_array( $autoload['psr-4'] ) ) {
130
				foreach ( $autoload['psr-4'] as $namespace => $paths ) {
131
					$paths = is_array( $paths ) ? $paths : array( $paths );
132
					foreach ( $paths as $path ) {
133
						$relativePath              = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
134
						$autoloads[ $namespace ][] = array(
135
							'path'    => $relativePath,
136
							'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
137
						);
138
					}
139
				}
140
			}
141
142
			if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
143
				foreach ( $autoload['classmap'] as $paths ) {
@@ 142-153 (lines=12) @@
139
				}
140
			}
141
142
			if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
143
				foreach ( $autoload['classmap'] as $paths ) {
144
					$paths = is_array( $paths ) ? $paths : array( $paths );
145
					foreach ( $paths as $path ) {
146
						$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
147
						$autoloads[]  = array(
148
							'path'    => $relativePath,
149
							'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
150
						);
151
					}
152
				}
153
			}
154
			if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
155
				foreach ( $autoload['files'] as $file_id => $paths ) {
156
					$paths = is_array( $paths ) ? $paths : array( $paths );
@@ 154-165 (lines=12) @@
151
					}
152
				}
153
			}
154
			if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
155
				foreach ( $autoload['files'] as $file_id => $paths ) {
156
					$paths = is_array( $paths ) ? $paths : array( $paths );
157
					foreach ( $paths as $path ) {
158
						$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
159
						$autoloads[ $this->getFileIdentifier( $package, $path ) ]  = array(
160
							'path'    => $relativePath,
161
							'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
162
						);
163
					}
164
				}
165
			}
166
		}
167
168
		return $autoloads;