data = $rpc['params']; } else { $this->data = array(); } } /** * * @param string $rpcMethod * @return string */ public function getService($rpcMethod = null) { $service = null; if ($rpcMethod != null) { $service = substr($rpcMethod, 0, strpos($rpcMethod, '.')); } else { $service = substr($this->service, 0, strpos($this->service, '.')); } // Accepts both 'mediaItems' and 'mediaitems'. if ($service == 'mediaItems') { $service = 'mediaitems'; } return $service; } /** * * @param string $rpcMethod * @return string */ public function getOperation($rpcMethod = null) { if ($rpcMethod != null) { $op = substr($rpcMethod, strpos($rpcMethod, '.') + 1); } else { $op = substr($this->operation, strpos($this->operation, '.') + 1); } return $op; } /** * * @param string $rpcMethod * @return string */ public function getMethod($rpcMethod = null) { return $this->getOperation($rpcMethod); } /** * * @return array */ public function getParameters() { return $this->data; } /** * * @param string $paramName * @param string $defaultValue * @return string */ public function getParameter($paramName, $defaultValue = null) { if (isset($this->data[$paramName])) { return $this->data[$paramName]; } else { return $defaultValue; } } /** * * @param string $paramName * @return array */ public function getListParameter($paramName) { if (isset($this->data[$paramName])) { if (is_array($this->data[$paramName])) { return $this->data[$paramName]; } else { // Allow up-conversion of non-array to array params. return array($this->data[$paramName]); } } else { return array(); } } /** * * @param string $urlTemplate */ public function applyUrlTemplate($urlTemplate) { // No params in the URL } }