private DependencyInfo createDependencyInfo ( PhpPackage phpPackage ) { String groupId = getGroupIdFromName ( phpPackage ) ; String artifactId = phpPackage . getName ( ) ; String version = phpPackage . getVersion ( ) ; String commit = phpPackage . getPackageSource ( ) . getReference ( ) ; if ( StringUtils . isNotBlank ( version ) || StringUtils . isNotBlank ( commit ) ) { DependencyInfo dependencyInfo = new DependencyInfo ( groupId , artifactId , version ) ; dependencyInfo . setCommit ( commit ) ; dependencyInfo . setDependencyType ( getDependencyType ( ) ) ; if ( this . addSha1 ) { String sha1 = null ; String sha1Source = StringUtils . isNotBlank ( version ) ? version : commit ; try { sha1 = this . hashCalculator . calculateSha1ByNameVersionAndType ( artifactId , sha1Source , DependencyType . PHP ) ; } catch ( IOException e ) { logger . debug ( "Failed to calculate sha1 of: {}" , artifactId ) ; } if ( sha1 != null ) { dependencyInfo . setSha1 ( sha1 ) ; } } return dependencyInfo ; } else { logger . debug ( "The parameters version and commit of {} are null" , phpPackage . getName ( ) ) ; return null ; } }
convert phpPackage to dependencyInfo object