77use Internal \DLoad \Module \Binary \Binary ;
88use Internal \DLoad \Module \Binary \BinaryProvider ;
99use Internal \DLoad \Module \Common \Config \Actions ;
10+ use Internal \DLoad \Module \Common \FileSystem \Path ;
1011use Internal \DLoad \Module \Downloader \SoftwareCollection ;
1112use Symfony \Component \Console \Attribute \AsCommand ;
1213use Symfony \Component \Console \Command \Command ;
@@ -47,7 +48,7 @@ protected function execute(
4748 // Get all software from collection
4849 $ collection = $ this ->container ->get (SoftwareCollection::class);
4950 $ binaryProvider = $ this ->container ->get (BinaryProvider::class);
50- $ softwareName = $ input ->getArgument ('software ' );
51+ $ softwareName = ( string ) $ input ->getArgument ('software ' );
5152
5253 // Get configuration if available
5354 $ configFile = $ this ->getConfigFile ($ input );
@@ -57,7 +58,7 @@ protected function execute(
5758 $ actions = $ this ->container ->get (Actions::class);
5859 }
5960
60- if ($ softwareName !== null ) {
61+ if ($ softwareName !== '' ) {
6162 return $ this ->showSoftwareDetails ($ softwareName , $ collection , $ binaryProvider , $ actions , $ output );
6263 }
6364
@@ -71,8 +72,8 @@ private function listAllSoftware(
7172 InputInterface $ input ,
7273 OutputInterface $ output ,
7374 ): int {
74- $ showAll = $ input ->getOption ('all ' );
75- $ destinationPath = \getcwd ();
75+ $ showAll = ( bool ) $ input ->getOption ('all ' );
76+ $ destinationPath = Path:: create (( string ) \getcwd () );
7677
7778 $ configSoftwareIds = [];
7879 if ($ actions !== null ) {
@@ -197,6 +198,9 @@ private function listAllSoftware(
197198 return Command::SUCCESS ;
198199 }
199200
201+ /**
202+ * @param non-empty-string $softwareName
203+ */
200204 private function showSoftwareDetails (
201205 string $ softwareName ,
202206 SoftwareCollection $ collection ,
@@ -242,7 +246,7 @@ private function showSoftwareDetails(
242246 ->writeln (\sprintf ('<info>Alias:</info> %s ' , $ software ->alias ));
243247 $ software ->description and $ output
244248 ->writeln (\sprintf ('<info>Description:</info> %s ' , $ software ->description ));
245- $ software ->homepage and $ output
249+ $ software ->homepage === null or $ output
246250 ->writeln (\sprintf ('<info>Homepage:</info> %s ' , $ software ->homepage ));
247251
248252 // Show project config information
@@ -292,9 +296,10 @@ private function displayBinaryDetails(?Binary $binary, OutputInterface $output):
292296 $ output ->writeln (\sprintf (' <info>Version:</info> %s ' , $ binary ->getVersion () ?? 'unknown ' ));
293297 $ output ->writeln (\sprintf (' <info>Size:</info> %s ' , $ this ->formatSize ($ binary ->getSize ())));
294298
295- $ output ->writeln (\sprintf (
299+ $ mtime = $ binary ->getMTime ();
300+ $ mtime === null or $ output ->writeln (\sprintf (
296301 ' <info>Last modified:</info> %s ' ,
297- $ binary -> getMTime () ->format ('Y-m-d H:i:s ' ),
302+ $ mtime ->format ('Y-m-d H:i:s ' ),
298303 ));
299304 }
300305
0 commit comments