Code Duplication    Length = 12-12 lines in 3 locations

packages/autoloader/src/AutoloadGenerator.php 3 locations

@@ 154-165 (lines=12) @@
151
				$installPath = substr( $installPath, 0, -strlen( '/' . $package->getTargetDir() ) );
152
			}
153
154
			if ( 'psr-4' === $type && isset( $autoload['psr-4'] ) && is_array( $autoload['psr-4'] ) ) {
155
				foreach ( $autoload['psr-4'] as $namespace => $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[ $namespace ][] = array(
160
							'path'    => $relativePath,
161
							'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
162
						);
163
					}
164
				}
165
			}
166
167
			if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
168
				foreach ( $autoload['classmap'] as $paths ) {
@@ 167-178 (lines=12) @@
164
				}
165
			}
166
167
			if ( 'classmap' === $type && isset( $autoload['classmap'] ) && is_array( $autoload['classmap'] ) ) {
168
				foreach ( $autoload['classmap'] as $paths ) {
169
					$paths = is_array( $paths ) ? $paths : array( $paths );
170
					foreach ( $paths as $path ) {
171
						$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
172
						$autoloads[]  = array(
173
							'path'    => $relativePath,
174
							'version' => $package->getVersion(), // Version of the class comes from the package - should we try to parse it?
175
						);
176
					}
177
				}
178
			}
179
			if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
180
				foreach ( $autoload['files'] as $file_id => $paths ) {
181
					$paths = is_array( $paths ) ? $paths : array( $paths );
@@ 179-190 (lines=12) @@
176
					}
177
				}
178
			}
179
			if ( 'files' === $type && isset( $autoload['files'] ) && is_array( $autoload['files'] ) ) {
180
				foreach ( $autoload['files'] as $file_id => $paths ) {
181
					$paths = is_array( $paths ) ? $paths : array( $paths );
182
					foreach ( $paths as $path ) {
183
						$relativePath = empty( $installPath ) ? ( empty( $path ) ? '.' : $path ) : $installPath . '/' . $path;
184
						$autoloads[ $this->getFileIdentifier( $package, $path ) ] = array(
185
							'path'    => $relativePath,
186
							'version' => $package->getVersion(), // Version of the file comes from the package - should we try to parse it?
187
						);
188
					}
189
				}
190
			}
191
		}
192
193
		return $autoloads;