Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

@@ 262-273 (lines=12) @@
259
        ));
260
    }
261
262
    public function callgraphData()
263
    {
264
        $request = $this->_app->request();
265
        $response = $this->_app->response();
266
        $profile = $this->_profiles->get($request->get('id'));
267
        $metric = $request->get('metric') ?: 'wt';
268
        $threshold = (float)$request->get('threshold') ?: 0.01;
269
        $callgraph = $profile->getCallgraph($metric, $threshold);
270
271
        $response['Content-Type'] = 'application/json';
272
        return $response->body(json_encode($callgraph));
273
    }
274
275
    public function flamegraph()
276
    {
@@ 287-298 (lines=12) @@
284
        ));
285
    }
286
287
    public function flamegraphData()
288
    {
289
        $request = $this->_app->request();
290
        $response = $this->_app->response();
291
        $profile = $this->_profiles->get($request->get('id'));
292
        $metric = $request->get('metric') ?: 'wt';
293
        $threshold = (float)$request->get('threshold') ?: 0.01;
294
        $flamegraph = $profile->getFlamegraph($metric, $threshold);
295
296
        $response['Content-Type'] = 'application/json';
297
        return $response->body(json_encode($flamegraph));
298
    }
299
300
    public function callgraphDataDot()
301
    {
@@ 300-311 (lines=12) @@
297
        return $response->body(json_encode($flamegraph));
298
    }
299
300
    public function callgraphDataDot()
301
    {
302
        $request = $this->_app->request();
303
        $response = $this->_app->response();
304
        $profile = $this->_profiles->get($request->get('id'));
305
        $metric = $request->get('metric') ?: 'wt';
306
        $threshold = (float)$request->get('threshold') ?: 0.01;
307
        $callgraph = $profile->getCallgraphNodes($metric, $threshold);
308
309
        $response['Content-Type'] = 'application/json';
310
        return $response->body(json_encode($callgraph));
311
    }
312
}
313