66
77use Composer \Semver \Comparator ;
88use Magento \Framework \App \ProductMetadataInterface ;
9+ use Magento \Framework \App \ResourceConnection ;
910use Magento \Framework \Console \Cli ;
1011use Magento \Framework \Escaper ;
12+ use Magento \Framework \HTTP \ClientFactory ;
1113use OpenForgeProject \MageForge \Console \Command \AbstractCommand ;
1214use Symfony \Component \Console \Helper \TableSeparator ;
1315use Symfony \Component \Console \Input \InputInterface ;
@@ -27,6 +29,8 @@ class CheckCommand extends AbstractCommand
2729 public function __construct (
2830 private readonly ProductMetadataInterface $ productMetadata ,
2931 private readonly Escaper $ escaper ,
32+ private readonly ResourceConnection $ resourceConnection ,
33+ private readonly ClientFactory $ httpClientFactory
3034 ) {
3135 parent ::__construct ();
3236 }
@@ -181,9 +185,7 @@ private function getShortMysqlVersion(): string
181185 private function getMysqlVersionViaMagento (): ?string
182186 {
183187 try {
184- $ objectManager = \Magento \Framework \App \ObjectManager::getInstance ();
185- $ resource = $ objectManager ->get (\Magento \Framework \App \ResourceConnection::class);
186- $ connection = $ resource ->getConnection ();
188+ $ connection = $ this ->resourceConnection ->getConnection ();
187189 $ version = $ connection ->fetchOne ('SELECT VERSION() ' );
188190
189191 return !empty ($ version ) ? $ version : null ;
@@ -584,9 +586,7 @@ private function testElasticsearchConnection(string $url)
584586 private function tryMagentoHttpClient (string $ url ): ?array
585587 {
586588 try {
587- $ objectManager = \Magento \Framework \App \ObjectManager::getInstance ();
588- $ httpClientFactory = $ objectManager ->get (\Magento \Framework \HTTP \ClientFactory::class);
589- $ httpClient = $ httpClientFactory ->create ();
589+ $ httpClient = $ this ->httpClientFactory ->create ();
590590 $ httpClient ->setTimeout (2 );
591591 $ httpClient ->get ($ url );
592592
0 commit comments