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

Oauth2AccessCodeSecurity::setAuthorizationUrl()   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 Oauth2AccessCodeSecurity extends ClassStructure {
15
	/** @var string */
16
	public $type;
17
18
	/** @var string */
19
	public $flow;
20
21
	/** @var string[] */
22
	public $scopes;
23
24
	/** @var string */
25
	public $authorizationUrl;
26
27
	/** @var string */
28
	public $tokenUrl;
29
30
	/** @var string */
31
	public $description;
32
33
	/**
34
	 * @param Properties|static $properties
35
	 * @param JsonBasicSchema $ownerSchema
36
	 */
37
	public static function setUpProperties($properties, JsonBasicSchema $ownerSchema)
38
	{
39
		$properties->type = JsonBasicSchema::string();
40
		$properties->type->enum = array (
41
		  0 => 'oauth2',
42
		);
43
		$properties->flow = JsonBasicSchema::string();
44
		$properties->flow->enum = array (
45
		  0 => 'accessCode',
46
		);
47
		$properties->scopes = JsonBasicSchema::object();
48
		$properties->scopes->additionalProperties = JsonBasicSchema::string();
49
		$properties->authorizationUrl = JsonBasicSchema::string();
50
		$properties->authorizationUrl->format = 'uri';
51
		$properties->tokenUrl = JsonBasicSchema::string();
52
		$properties->tokenUrl->format = 'uri';
53
		$properties->description = JsonBasicSchema::string();
54
		$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...
55
		$ownerSchema->additionalProperties = false;
56
		$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema();
57
		$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.';
58
		$ownerSchema->required = array (
59
		  0 => 'type',
60
		  1 => 'flow',
61
		  2 => 'authorizationUrl',
62
		  3 => 'tokenUrl',
63
		);
64
	}
65
66
	/**
67
	 * @param string $type
68
	 * @return $this
69
	 */
70
	public function setType($type)
71
	{
72
		$this->type = $type;
73
		return $this;
74
	}
75
76
	/**
77
	 * @param string $flow
78
	 * @return $this
79
	 */
80
	public function setFlow($flow)
81
	{
82
		$this->flow = $flow;
83
		return $this;
84
	}
85
86
	/**
87
	 * @param string[] $scopes
88
	 * @return $this
89
	 */
90
	public function setScopes($scopes)
91
	{
92
		$this->scopes = $scopes;
93
		return $this;
94
	}
95
96
	/**
97
	 * @param string $authorizationUrl
98
	 * @return $this
99
	 */
100
	public function setAuthorizationUrl($authorizationUrl)
101
	{
102
		$this->authorizationUrl = $authorizationUrl;
103
		return $this;
104
	}
105
106
	/**
107
	 * @param string $tokenUrl
108
	 * @return $this
109
	 */
110
	public function setTokenUrl($tokenUrl)
111
	{
112
		$this->tokenUrl = $tokenUrl;
113
		return $this;
114
	}
115
116
	/**
117
	 * @param string $description
118
	 * @return $this
119
	 */
120
	public function setDescription($description)
121
	{
122
		$this->description = $description;
123
		return $this;
124
	}
125
}
126
127