Completed
Pull Request — master (#11)
by Viacheslav
02:53
created

ApiKeySecurity::setIn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @file ATTENTION!!! The code below was carefully crafted by a mean machine.
4
 * Please consider to NOT put any emotional human-generated modifications as the splendid AI will throw them away with no mercy.
5
 */
6
7
namespace Swaggest\JsonSchema\SwaggerSchema;
8
9
use Swaggest\JsonSchema\Constraint\Properties;
10
use Swaggest\JsonSchema\Schema as JsonBasicSchema;
11
use Swaggest\JsonSchema\Structure\ClassStructure;
12
13
14
class ApiKeySecurity extends ClassStructure {
15
	/** @var string */
16
	public $type;
17
18
	/** @var string */
19
	public $name;
20
21
	/** @var string */
22
	public $in;
23
24
	/** @var string */
25
	public $description;
26
27
	/**
28
	 * @param Properties|static $properties
29
	 * @param JsonBasicSchema $ownerSchema
30
	 */
31
	public static function setUpProperties($properties, JsonBasicSchema $ownerSchema)
32
	{
33
		$properties->type = JsonBasicSchema::string();
34
		$properties->type->enum = array (
35
		  0 => 'apiKey',
36
		);
37
		$properties->name = JsonBasicSchema::string();
38
		$properties->in = JsonBasicSchema::string();
39
		$properties->in->enum = array (
40
		  0 => 'header',
41
		  1 => 'query',
42
		);
43
		$properties->description = JsonBasicSchema::string();
44
		$ownerSchema->type = 'object';
0 ignored issues
show
Documentation Bug introduced by
It seems like 'object' of type string is incompatible with the declared type array of property $type.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
		$ownerSchema->additionalProperties = false;
46
		$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema();
47
		$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.';
48
		$ownerSchema->required = array (
49
		  0 => 'type',
50
		  1 => 'name',
51
		  2 => 'in',
52
		);
53
	}
54
55
	/**
56
	 * @param string $type
57
	 * @return $this
58
	 */
59
	public function setType($type)
60
	{
61
		$this->type = $type;
62
		return $this;
63
	}
64
65
	/**
66
	 * @param string $name
67
	 * @return $this
68
	 */
69
	public function setName($name)
70
	{
71
		$this->name = $name;
72
		return $this;
73
	}
74
75
	/**
76
	 * @param string $in
77
	 * @return $this
78
	 */
79
	public function setIn($in)
80
	{
81
		$this->in = $in;
82
		return $this;
83
	}
84
85
	/**
86
	 * @param string $description
87
	 * @return $this
88
	 */
89
	public function setDescription($description)
90
	{
91
		$this->description = $description;
92
		return $this;
93
	}
94
}
95
96