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

Contact   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpProperties() 0 16 1
A setName() 0 5 1
A setUrl() 0 5 1
A setEmail() 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 Contact extends ClassStructure {
15
	/** @var string The identifying name of the contact person/organization. */
16
	public $name;
17
18
	/** @var string The URL pointing to the contact information. */
19
	public $url;
20
21
	/** @var string The email address of the contact person/organization. */
22
	public $email;
23
24
	/**
25
	 * @param Properties|static $properties
26
	 * @param JsonBasicSchema $ownerSchema
27
	 */
28
	public static function setUpProperties($properties, JsonBasicSchema $ownerSchema)
29
	{
30
		$properties->name = JsonBasicSchema::string();
31
		$properties->name->description = 'The identifying name of the contact person/organization.';
32
		$properties->url = JsonBasicSchema::string();
33
		$properties->url->description = 'The URL pointing to the contact information.';
34
		$properties->url->format = 'uri';
35
		$properties->email = JsonBasicSchema::string();
36
		$properties->email->description = 'The email address of the contact person/organization.';
37
		$properties->email->format = 'email';
38
		$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...
39
		$ownerSchema->additionalProperties = false;
40
		$ownerSchema->patternProperties['^x-'] = new JsonBasicSchema();
41
		$ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.';
42
		$ownerSchema->description = 'Contact information for the owners of the API.';
43
	}
44
45
	/**
46
	 * @param string $name The identifying name of the contact person/organization.
47
	 * @return $this
48
	 */
49
	public function setName($name)
50
	{
51
		$this->name = $name;
52
		return $this;
53
	}
54
55
	/**
56
	 * @param string $url The URL pointing to the contact information.
57
	 * @return $this
58
	 */
59
	public function setUrl($url)
60
	{
61
		$this->url = $url;
62
		return $this;
63
	}
64
65
	/**
66
	 * @param string $email The email address of the contact person/organization.
67
	 * @return $this
68
	 */
69
	public function setEmail($email)
70
	{
71
		$this->email = $email;
72
		return $this;
73
	}
74
}
75
76