gggeek /
phpxmlrpc
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Controller; |
||
| 4 | |||
| 5 | use PhpXmlRpc\Client; |
||
| 6 | use PhpXmlRpc\PhpXmlRpc; |
||
| 7 | use PhpXmlRpc\Request; |
||
| 8 | use PhpXmlRpc\Value; |
||
| 9 | use Psr\Log\LoggerInterface; |
||
|
0 ignored issues
–
show
|
|||
| 10 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
||
|
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 11 | use Symfony\Component\HttpFoundation\Response; |
||
|
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 12 | use Symfony\Component\HttpKernel\Exception\HttpException; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\HttpKe...Exception\HttpException 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use Symfony\Component\Routing\Annotation\Route; |
||
|
0 ignored issues
–
show
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | |||
| 15 | /** |
||
| 16 | * An example usage of the xml-rpc client, configured as a service, from within a Symfony controller |
||
| 17 | */ |
||
| 18 | class ClientController extends AbstractController |
||
| 19 | { |
||
| 20 | protected $client; |
||
| 21 | |||
| 22 | public function __construct(Client $client, LoggerInterface $logger = null) |
||
| 23 | { |
||
| 24 | $this->client = $client; |
||
| 25 | if ($logger) { |
||
| 26 | PhpXmlRpc::setLogger($logger); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | #[Route('/getStateName/{stateNo}', name: 'getstatename', methods: ['GET'])] |
||
| 31 | public function getStateName(int $stateNo): Response |
||
| 32 | { |
||
| 33 | $response = $this->client->send(new Request('examples.getStateName', [ |
||
| 34 | new Value($stateNo, Value::$xmlrpcInt) |
||
| 35 | ])); |
||
| 36 | if ($response->faultCode()) { |
||
| 37 | throw new HttpException(502, $response->faultString()); |
||
| 38 | } else { |
||
| 39 | return new Response("<html><body>State number $stateNo is: " . $response->value()->scalarVal() . '</body></html>'); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths