];
///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
//Flush to get the ids
$this->doctrine->getManager()->flush();
- //Close curl handler
- $this->curl_close();
-
//Return success
return self::SUCCESS;
}
//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);
}
//Display response
var_dump($response);
- //Close curl handler
- curl_close($this->ch);
-
//Exit with failure
exit(self::FAILURE);
}
//Display response
var_dump($response);
- //Close curl handler
- curl_close($this->ch);
-
//Exit with failure
exit(self::FAILURE);
}
//Display response
var_dump($response);
- //Close curl handler
- curl_close($this->ch);
-
//Exit with failure
exit(self::FAILURE);
}
//Display response
var_dump($header);
- //Close curl handler
- curl_close($this->ch);
-
//Exit with failure
exit(self::FAILURE);
}
//Return content
return substr($response, $hs);
}
-
- /**
- * Close curl handler
- *
- * @return bool Return success or failure
- */
- function curl_close() {
- return curl_close($this->ch);
- }
}