11<?php
22
3- declare (strict_types=1 );
4-
53namespace Docker \API \Endpoint ;
64
75class BuildPrune extends \Docker \API \Runtime \Client \BaseEndpoint implements \Docker \API \Runtime \Client \Endpoint
86{
9- use \Docker \API \Runtime \Client \EndpointTrait;
10-
117 /**
12- * @param array $queryParameters {
13- *
14- * @var int $keep-storage Amount of disk space in bytes to keep for cache
15- * @var bool $all Remove all types of build cache
16- * @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to
17- * process on the list of build cache objects.
18- *
19- * Available filters:
20- *
21- * - `until=<duration>`: duration relative to daemon's time, during which build cache was not used, in Go's duration format (e.g., '24h')
22- * - `id=<id>`
23- * - `parent=<id>`
24- * - `type=<string>`
25- * - `description=<string>`
26- * - `inuse`
27- * - `shared`
28- * - `private`
29- *
30- * }
31- */
32- public function __construct (array $ queryParameters = [])
8+ *
9+ *
10+ * @param array $queryParameters {
11+ * @var int $keep-storage Amount of disk space in bytes to keep for cache
12+ * @var bool $all Remove all types of build cache
13+ * @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to
14+ process on the list of build cache objects.
15+
16+ Available filters:
17+
18+ - `until=<duration>`: duration relative to daemon's time, during which build cache was not used, in Go's duration format (e.g., '24h')
19+ - `id=<id>`
20+ - `parent=<id>`
21+ - `type=<string>`
22+ - `description=<string>`
23+ - `inuse`
24+ - `shared`
25+ - `private`
26+
27+ * }
28+ */
29+ public function __construct (array $ queryParameters = array ())
3330 {
3431 $ this ->queryParameters = $ queryParameters ;
3532 }
36-
37- public function getMethod (): string
33+ use \ Docker \ API \ Runtime \ Client \EndpointTrait;
34+ public function getMethod () : string
3835 {
3936 return 'POST ' ;
4037 }
41-
42- public function getUri (): string
38+ public function getUri () : string
4339 {
4440 return '/build/prune ' ;
4541 }
46-
47- public function getBody (\Symfony \Component \Serializer \SerializerInterface $ serializer , $ streamFactory = null ): array
42+ public function getBody (\Symfony \Component \Serializer \SerializerInterface $ serializer , $ streamFactory = null ) : array
4843 {
49- return [[] , null ] ;
44+ return array ( array () , null ) ;
5045 }
51-
52- public function getExtraHeaders (): array
46+ public function getExtraHeaders () : array
5347 {
54- return [ 'Accept ' => [ 'application/json ' ]] ;
48+ return array ( 'Accept ' => array ( 'application/json ' )) ;
5549 }
56-
57- protected function getQueryOptionsResolver (): \Symfony \Component \OptionsResolver \OptionsResolver
50+ protected function getQueryOptionsResolver () : \Symfony \Component \OptionsResolver \OptionsResolver
5851 {
5952 $ optionsResolver = parent ::getQueryOptionsResolver ();
60- $ optionsResolver ->setDefined (['keep-storage ' , 'all ' , 'filters ' ]);
61- $ optionsResolver ->setRequired ([]);
62- $ optionsResolver ->setDefaults ([]);
63- $ optionsResolver ->setAllowedTypes ('keep-storage ' , ['int ' ]);
64- $ optionsResolver ->setAllowedTypes ('all ' , ['bool ' ]);
65- $ optionsResolver ->setAllowedTypes ('filters ' , ['string ' ]);
66-
53+ $ optionsResolver ->setDefined (array ('keep-storage ' , 'all ' , 'filters ' ));
54+ $ optionsResolver ->setRequired (array ());
55+ $ optionsResolver ->setDefaults (array ());
56+ $ optionsResolver ->addAllowedTypes ('keep-storage ' , array ('int ' ));
57+ $ optionsResolver ->addAllowedTypes ('all ' , array ('bool ' ));
58+ $ optionsResolver ->addAllowedTypes ('filters ' , array ('string ' ));
6759 return $ optionsResolver ;
6860 }
69-
7061 /**
7162 * {@inheritdoc}
7263 *
7364 * @throws \Docker\API\Exception\BuildPruneInternalServerErrorException
7465 *
75- * @return \Docker\API\Model\BuildPrunePostResponse200|null
66+ * @return null| \Docker\API\Model\BuildPrunePostResponse200
7667 */
77- protected function transformResponseBody (string $ body , int $ status , \Symfony \Component \Serializer \SerializerInterface $ serializer , ?string $ contentType = null )
68+ protected function transformResponseBody (\ Psr \ Http \ Message \ ResponseInterface $ response , \Symfony \Component \Serializer \SerializerInterface $ serializer , ?string $ contentType = null )
7869 {
79- if ((null === $ contentType ) === false && (200 === $ status && false !== mb_strpos ($ contentType , 'application/json ' ))) {
70+ $ status = $ response ->getStatusCode ();
71+ $ body = (string ) $ response ->getBody ();
72+ if (is_null ($ contentType ) === false && (200 === $ status && mb_strpos ($ contentType , 'application/json ' ) !== false )) {
8073 return $ serializer ->deserialize ($ body , 'Docker \\API \\Model \\BuildPrunePostResponse200 ' , 'json ' );
8174 }
82- if (( null === $ contentType ) === false && (500 === $ status && false !== mb_strpos ($ contentType , 'application/json ' ))) {
83- throw new \Docker \API \Exception \BuildPruneInternalServerErrorException ($ serializer ->deserialize ($ body , 'Docker \\API \\Model \\ErrorResponse ' , 'json ' ));
75+ if (is_null ( $ contentType ) === false && (500 === $ status && mb_strpos ($ contentType , 'application/json ' ) !== false )) {
76+ throw new \Docker \API \Exception \BuildPruneInternalServerErrorException ($ serializer ->deserialize ($ body , 'Docker \\API \\Model \\ErrorResponse ' , 'json ' ), $ response );
8477 }
8578 }
86-
87- public function getAuthenticationScopes (): array
79+ public function getAuthenticationScopes () : array
8880 {
89- return [] ;
81+ return array () ;
9082 }
91- }
83+ }
0 commit comments