Passed
Push — master ( 2df217...792a3a )
by Gaetano
06:04
created

ServerController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 18
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serve() 0 7 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Controller;
4
5
use PhpXmlRpc\Server;
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
0 ignored issues
show
Bug introduced by
The type Symfony\Bundle\Framework...ller\AbstractController 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...
7
use Symfony\Component\HttpFoundation\Response;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\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...
8
use Symfony\Component\Routing\Annotation\Route;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Routing\Annotation\Route 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...
9
10
class ServerController extends AbstractController
11
{
12
    protected $server;
13
14
    public function __construct(Server $server)
15
    {
16
        $this->server = $server;
17
    }
18
19
    # This single method serves ALL the xml-rpc requests.
20
    # The configuration for which xml-rpc methods exist and how they are handled is carried out in the Server service
21
    #[Route('/xmlrpc', name: 'xml_rpc', methods: ['POST'])]
22
    public function serve(): Response
23
    {
24
        $xmlrpcResponse = $this->server->service(null, true);
25
        $response = new Response($xmlrpcResponse, 200, ['Content-Type' => 'text/xml']);
26
        // there should be no need to avoid caching since this is only accessed via POST
27
        return $response;
28
    }
29
}
30