Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

@@ 274-285 (lines=12) @@
271
        ));
272
    }
273
274
    public function callgraphData()
275
    {
276
        $request = $this->app->request();
277
        $response = $this->app->response();
278
        $profile = $this->profiles->get($request->get('id'));
279
        $metric = $request->get('metric') ?: 'wt';
280
        $threshold = (float)$request->get('threshold') ?: 0.01;
281
        $callgraph = $profile->getCallgraph($metric, $threshold);
282
283
        $response['Content-Type'] = 'application/json';
284
        return $response->body(json_encode($callgraph));
285
    }
286
287
    public function flamegraph()
288
    {
@@ 299-310 (lines=12) @@
296
        ));
297
    }
298
299
    public function flamegraphData()
300
    {
301
        $request = $this->app->request();
302
        $response = $this->app->response();
303
        $profile = $this->profiles->get($request->get('id'));
304
        $metric = $request->get('metric') ?: 'wt';
305
        $threshold = (float)$request->get('threshold') ?: 0.01;
306
        $flamegraph = $profile->getFlamegraph($metric, $threshold);
307
308
        $response['Content-Type'] = 'application/json';
309
        return $response->body(json_encode($flamegraph));
310
    }
311
312
    public function callgraphDataDot()
313
    {
@@ 312-323 (lines=12) @@
309
        return $response->body(json_encode($flamegraph));
310
    }
311
312
    public function callgraphDataDot()
313
    {
314
        $request = $this->app->request();
315
        $response = $this->app->response();
316
        $profile = $this->profiles->get($request->get('id'));
317
        $metric = $request->get('metric') ?: 'wt';
318
        $threshold = (float)$request->get('threshold') ?: 0.01;
319
        $callgraph = $profile->getCallgraphNodes($metric, $threshold);
320
321
        $response['Content-Type'] = 'application/json';
322
        return $response->body(json_encode($callgraph));
323
    }
324
}
325