Skip to content
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

Naming params added custom response code #3

Open
wants to merge 4 commits into
base: naming_params
Choose a base branch
from

Conversation

patres36
Copy link

No description provided.

patres and others added 4 commits January 16, 2018 17:09
@@ -20,6 +20,10 @@
abstract class Implementation
{

const ERROR_STATUS_CODE = 500;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -25,6 +25,8 @@

class Server implements ServerInterface
{
const HTTP_SUCCESS_STATUS = 200;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Symfony's response constants and remove this.

* @param int $code Error code (default = 0)
* @param int $httpStatusCode HTTP status code to send (default = 400)
*/
public function __construct($message, $code = 0, $httpStatusCode = 400)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The __construct must always be the first method to increase readability according to https://symfony.com/doc/current/contributing/code/standards.html

}

if (empty($data['jsonrpc']) || version_compare($data['jsonrpc'], '2.0', '<')) {
throw new InvalidJsonRpcVersion('The JSON-RPC call version is not supported', self::ERROR_SERVER_ERROR);
throw new InvalidJsonRpcVersion('The JSON-RPC call version is not supported', self::ERROR_SERVER_ERROR, self::ERROR_INVALID_REQUEST);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self::ERROR_INVALID_REQUEST is not a status code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants