Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

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