Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

@@ 290-301 (lines=12) @@
287
        ));
288
    }
289
290
    public function callgraphData()
291
    {
292
        $request = $this->app->request();
293
        $response = $this->app->response();
294
        $profile = $this->profiles->get($request->get('id'));
295
        $metric = $request->get('metric') ?: 'wt';
296
        $threshold = (float)$request->get('threshold') ?: 0.01;
297
        $callgraph = $profile->getCallgraph($metric, $threshold);
298
299
        $response['Content-Type'] = 'application/json';
300
        return $response->body(json_encode($callgraph));
301
    }
302
303
    public function flamegraph()
304
    {
@@ 315-326 (lines=12) @@
312
        ));
313
    }
314
315
    public function flamegraphData()
316
    {
317
        $request = $this->app->request();
318
        $response = $this->app->response();
319
        $profile = $this->profiles->get($request->get('id'));
320
        $metric = $request->get('metric') ?: 'wt';
321
        $threshold = (float)$request->get('threshold') ?: 0.01;
322
        $flamegraph = $profile->getFlamegraph($metric, $threshold);
323
324
        $response['Content-Type'] = 'application/json';
325
        return $response->body(json_encode($flamegraph));
326
    }
327
328
    public function callgraphDataDot()
329
    {
@@ 328-339 (lines=12) @@
325
        return $response->body(json_encode($flamegraph));
326
    }
327
328
    public function callgraphDataDot()
329
    {
330
        $request = $this->app->request();
331
        $response = $this->app->response();
332
        $profile = $this->profiles->get($request->get('id'));
333
        $metric = $request->get('metric') ?: 'wt';
334
        $threshold = (float)$request->get('threshold') ?: 0.01;
335
        $callgraph = $profile->getCallgraphNodes($metric, $threshold);
336
337
        $response['Content-Type'] = 'application/json';
338
        return $response->body(json_encode($callgraph));
339
    }
340
}
341