Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

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