Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

@@ 305-316 (lines=12) @@
302
        ));
303
    }
304
305
    public function callgraphData()
306
    {
307
        $request = $this->app->request();
308
        $response = $this->app->response();
309
        $profile = $this->profiles->get($request->get('id'));
310
        $metric = $request->get('metric') ?: 'wt';
311
        $threshold = (float)$request->get('threshold') ?: 0.01;
312
        $callgraph = $profile->getCallgraph($metric, $threshold);
313
314
        $response['Content-Type'] = 'application/json';
315
        return $response->body(json_encode($callgraph));
316
    }
317
318
    public function flamegraph()
319
    {
@@ 330-341 (lines=12) @@
327
        ));
328
    }
329
330
    public function flamegraphData()
331
    {
332
        $request = $this->app->request();
333
        $response = $this->app->response();
334
        $profile = $this->profiles->get($request->get('id'));
335
        $metric = $request->get('metric') ?: 'wt';
336
        $threshold = (float)$request->get('threshold') ?: 0.01;
337
        $flamegraph = $profile->getFlamegraph($metric, $threshold);
338
339
        $response['Content-Type'] = 'application/json';
340
        return $response->body(json_encode($flamegraph));
341
    }
342
343
    public function callgraphDataDot()
344
    {
@@ 343-354 (lines=12) @@
340
        return $response->body(json_encode($flamegraph));
341
    }
342
343
    public function callgraphDataDot()
344
    {
345
        $request = $this->app->request();
346
        $response = $this->app->response();
347
        $profile = $this->profiles->get($request->get('id'));
348
        $metric = $request->get('metric') ?: 'wt';
349
        $threshold = (float)$request->get('threshold') ?: 0.01;
350
        $callgraph = $profile->getCallgraphNodes($metric, $threshold);
351
352
        $response['Content-Type'] = 'application/json';
353
        return $response->body(json_encode($callgraph));
354
    }
355
}
356