src/Phlexible/Bundle/DashboardBundle/Controller/InfoController.php
public function infoAction(Request $request)
    {
        $securityContext = $this->get('security.context');

        $lines = [];

        if ($securityContext->isGranted('ROLE_SUPER_ADMIN')) {
            $lines[] = [
                'Project:',
                $this->container->getParameter('phlexible_gui.project.title').' '
                    .$this->container->getParameter('phlexible_gui.project.version'),
            ];
            $lines[] = [
                'Env:',
                $this->container->getParameter('kernel.environment').($this->container->getParameter(
                    'kernel.debug'
                ) ? ' [DEBUG]' : ''),
            ];
            $lines[] = ['Host:', $request->server->get('SERVER_NAME').' ['.PHP_SAPI.']'];

            $connection = $this->getDoctrine()->getConnection();
            /* @var $connection \Doctrine\DBAL\Connection */

            $lines[] = [
                'Default Database:',
                $connection->getHost().' / '.$connection->getDatabase().' ['.$connection->getDriver()->getName(
                ).']',
            ];

            $lines[] = ['Session:', $request->getSession()->getId().' ['.$request->server->get('REMOTE_ADDR').']'];

            $lines[] = [
                'User:',
                $this->getUser()->getUsername().' ['.implode(', ', $this->getUser()->getRoles()).']',
            ];

            $lines[] = ['UserAgent:', $request->server->get('HTTP_USER_AGENT')];
        } else {
            $lines[] = [
                'Project:',
                $this->container->getParameter('phlexible_gui.project.title').' '
                .$this->container->getParameter('phlexible_gui.project.version'),
            ];
        }

        $l1 = 0;
        $l2 = 0;
        foreach ($lines as $line) {
            if (strlen($line[0]) > $l1) {
                $l1 = strlen($line[0]);
            }
            if (isset($line[1]) && strlen($line[1]) > $l2) {
                $l2 = strlen($line[1]);
            }
        }
        $table = '';
        foreach ($lines as $line) {
            $table .= str_pad($line[0], $l1 + 2);
            $table .= str_pad($line[1], $l2 + 2);
            if (isset($line[2])) {
                $table .= $line[2];
            }
            $table .= PHP_EOL;
        }
        $out = '<pre>'.$table.'</pre>';

        return new Response($out);
    }
public function infoAction(Request $request)
    {
        $securityContext = $this->get('security.context');

        $lines = [];

        if ($securityContext->isGranted('ROLE_SUPER_ADMIN')) {
            $lines[] = [
                'Project:',
                $this->container->getParameter('phlexible_gui.project.title').' '
                    .$this->container->getParameter('phlexible_gui.project.version'),
            ];
            $lines[] = [
                'Env:',
                $this->container->getParameter('kernel.environment').($this->container->getParameter(
                    'kernel.debug'
                ) ? ' [DEBUG]' : ''),
            ];
            $lines[] = ['Host:', $request->server->get('SERVER_NAME').' ['.PHP_SAPI.']'];

            $connection = $this->getDoctrine()->getConnection();
            /* @var $connection \Doctrine\DBAL\Connection */

            $lines[] = [
                'Default Database:',
                $connection->getHost().' / '.$connection->getDatabase().' ['.$connection->getDriver()->getName(
                ).']',
            ];

            $lines[] = ['Session:', $request->getSession()->getId().' ['.$request->server->get('REMOTE_ADDR').']'];

            $lines[] = [
                'User:',
                $this->getUser()->getUsername().' ['.implode(', ', $this->getUser()->getRoles()).']',
            ];

            $lines[] = ['UserAgent:', $request->server->get('HTTP_USER_AGENT')];
        } else {
            $lines[] = [
                'Project:',
                $this->container->getParameter('phlexible_gui.project.title').' '
                .$this->container->getParameter('phlexible_gui.project.version'),
            ];
        }

        $l1 = 0;
        $l2 = 0;
        foreach ($lines as $line) {
            if (strlen($line[0]) > $l1) {
                $l1 = strlen($line[0]);
            }
            if (isset($line[1]) && strlen($line[1]) > $l2) {
                $l2 = strlen($line[1]);
            }
        }
        $table = '';
        foreach ($lines as $line) {
            $table .= str_pad($line[0], $l1 + 2);
            $table .= str_pad($line[1], $l2 + 2);
            if (isset($line[2])) {
                $table .= $line[2];
            }
            $table .= PHP_EOL;
        }
        $out = '<pre>'.$table.'</pre>';

        return new Response($out);
    }
public function infoAction ( Request $ request ) { $ securityContext = $ this -> get ( 'security.context' ) ; $ lines = [ ] ; if ( $ securityContext -> isGranted ( 'ROLE_SUPER_ADMIN' ) ) { $ lines [ ] = [ 'Project:' , $ this -> container -> getParameter ( 'phlexible_gui.project.title' ) . ' ' . $ this -> container -> getParameter ( 'phlexible_gui.project.version' ) , ] ; $ lines [ ] = [ 'Env:' , $ this -> container -> getParameter ( 'kernel.environment' ) . ( $ this -> container -> getParameter ( 'kernel.debug' ) ? ' [DEBUG]' : '' ) , ] ; $ lines [ ] = [ 'Host:' , $ request -> server -> get ( 'SERVER_NAME' ) . ' [' . PHP_SAPI . ']' ] ; $ connection = $ this -> getDoctrine ( ) -> getConnection ( ) ; /* @var $connection \Doctrine\DBAL\Connection */ $ lines [ ] = [ 'Default Database:' , $ connection -> getHost ( ) . ' / ' . $ connection -> getDatabase ( ) . ' [' . $ connection -> getDriver ( ) -> getName ( ) . ']' , ] ; $ lines [ ] = [ 'Session:' , $ request -> getSession ( ) -> getId ( ) . ' [' . $ request -> server -> get ( 'REMOTE_ADDR' ) . ']' ] ; $ lines [ ] = [ 'User:' , $ this -> getUser ( ) -> getUsername ( ) . ' [' . implode ( ', ' , $ this -> getUser ( ) -> getRoles ( ) ) . ']' , ] ; $ lines [ ] = [ 'UserAgent:' , $ request -> server -> get ( 'HTTP_USER_AGENT' ) ] ; } else { $ lines [ ] = [ 'Project:' , $ this -> container -> getParameter ( 'phlexible_gui.project.title' ) . ' ' . $ this -> container -> getParameter ( 'phlexible_gui.project.version' ) , ] ; } $ l1 = 0 ; $ l2 = 0 ; foreach ( $ lines as $ line ) { if ( strlen ( $ line [ 0 ] ) > $ l1 ) { $ l1 = strlen ( $ line [ 0 ] ) ; } if ( isset ( $ line [ 1 ] ) && strlen ( $ line [ 1 ] ) > $ l2 ) { $ l2 = strlen ( $ line [ 1 ] ) ; } } $ table = '' ; foreach ( $ lines as $ line ) { $ table .= str_pad ( $ line [ 0 ] , $ l1 + 2 ) ; $ table .= str_pad ( $ line [ 1 ] , $ l2 + 2 ) ; if ( isset ( $ line [ 2 ] ) ) { $ table .= $ line [ 2 ] ; } $ table .= PHP_EOL ; } $ out = '<pre>' . $ table . '</pre>' ; return new Response ( $ out ) ; }
Return info.

@param Request $request

@return Response
@Route("", name="dashboard_info")
Return info .