Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

@@ 287-298 (lines=12) @@
284
        ));
285
    }
286
287
    public function callgraphData()
288
    {
289
        $request = $this->app->request();
290
        $response = $this->app->response();
291
        $profile = $this->profiles->get($request->get('id'));
292
        $metric = $request->get('metric') ?: 'wt';
293
        $threshold = (float)$request->get('threshold') ?: 0.01;
294
        $callgraph = $profile->getCallgraph($metric, $threshold);
295
296
        $response['Content-Type'] = 'application/json';
297
        return $response->body(json_encode($callgraph));
298
    }
299
300
    public function flamegraph()
301
    {
@@ 312-323 (lines=12) @@
309
        ));
310
    }
311
312
    public function flamegraphData()
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
        $flamegraph = $profile->getFlamegraph($metric, $threshold);
320
321
        $response['Content-Type'] = 'application/json';
322
        return $response->body(json_encode($flamegraph));
323
    }
324
325
    public function callgraphDataDot()
326
    {
@@ 325-336 (lines=12) @@
322
        return $response->body(json_encode($flamegraph));
323
    }
324
325
    public function callgraphDataDot()
326
    {
327
        $request = $this->app->request();
328
        $response = $this->app->response();
329
        $profile = $this->profiles->get($request->get('id'));
330
        $metric = $request->get('metric') ?: 'wt';
331
        $threshold = (float)$request->get('threshold') ?: 0.01;
332
        $callgraph = $profile->getCallgraphNodes($metric, $threshold);
333
334
        $response['Content-Type'] = 'application/json';
335
        return $response->body(json_encode($callgraph));
336
    }
337
}
338