Code Duplication    Length = 24-24 lines in 12 locations

src/Objects/CallbackRequests.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class CallbackRequests extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $callbacks)
14
    {
15
        foreach ($callbacks as $name => $callback) {
16
            $this->setItem($name, $callback);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, CallbackRequest>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, CallbackRequest $callback): void
29
    {
30
        $this->items[$name] = $callback;
31
    }
32
}
33

src/Objects/Encodings.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Encodings extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $encodings)
14
    {
15
        foreach ($encodings as $name => $encoding) {
16
            $this->setItem($name, $encoding);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, Encoding>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, Encoding $encoding): void
29
    {
30
        $this->items[$name] = $encoding;
31
    }
32
}
33

src/Objects/Examples.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Examples extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $examples)
14
    {
15
        foreach ($examples as $name => $example) {
16
            $this->setItem($name, $example);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, ExampleAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, ExampleAggregate $example): void
29
    {
30
        $this->items[$name] = $example;
31
    }
32
}
33

src/Objects/Headers.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Headers extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $headers)
14
    {
15
        foreach ($headers as $name => $header) {
16
            $this->setItem($name, $header);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, HeaderAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, HeaderAggregate $header): void
29
    {
30
        $this->items[$name] = $header;
31
    }
32
}
33

src/Objects/Links.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Links extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $links)
14
    {
15
        foreach ($links as $name => $link) {
16
            $this->setItem($name, $link);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, LinkAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, LinkAggregate $links): void
29
    {
30
        $this->items[$name] = $links;
31
    }
32
}
33

src/Objects/MediaTypes.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class MediaTypes extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $mediaTypes)
14
    {
15
        foreach ($mediaTypes as $contentType => $mediaType) {
16
            $this->setItem($contentType, $mediaType);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, MediaType>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $contentType, MediaType $mediaType): void
29
    {
30
        $this->items[$contentType] = $mediaType;
31
    }
32
}
33

src/Objects/Parameters.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Parameters extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $parameters)
14
    {
15
        foreach ($parameters as $name => $parameter) {
16
            $this->setItem($name, $parameter);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, ParameterAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, ParameterAggregate $response): void
29
    {
30
        $this->items[$name] = $response;
31
    }
32
}
33

src/Objects/RequestBodies.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class RequestBodies extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $requestBodies)
14
    {
15
        foreach ($requestBodies as $name => $requestBody) {
16
            $this->setItem($name, $requestBody);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, RequestBodyAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, RequestBodyAggregate $requestBody): void
29
    {
30
        $this->items[$name] = $requestBody;
31
    }
32
}
33

src/Objects/Responses.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Responses extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $responses)
14
    {
15
        foreach ($responses as $name => $response) {
16
            $this->setItem($name, $response);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, ResponseAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, ResponseAggregate $response): void
29
    {
30
        $this->items[$name] = $response;
31
    }
32
}
33

src/Objects/Schemas.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class Schemas extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $schemas)
14
    {
15
        foreach ($schemas as $name => $response) {
16
            $this->setItem($name, $response);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, SchemaAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, SchemaAggregate $schema): void
29
    {
30
        $this->items[$name] = $schema;
31
    }
32
}
33

src/Objects/SecuritySchemes.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class SecuritySchemes extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $securitySchemes)
14
    {
15
        foreach ($securitySchemes as $name => $securityScheme) {
16
            $this->setItem($name, $securityScheme);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, SecuritySchemeAggregate>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, SecuritySchemeAggregate $securityScheme): void
29
    {
30
        $this->items[$name] = $securityScheme;
31
    }
32
}
33

src/Objects/ServerVariables.php 1 location

@@ 9-32 (lines=24) @@
6
7
use Aweapi\Openapi\Map;
8
9
final class ServerVariables extends Map
10
{
11
    private $items = [];
12
13
    public function __construct(iterable $variables)
14
    {
15
        foreach ($variables as $name => $variable) {
16
            $this->setItem($name, $variable);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, ServerVariable>
22
     */
23
    public function getItems(): array
24
    {
25
        return $this->items;
26
    }
27
28
    private function setItem(string $name, ServerVariable $variable): void
29
    {
30
        $this->items[$name] = $variable;
31
    }
32
}
33