public function kill()
{
$state = $this->getState();
if (in_array($state, [self::STATE_T_KILL])) {
$this->getLogger()->info("Daemon can't KILL, cause state : {$state}", [__NAMESPACE__]);
return true;
}
if (!in_array($state, [self::STATE_T_START, self::STATE_T_STOP])) {
$this->getLogger()->info("Daemon can't KILL, cause daemon not START or STOP", [__NAMESPACE__]);
return true;
}
$this->setState(self::STATE_T_KILL);
// ==========================
$this->getLogger()->info("Daemon kill process : {$this->getProcessId()}", [__NAMESPACE__]);
if ($this->processExists()) {
$this->processKill();
}
// ==========================
$this->cleanData();
return true;
}