Skip to content

Please use "protected" instead of "private" #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/JsonRpc/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
class Server
{

private $handler;
private $transport = null;
private $logger = null;
private $assoc = false;
private $requests = array();
private $responses = array();
private $error = null;
private $handlerError = null;
private $refClass = null;
protected $handler;
protected $transport = null;
protected $logger = null;
protected $assoc = false;
protected $requests = array();
protected $responses = array();
protected $error = null;
protected $handlerError = null;
protected $refClass = null;


public function __construct($methodHandler, $transport = null)
Expand Down Expand Up @@ -74,7 +74,7 @@ public function setObjectsAsArrays()
}


private function process($json)
protected function process($json)
{

if (!$struct = Rpc::decode($json, $batch))
Expand All @@ -95,7 +95,7 @@ private function process($json)
}


private function getRequests($struct)
protected function getRequests($struct)
{

if (is_array($struct))
Expand All @@ -115,7 +115,7 @@ private function getRequests($struct)
}


private function processRequests()
protected function processRequests()
{

foreach ($this->requests as $request)
Expand Down Expand Up @@ -149,7 +149,7 @@ private function processRequests()
}


private function processRequest($method, $params)
protected function processRequest($method, $params)
{

$this->error = null;
Expand Down Expand Up @@ -179,8 +179,8 @@ private function processRequest($method, $params)
}
catch (\Exception $e)
{
$this->logException($e);
$this->error = Rpc::ERR_INTERNAL;
$this->logException($e);

return;
}
Expand All @@ -195,7 +195,7 @@ private function processRequest($method, $params)
}


private function addResponse($request, $result)
protected function addResponse($request, $result)
{

$ar = array(
Expand Down Expand Up @@ -224,7 +224,7 @@ private function addResponse($request, $result)
}


private function getCallback($method)
protected function getCallback($method)
{

$callback = array($this->handler, $method);
Expand All @@ -237,7 +237,7 @@ private function getCallback($method)
}


private function checkMethod($method, &$params)
protected function checkMethod($method, &$params)
{

try
Expand Down Expand Up @@ -322,7 +322,7 @@ private function checkMethod($method, &$params)
}


private function getParams($params)
protected function getParams($params)
{

if (is_object($params))
Expand All @@ -339,7 +339,7 @@ private function getParams($params)
}


private function castObjectsToArrays(&$params)
protected function castObjectsToArrays(&$params)
{

foreach ($params as &$param)
Expand All @@ -355,7 +355,7 @@ private function castObjectsToArrays(&$params)
}


private function getHandlerError()
protected function getHandlerError()
{

if ($this->handlerError)
Expand All @@ -374,7 +374,7 @@ private function getHandlerError()

}

private function clearHandlerError()
protected function clearHandlerError()
{

if ($this->handlerError)
Expand All @@ -393,14 +393,14 @@ private function clearHandlerError()

}

private function logException(\Exception $e)
protected function logException(\Exception $e)
{
$message = 'Exception: '. $e->getMessage();
$message .= ' in ' . $e->getFile() . ' on line ' . $e->getLine();
$this->logError($message);
}

private function logError($message)
protected function logError($message)
{

try
Expand Down Expand Up @@ -432,7 +432,7 @@ private function logError($message)

}

private function init()
protected function init()
{
$this->requests = array();
$this->responses = array();
Expand Down