Passed
Push — master ( cdbf03...0df18a )
by Aimeos
04:18
created

GraphqlController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 11
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * @license MIT, http://opensource.org/licenses/MIT
5
 * @copyright Aimeos (aimeos.org), 2015-2016
6
 * @package symfony
7
 * @subpackage Controller
8
 */
9
10
11
namespace Aimeos\ShopBundle\Controller;
12
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
15
16
17
/**
18
 * Aimeos controller for the /admin/{site}/graphql route
19
 *
20
 * @package symfony
21
 * @subpackage Controller
22
 */
23
class GraphqlController extends AbstractController
24
{
25
	/**
26
	 * Returns the initial HTML view for the admin interface.
27
	 *
28
	 * @param Request $request Symfony request object
29
	 * @return Response Generated HTML page for the admin interface
0 ignored issues
show
Bug introduced by
The type Aimeos\ShopBundle\Controller\Response was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
	 */
31
	public function indexAction( Request $request, \Twig\Environment $twig ) : \Symfony\Component\HttpFoundation\Response
32
	{
33
		$site = $request->get( 'site', 'default' );
34
		$lang = $request->get( 'locale', 'en' );
35
36
		$context = $this->container->get( 'aimeos.context' )->get( false, 'backend' );
37
		$context->setI18n( $this->container->get( 'aimeos.i18n' )->get( array( $lang, 'en' ) ) );
38
		$context->setLocale( $this->container->get( 'aimeos.locale' )->getBackend( $context, $site ) );
39
		$context->setView( $this->container->get( 'aimeos.view' )->create( $context, [], $lang ) );
40
41
		return $this->createResponse( \Aimeos\Admin\Graphql::execute( $context, $this->createRequest( $request ) ) );
0 ignored issues
show
Bug introduced by
The type Aimeos\Admin\Graphql was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
	}
43
44
45
	protected function createRequest( Request $reqest ) : \Psr\Http\Message\RequestInterface
46
	{
47
		$psr17Factory = new Psr17Factory();
0 ignored issues
show
Bug introduced by
The type Aimeos\ShopBundle\Controller\Psr17Factory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
48
		$psrHttpFactory = new PsrHttpFactory( $psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory );
0 ignored issues
show
Bug introduced by
The type Aimeos\ShopBundle\Controller\PsrHttpFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
50
		return $psrHttpFactory->createRequest( $reqest );
51
	}
52
53
54
	protected function createResponse( \Psr\Http\Message\ResponseInterface $response ) : Response
55
	{
56
		$httpFoundationFactory = new HttpFoundationFactory();
0 ignored issues
show
Bug introduced by
The type Aimeos\ShopBundle\Controller\HttpFoundationFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
57
		return $httpFoundationFactory->createResponse( $response );
58
	}
59
}
60