Code Duplication    Length = 12-12 lines in 3 locations

src/Xhgui/Controller/Run.php 3 locations

@@ 277-288 (lines=12) @@
274
        ));
275
    }
276
277
    public function callgraphData()
278
    {
279
        $request = $this->_app->request();
280
        $response = $this->_app->response();
281
        $profile = $this->_profiles->get($request->get('id'));
282
        $metric = $request->get('metric') ?: 'wt';
283
        $threshold = (float)$request->get('threshold') ?: 0.01;
284
        $callgraph = $profile->getCallgraph($metric, $threshold);
285
286
        $response['Content-Type'] = 'application/json';
287
        return $response->body(json_encode($callgraph));
288
    }
289
290
    public function flamegraph()
291
    {
@@ 302-313 (lines=12) @@
299
        ));
300
    }
301
302
    public function flamegraphData()
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
        $flamegraph = $profile->getFlamegraph($metric, $threshold);
310
311
        $response['Content-Type'] = 'application/json';
312
        return $response->body(json_encode($flamegraph));
313
    }
314
315
    public function callgraphDataDot()
316
    {
@@ 315-326 (lines=12) @@
312
        return $response->body(json_encode($flamegraph));
313
    }
314
315
    public function callgraphDataDot()
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
        $callgraph = $profile->getCallgraphNodes($metric, $threshold);
323
324
        $response['Content-Type'] = 'application/json';
325
        return $response->body(json_encode($callgraph));
326
    }
327
328
    public function import()
329
    {