RMR - Resource-Method-Representation pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// taken from http://www.peej.co.uk/articles/rmr-architecture.html | |
class Resource { | |
private resourceData = []; | |
method constructor(request, dataSource) { | |
// load data from data source | |
} | |
method get(request) { | |
return new Response(200, getRepresentation(request.url, resourceData)); | |
} | |
method put(request) { | |
return new Response(405); | |
} | |
method post(request) { | |
return new Response(405); | |
} | |
method delete(request) { | |
return new Response(405); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment