Code Duplication    Length = 12-12 lines in 3 locations

packages/autoloader/src/AutoloadGenerator.php 3 locations

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