mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +00:00
AsyncTask: regroup some methods into more sensible places
how the fuck is anyone supposed to find anything??
This commit is contained in:
parent
eb9188c309
commit
f5a4baf3cf
@ -104,6 +104,10 @@ abstract class AsyncTask extends \Threaded{
|
|||||||
return $this->finished or $this->isCrashed();
|
return $this->finished or $this->isCrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasResult() : bool{
|
||||||
|
return $this->result !== null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
@ -115,18 +119,6 @@ abstract class AsyncTask extends \Threaded{
|
|||||||
return $this->result;
|
return $this->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cancelRun() : void{
|
|
||||||
$this->cancelRun = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasCancelledRun() : bool{
|
|
||||||
return $this->cancelRun;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasResult() : bool{
|
|
||||||
return $this->result !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $result
|
* @param mixed $result
|
||||||
*/
|
*/
|
||||||
@ -134,6 +126,13 @@ abstract class AsyncTask extends \Threaded{
|
|||||||
$this->result = ($this->serialized = !is_scalar($result)) ? igbinary_serialize($result) : $result;
|
$this->result = ($this->serialized = !is_scalar($result)) ? igbinary_serialize($result) : $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function cancelRun() : void{
|
||||||
|
$this->cancelRun = true;
|
||||||
|
}
|
||||||
|
public function hasCancelledRun() : bool{
|
||||||
|
return $this->cancelRun;
|
||||||
|
}
|
||||||
|
|
||||||
public function setSubmitted() : void{
|
public function setSubmitted() : void{
|
||||||
$this->submitted = true;
|
$this->submitted = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user