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

Oauth2ImplicitSecurity::setScopes()   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 Oauth2ImplicitSecurity 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 $description;
29
30
	/**
31
	 * @param Properties|static $properties
32
	 * @param JsonBasicSchema $ownerSchema
33
	 */
34
	public static function setUpProperties($properties, JsonBasicSchema $ownerSchema)
35
	{
36
		$properties->type = JsonBasicSchema::string();
37
		$properties->type->enum = array (
38
		  0 => 'oauth2',
39
		);
40
		$properties->flow = JsonBasicSchema::string();
41
		$properties->flow->enum = array (
42
		  0 => 'implicit',
43
		);
44
		$properties->scopes = JsonBasicSchema::object();
45
		$properties->scopes->additionalProperties = JsonBasicSchema::string();
46
		$properties->authorizationUrl = JsonBasicSchema::string();
47
		$properties->authorizationUrl->format = 'uri';
48
		$properties->description = JsonBasicSchema::string();
49
		$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...
50
		$ownerSchema->additionalProperties = false;
51
		$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema();
52
		$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.';
53
		$ownerSchema->required = array (
54
		  0 => 'type',
55
		  1 => 'flow',
56
		  2 => 'authorizationUrl',
57
		);
58
	}
59
60
	/**
61
	 * @param string $type
62
	 * @return $this
63
	 */
64
	public function setType($type)
65
	{
66
		$this->type = $type;
67
		return $this;
68
	}
69
70
	/**
71
	 * @param string $flow
72
	 * @return $this
73
	 */
74
	public function setFlow($flow)
75
	{
76
		$this->flow = $flow;
77
		return $this;
78
	}
79
80
	/**
81
	 * @param string[] $scopes
82
	 * @return $this
83
	 */
84
	public function setScopes($scopes)
85
	{
86
		$this->scopes = $scopes;
87
		return $this;
88
	}
89
90
	/**
91
	 * @param string $authorizationUrl
92
	 * @return $this
93
	 */
94
	public function setAuthorizationUrl($authorizationUrl)
95
	{
96
		$this->authorizationUrl = $authorizationUrl;
97
		return $this;
98
	}
99
100
	/**
101
	 * @param string $description
102
	 * @return $this
103
	 */
104
	public function setDescription($description)
105
	{
106
		$this->description = $description;
107
		return $this;
108
	}
109
}
110
111