1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 09:38:57 +01:00

Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-03-28 17:48:16 +00:00 committed by StyleCI Bot
parent d2616003a1
commit 327b88e092
2 changed files with 54 additions and 19 deletions

View File

@ -102,7 +102,9 @@ class DataCenter
} catch (\danog\MadelineProto\Exception $e) { } catch (\danog\MadelineProto\Exception $e) {
} catch (\danog\MadelineProto\NothingInTheSocketException $e) { } catch (\danog\MadelineProto\NothingInTheSocketException $e) {
} }
if (isset($this->settings[$dc_config_number]['do_not_retry']) && $this->settings[$dc_config_number]['do_not_retry']) break; if (isset($this->settings[$dc_config_number]['do_not_retry']) && $this->settings[$dc_config_number]['do_not_retry']) {
break;
}
} }
switch ($x) { switch ($x) {
case 0: case 0:

View File

@ -93,26 +93,32 @@ if (!extension_loaded('php-libtgvoip')) {
$this->callState = $callState; $this->callState = $callState;
$this->protocol = $protocol; $this->protocol = $protocol;
} }
public function deInitVoIPController() public function deInitVoIPController()
{ {
} }
public function setVisualization($visualization) public function setVisualization($visualization)
{ {
$this->visualization = $visualization; $this->visualization = $visualization;
} }
public function getVisualization() public function getVisualization()
{ {
return $this->visualization; return $this->visualization;
} }
public function discard($reason = ["_" => "phoneCallDiscardReasonDisconnect"], $rating = [], $debug = false)
public function discard($reason = ['_' => 'phoneCallDiscardReasonDisconnect'], $rating = [], $debug = false)
{ {
if ($this->callState === self::CALL_STATE_ENDED || empty($this->configuration)) { if ($this->callState === self::CALL_STATE_ENDED || empty($this->configuration)) {
return false; return false;
} }
$this->MadelineProto->discard_call($this->callID, $reason, $rating, $debug); $this->MadelineProto->discard_call($this->callID, $reason, $rating, $debug);
$this->deinitVoIPController(); $this->deinitVoIPController();
return $this; return $this;
} }
public function accept() public function accept()
{ {
if ($this->callState !== self::CALL_STATE_INCOMING) { if ($this->callState !== self::CALL_STATE_INCOMING) {
@ -121,55 +127,75 @@ if (!extension_loaded('php-libtgvoip')) {
$this->callState = self::CALL_STATE_ACCEPTED; $this->callState = self::CALL_STATE_ACCEPTED;
if (!$this->MadelineProto->accept_call($this->callID)) { if (!$this->MadelineProto->accept_call($this->callID)) {
$this->discard_call(['_' => 'phoneCallDiscardReasonDisconnect']); $this->discard_call(['_' => 'phoneCallDiscardReasonDisconnect']);
return false; return false;
} }
return $this; return $this;
} }
public function close() public function close()
{ {
$this->deinitVoIPController(); $this->deinitVoIPController();
} }
public function startTheMagic() public function startTheMagic()
{ {
return $this; return $this;
} }
public function play($file) public function play($file)
{ {
$this->inputFiles []= $file; $this->inputFiles[] = $file;
return $this; return $this;
} }
public function playOnHold($files) public function playOnHold($files)
{ {
$this->holdFiles = $files; $this->holdFiles = $files;
} }
public function setOutputFile($file) public function setOutputFile($file)
{ {
$this->outputFile = $file; $this->outputFile = $file;
} }
public function unsetOutputFile() public function unsetOutputFile()
{ {
$this->outputFile = null; $this->outputFile = null;
} }
public function setMadeline($MadelineProto) { public function setMadeline($MadelineProto)
$this->MadelineProto = $MadelineProto; {
} $this->MadelineProto = $MadelineProto;
public function getProtocol() { }
return $this->protocol;
} public function getProtocol()
public function getOtherID() { {
return $this->otherID; return $this->protocol;
} }
public function getCallID() {
return $this->callID; public function getOtherID()
} {
public function isCreator() { return $this->otherID;
return $this->creator; }
}
public function getCallID()
{
return $this->callID;
}
public function isCreator()
{
return $this->creator;
}
public function whenCreated() public function whenCreated()
{ {
return isset($this->internalStorage['created']) ? $this->internalStorage['created'] : false; return isset($this->internalStorage['created']) ? $this->internalStorage['created'] : false;
} }
public function parseConfig() public function parseConfig()
{ {
if (count($this->configuration['endpoints'])) { if (count($this->configuration['endpoints'])) {
@ -197,29 +223,36 @@ if (!extension_loaded('php-libtgvoip')) {
$this->init_all(); $this->init_all();
} }
} }
private function init_all() {
private function init_all()
{
} }
public function getCallState() public function getCallState()
{ {
return $this->callState; return $this->callState;
} }
public function getVersion() public function getVersion()
{ {
return 'libponyvoip-1.0'; return 'libponyvoip-1.0';
} }
public function getPreferredRelayID() public function getPreferredRelayID()
{ {
return 0; return 0;
} }
public function getLastError() public function getLastError()
{ {
return ''; return '';
} }
public function getDebugLog() public function getDebugLog()
{ {
return ''; return '';
} }
public function getSignalBarsCount() public function getSignalBarsCount()
{ {
return $this->signal; return $this->signal;