-
Notifications
You must be signed in to change notification settings - Fork 344
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
Allow a Run to be imported over the network #230
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,21 @@ | |
|
||
class Xhgui_Controller_Run extends Xhgui_Controller | ||
{ | ||
/** | ||
* @var \Slim\Slim | ||
*/ | ||
protected $_app; | ||
|
||
/** | ||
* @var Xhgui_Profiles | ||
*/ | ||
private $_profiles; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Property name "$_profiles" should not be prefixed with an underscore to indicate visibility There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have used the same style as used elsewhere in the application. |
||
|
||
/** | ||
* @var Xhgui_WatchFunctions | ||
*/ | ||
private $_watches; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Property name "$_watches" should not be prefixed with an underscore to indicate visibility There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have used the same style as used elsewhere in the application. |
||
|
||
public function __construct($app, $profiles, $watches) | ||
{ | ||
$this->_app = $app; | ||
|
@@ -309,4 +324,17 @@ public function callgraphDataDot() | |
$response['Content-Type'] = 'application/json'; | ||
return $response->body(json_encode($callgraph)); | ||
} | ||
|
||
public function import() | ||
{ | ||
$request = $this->_app->request(); | ||
|
||
$data = json_decode($request->getBody(), true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no authentication, authorization or checksums on this data right now. Should there be? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I realize that. It was a conscious choice, since there were none of these in the rest of the project as well. Furthermore, I assumed that XHGui, being a tool that is primarily used during development (imho), would be deployed in a somewhat trusted environment, like a staging server, or a developers' workstation. |
||
|
||
$container = Xhgui_ServiceContainer::instance(); | ||
/* @var Xhgui_Saver_Mongo $saver */ | ||
$saver = $container['saverMongo']; | ||
|
||
$saver->save($data); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Property name "$_app" should not be prefixed with an underscore to indicate visibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have used the same style as used elsewhere in the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some work to be done in order to get the code up to a PSR2 level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that required for the passing of this PR? I kept as close to the original coding style as possible. I'm perfectly willing to bring the code that I've touched in line with PSR2.
However, adding "Upgrade the whole project to PSR-2" in the critical path would completely destroy the cost-benefit ratio of pursuing this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to upgrade the entire project to PSR-2 but you should make sure your code changes pass the build and follow the chosen coding standards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. As I said: I'm perfectly willing to fix the code I touched.
Already did so, and also a few small other CS fixes. See the last commit.