Completed
Push — master ( 8f1f27...a615f9 )
by Viacheslav
03:25 queued 22s
created

ExternalDocs   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 46
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpProperties() 0 14 1
A setDescription() 0 5 1
A setUrl() 0 5 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 ExternalDocs extends ClassStructure {
15
	/** @var string */
16
	public $description;
17
18
	/** @var string */
19
	public $url;
20
21
	/**
22
	 * @param Properties|static $properties
23
	 * @param JsonBasicSchema $ownerSchema
24
	 */
25
	public static function setUpProperties($properties, JsonBasicSchema $ownerSchema)
26
	{
27
		$properties->description = JsonBasicSchema::string();
28
		$properties->url = JsonBasicSchema::string();
29
		$properties->url->format = 'uri';
30
		$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...
31
		$ownerSchema->additionalProperties = false;
32
		$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema();
33
		$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.';
34
		$ownerSchema->description = 'information about external documentation';
35
		$ownerSchema->required = array (
36
		  0 => 'url',
37
		);
38
	}
39
40
	/**
41
	 * @param string $description
42
	 * @return $this
43
	 */
44
	public function setDescription($description)
45
	{
46
		$this->description = $description;
47
		return $this;
48
	}
49
50
	/**
51
	 * @param string $url
52
	 * @return $this
53
	 */
54
	public function setUrl($url)
55
	{
56
		$this->url = $url;
57
		return $this;
58
	}
59
}
60
61