X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/airbundle/blobdiff_plain/040b7bc3a279d41f7c7d063e7bbf5a5a5de44da4..fb67440503df9cfbc2e0d2c0ed739bcc8a24f759:/Command/WeatherCommand.php diff --git a/Command/WeatherCommand.php b/Command/WeatherCommand.php index a7572b0..4bce668 100644 --- a/Command/WeatherCommand.php +++ b/Command/WeatherCommand.php @@ -75,27 +75,15 @@ class WeatherCommand extends DoctrineCommand { ]; ///Set curl handler - private $ch = null; - - ///Set manager registry - private $doctrine; - - ///Set filesystem - private $filesystem; + private \CurlHandle|false $ch = false; ///Weather command constructor - public function __construct(ManagerRegistry $doctrine, Filesystem $filesystem) { + public function __construct(private ManagerRegistry $doctrine, private Filesystem $filesystem) { parent::__construct($doctrine); - - //Set entity manager - $this->doctrine = $doctrine; - - //Set filesystem - $this->filesystem = $filesystem; } ///Configure attribute command - protected function configure() { + protected function configure():void { //Configure the class $this //Set name @@ -504,9 +492,6 @@ class WeatherCommand extends DoctrineCommand { //Flush to get the ids $this->doctrine->getManager()->flush(); - //Close curl handler - $this->curl_close(); - //Return success return self::SUCCESS; } @@ -653,9 +638,6 @@ class WeatherCommand extends DoctrineCommand { //Display error echo 'Setopt for '.$url.' failed: '.curl_error($this->ch)."\n"; - //Close curl handler - curl_close($this->ch); - //Exit with failure exit(self::FAILURE); } @@ -671,9 +653,6 @@ class WeatherCommand extends DoctrineCommand { //Display response var_dump($response); - //Close curl handler - curl_close($this->ch); - //Exit with failure exit(self::FAILURE); } @@ -689,9 +668,6 @@ class WeatherCommand extends DoctrineCommand { //Display response var_dump($response); - //Close curl handler - curl_close($this->ch); - //Exit with failure exit(self::FAILURE); } @@ -707,9 +683,6 @@ class WeatherCommand extends DoctrineCommand { //Display response var_dump($response); - //Close curl handler - curl_close($this->ch); - //Exit with failure exit(self::FAILURE); } @@ -725,9 +698,6 @@ class WeatherCommand extends DoctrineCommand { //Display response var_dump($header); - //Close curl handler - curl_close($this->ch); - //Exit with failure exit(self::FAILURE); } @@ -735,13 +705,4 @@ class WeatherCommand extends DoctrineCommand { //Return content return substr($response, $hs); } - - /** - * Close curl handler - * - * @return bool Return success or failure - */ - function curl_close() { - return curl_close($this->ch); - } }