Issues (1082)

classes/class-lsx-to-team-schema.php (13 issues)

1
<?php
2
/**
3
 * The Team Schema for Tours
4
 *
5
 * @package tour-operator
6
 */
7
8
/**
9
 * Returns schema Review data.
10
 *
11
 * @since 10.2
12
 */
13
class LSX_TO_Team_Schema extends LSX_TO_Schema_Graph_Piece {
14
15
	/**
16
	 * Constructor.
17
	 *
18
	 * @param \WPSEO_Schema_Context $context A value object with context variables.
19
	 */
20
	public function __construct( WPSEO_Schema_Context $context ) {
0 ignored issues
show
The type WPSEO_Schema_Context was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Expected 2 blank lines before function; 1 found
Loading history...
21
		$this->post_type = 'team';
22
		parent::__construct( $context );
23
	}
24
25
	/**
26
	 * Returns Review data.
27
	 *
28
	 * @return array $data Review data.
29
	 */
30
	public function generate() {
31
		$data = array(
32
			'@type'            => array(
33
				'Person',
34
			),
35
			'@id'              => $this->context->canonical . '#person',
36
			'name'             => $this->post->post_title,
37
			'description'      => wp_strip_all_tags( $this->post->post_content ),
38
			'url'              => $this->post_url,
39
			'mainEntityOfPage' => array(
40
				'@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH,
0 ignored issues
show
The type WPSEO_Schema_IDs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
41
			),
42
		);
43
44
		if ( $this->context->site_represents_reference ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
45
			$data['worksFor'] = $this->context->site_represents_reference;
46
			$data['memberOf'] = $this->context->site_represents_reference;
47
		}
48
49
		$data = $this->add_taxonomy_terms( $data, 'jobTitle', 'role' );
0 ignored issues
show
'role' of type string is incompatible with the type array expected by parameter $taxonomy of LSX_TO_Schema_Graph_Piece::add_taxonomy_terms(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
		$data = $this->add_taxonomy_terms( $data, 'jobTitle', /** @scrutinizer ignore-type */ 'role' );
Loading history...
'jobTitle' of type string is incompatible with the type array expected by parameter $data_key of LSX_TO_Schema_Graph_Piece::add_taxonomy_terms(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
		$data = $this->add_taxonomy_terms( $data, /** @scrutinizer ignore-type */ 'jobTitle', 'role' );
Loading history...
50
		$data = $this->add_custom_field( $data, 'email', 'contact_email' );
51
		$data = $this->add_custom_field( $data, 'telephone', 'contact_number' );
52
		$data = $this->add_products( $data );
53
		$data = $this->add_offers( $data, 'makesOffer' );
54
		$data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context );
55
		return $data;
56
	}
0 ignored issues
show
Expected 2 blank lines after function; 1 found
Loading history...
Expected 1 blank line before closing function brace; 0 found
Loading history...
57
58
	/**
59
	 * Adds the accommodation and tour products under the 'owns' parameter
60
	 *
61
	 * @param array $data
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
62
	 * @return array
63
	 */
64
	public function add_products( $data ) {
65
		$places_array = array();
66
		$places_array = $this->add_accommodation( $places_array );
67
		$places_array = $this->add_tours( $places_array );
68
		if ( ! empty( $places_array ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
69
			$data['owns'] = $places_array;
70
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
71
		return $data;
72
	}
73
}
74