|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Factories: Property Getter Factory. |
|
4
|
|
|
* |
|
5
|
|
|
* @since 3.8.0 |
|
6
|
|
|
* @package Wordlift |
|
7
|
|
|
* @subpackage Wordlift/includes/properties |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
require_once( 'class-wordlift-property-getter.php' ); |
|
11
|
|
|
require_once( 'class-wordlift-simple-property-service.php' ); |
|
12
|
|
|
require_once( 'class-wordlift-entity-property-service.php' ); |
|
13
|
|
|
require_once( 'class-wordlift-location-property-service.php' ); |
|
14
|
|
|
require_once( 'class-wordlift-url-property-service.php' ); |
|
15
|
|
|
require_once( 'class-wordlift-double-property-service.php' ); |
|
16
|
|
|
require_once( 'class-wordlift-duration-property-service.php' ); |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* A Wordlift_Property_Getter_Factory, which instantiate a configured |
|
20
|
|
|
* {@link Wordlift_Property_Getter}. |
|
21
|
|
|
* |
|
22
|
|
|
* @since 3.8.0 |
|
23
|
|
|
* @package Wordlift |
|
24
|
|
|
* @subpackage Wordlift/includes/properties |
|
25
|
|
|
*/ |
|
26
|
|
|
class Wordlift_Property_Getter_Factory { |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Create a {@link Wordlift_Property_Getter} instance. |
|
30
|
|
|
* |
|
31
|
|
|
* @since 3.8.0 |
|
32
|
|
|
* |
|
33
|
|
|
* @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
34
|
|
|
* |
|
35
|
|
|
* @return \Wordlift_Property_Getter A {@link Wordlift_Property_Getter} instance. |
|
36
|
|
|
*/ |
|
37
|
|
|
public static function create( $entity_service ) { |
|
38
|
|
|
|
|
39
|
|
|
$property_getter = new Wordlift_Property_Getter( new Wordlift_Simple_Property_Service() ); |
|
40
|
|
|
$property_getter->register( new Wordlift_Entity_Property_Service( $entity_service ), array( |
|
41
|
|
|
Wordlift_Schema_Service::FIELD_FOUNDER, |
|
42
|
|
|
Wordlift_Schema_Service::FIELD_AUTHOR, |
|
43
|
|
|
Wordlift_Schema_Service::FIELD_KNOWS, |
|
44
|
|
|
Wordlift_Schema_Service::FIELD_BIRTH_PLACE, |
|
45
|
|
|
Wordlift_Schema_Service::FIELD_AFFILIATION, |
|
46
|
|
|
) ); |
|
47
|
|
|
$property_getter->register( new Wordlift_Location_Property_Service( $entity_service ), array( |
|
48
|
|
|
Wordlift_Schema_Service::FIELD_LOCATION, |
|
49
|
|
|
) ); |
|
50
|
|
|
$property_getter->register( new Wordlift_Url_Property_Service(), array( Wordlift_Url_Property_Service::META_KEY ) ); |
|
51
|
|
|
$property_getter->register( new Wordlift_Double_Property_Service(), array( |
|
52
|
|
|
Wordlift_Schema_Service::FIELD_GEO_LATITUDE, |
|
53
|
|
|
Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, |
|
54
|
|
|
) ); |
|
55
|
|
|
|
|
56
|
|
|
$property_getter->register( new Wordlift_Duration_Property_Service(), array( |
|
57
|
|
|
Wordlift_Schema_Service::FIELD_PREP_TIME, |
|
58
|
|
|
Wordlift_Schema_Service::FIELD_COOK_TIME, |
|
59
|
|
|
Wordlift_Schema_Service::FIELD_TOTAL_TIME, |
|
60
|
|
|
) ); |
|
61
|
|
|
|
|
62
|
|
|
return $property_getter; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
|