@@ -6,20 +6,20 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class Wordlift_Required_Property_Service extends Wordlift_Entity_Property_Service { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * {@inheritdoc} |
|
| 11 | - */ |
|
| 12 | - public function get( $post_id, $meta_key ) { |
|
| 9 | + /** |
|
| 10 | + * {@inheritdoc} |
|
| 11 | + */ |
|
| 12 | + public function get( $post_id, $meta_key ) { |
|
| 13 | 13 | |
| 14 | - return array_map( function ( $item ) { |
|
| 14 | + return array_map( function ( $item ) { |
|
| 15 | 15 | |
| 16 | - // If this is an entity reference, set that this entity is always required in SD output. |
|
| 17 | - if ( $item instanceof Wordlift_Property_Entity_Reference ) { |
|
| 18 | - $item->set_required( true ); |
|
| 19 | - } |
|
| 16 | + // If this is an entity reference, set that this entity is always required in SD output. |
|
| 17 | + if ( $item instanceof Wordlift_Property_Entity_Reference ) { |
|
| 18 | + $item->set_required( true ); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - return $item; |
|
| 22 | - }, parent::get( $post_id, $meta_key ) ); |
|
| 23 | - } |
|
| 21 | + return $item; |
|
| 22 | + }, parent::get( $post_id, $meta_key ) ); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | /** |
| 10 | 10 | * {@inheritdoc} |
| 11 | 11 | */ |
| 12 | - public function get( $post_id, $meta_key ) { |
|
| 12 | + public function get($post_id, $meta_key) { |
|
| 13 | 13 | |
| 14 | - return array_map( function ( $item ) { |
|
| 14 | + return array_map(function($item) { |
|
| 15 | 15 | |
| 16 | 16 | // If this is an entity reference, set that this entity is always required in SD output. |
| 17 | - if ( $item instanceof Wordlift_Property_Entity_Reference ) { |
|
| 18 | - $item->set_required( true ); |
|
| 17 | + if ($item instanceof Wordlift_Property_Entity_Reference) { |
|
| 18 | + $item->set_required(true); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | return $item; |
| 22 | - }, parent::get( $post_id, $meta_key ) ); |
|
| 22 | + }, parent::get($post_id, $meta_key)); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | } |
@@ -26,46 +26,46 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Wordlift_Property_Getter_Factory { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Create a {@link Wordlift_Property_Getter} instance. |
|
| 31 | - * |
|
| 32 | - * @since 3.8.0 |
|
| 33 | - * |
|
| 34 | - * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 35 | - * |
|
| 36 | - * @return \Wordlift_Property_Getter A {@link Wordlift_Property_Getter} instance. |
|
| 37 | - */ |
|
| 38 | - public static function create( $entity_service ) { |
|
| 29 | + /** |
|
| 30 | + * Create a {@link Wordlift_Property_Getter} instance. |
|
| 31 | + * |
|
| 32 | + * @since 3.8.0 |
|
| 33 | + * |
|
| 34 | + * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 35 | + * |
|
| 36 | + * @return \Wordlift_Property_Getter A {@link Wordlift_Property_Getter} instance. |
|
| 37 | + */ |
|
| 38 | + public static function create( $entity_service ) { |
|
| 39 | 39 | |
| 40 | - $property_getter = new Wordlift_Property_Getter( new Wordlift_Simple_Property_Service() ); |
|
| 41 | - $property_getter->register( new Wordlift_Entity_Property_Service( $entity_service ), array( |
|
| 42 | - Wordlift_Schema_Service::FIELD_FOUNDER, |
|
| 43 | - Wordlift_Schema_Service::FIELD_AUTHOR, |
|
| 44 | - Wordlift_Schema_Service::FIELD_KNOWS, |
|
| 45 | - Wordlift_Schema_Service::FIELD_BIRTH_PLACE, |
|
| 46 | - Wordlift_Schema_Service::FIELD_AFFILIATION, |
|
| 47 | - Wordlift_Schema_Service::FIELD_PERFORMER, |
|
| 48 | - Wordlift_Schema_Service::FIELD_OFFERS, |
|
| 49 | - Wordlift_Schema_Service::FIELD_ITEM_OFFERED, |
|
| 50 | - ) ); |
|
| 51 | - $property_getter->register( new Wordlift_Location_Property_Service( $entity_service ), array( |
|
| 52 | - Wordlift_Schema_Service::FIELD_LOCATION, |
|
| 53 | - ) ); |
|
| 54 | - $property_getter->register( new Wordlift_Url_Property_Service(), array( Wordlift_Url_Property_Service::META_KEY ) ); |
|
| 55 | - $property_getter->register( new Wordlift_Double_Property_Service(), array( |
|
| 56 | - Wordlift_Schema_Service::FIELD_GEO_LATITUDE, |
|
| 57 | - Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, |
|
| 58 | - ) ); |
|
| 40 | + $property_getter = new Wordlift_Property_Getter( new Wordlift_Simple_Property_Service() ); |
|
| 41 | + $property_getter->register( new Wordlift_Entity_Property_Service( $entity_service ), array( |
|
| 42 | + Wordlift_Schema_Service::FIELD_FOUNDER, |
|
| 43 | + Wordlift_Schema_Service::FIELD_AUTHOR, |
|
| 44 | + Wordlift_Schema_Service::FIELD_KNOWS, |
|
| 45 | + Wordlift_Schema_Service::FIELD_BIRTH_PLACE, |
|
| 46 | + Wordlift_Schema_Service::FIELD_AFFILIATION, |
|
| 47 | + Wordlift_Schema_Service::FIELD_PERFORMER, |
|
| 48 | + Wordlift_Schema_Service::FIELD_OFFERS, |
|
| 49 | + Wordlift_Schema_Service::FIELD_ITEM_OFFERED, |
|
| 50 | + ) ); |
|
| 51 | + $property_getter->register( new Wordlift_Location_Property_Service( $entity_service ), array( |
|
| 52 | + Wordlift_Schema_Service::FIELD_LOCATION, |
|
| 53 | + ) ); |
|
| 54 | + $property_getter->register( new Wordlift_Url_Property_Service(), array( Wordlift_Url_Property_Service::META_KEY ) ); |
|
| 55 | + $property_getter->register( new Wordlift_Double_Property_Service(), array( |
|
| 56 | + Wordlift_Schema_Service::FIELD_GEO_LATITUDE, |
|
| 57 | + Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, |
|
| 58 | + ) ); |
|
| 59 | 59 | |
| 60 | - $property_getter->register( new Wordlift_Duration_Property_Service(), array( |
|
| 61 | - Wordlift_Schema_Service::FIELD_PREP_TIME, |
|
| 62 | - Wordlift_Schema_Service::FIELD_COOK_TIME, |
|
| 63 | - Wordlift_Schema_Service::FIELD_TOTAL_TIME, |
|
| 64 | - ) ); |
|
| 60 | + $property_getter->register( new Wordlift_Duration_Property_Service(), array( |
|
| 61 | + Wordlift_Schema_Service::FIELD_PREP_TIME, |
|
| 62 | + Wordlift_Schema_Service::FIELD_COOK_TIME, |
|
| 63 | + Wordlift_Schema_Service::FIELD_TOTAL_TIME, |
|
| 64 | + ) ); |
|
| 65 | 65 | |
| 66 | - $property_getter->register( new Wordlift_Required_Property_Service( $entity_service ), apply_filters( 'wl_required_property', array() ) ); |
|
| 66 | + $property_getter->register( new Wordlift_Required_Property_Service( $entity_service ), apply_filters( 'wl_required_property', array() ) ); |
|
| 67 | 67 | |
| 68 | - return $property_getter; |
|
| 69 | - } |
|
| 68 | + return $property_getter; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |
@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | * @subpackage Wordlift/includes/properties |
| 8 | 8 | */ |
| 9 | 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 | -require_once( 'class-wordlift-required-property-service.php' ); |
|
| 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 | +require_once('class-wordlift-required-property-service.php'); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * A Wordlift_Property_Getter_Factory, which instantiate a configured |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return \Wordlift_Property_Getter A {@link Wordlift_Property_Getter} instance. |
| 37 | 37 | */ |
| 38 | - public static function create( $entity_service ) { |
|
| 38 | + public static function create($entity_service) { |
|
| 39 | 39 | |
| 40 | - $property_getter = new Wordlift_Property_Getter( new Wordlift_Simple_Property_Service() ); |
|
| 41 | - $property_getter->register( new Wordlift_Entity_Property_Service( $entity_service ), array( |
|
| 40 | + $property_getter = new Wordlift_Property_Getter(new Wordlift_Simple_Property_Service()); |
|
| 41 | + $property_getter->register(new Wordlift_Entity_Property_Service($entity_service), array( |
|
| 42 | 42 | Wordlift_Schema_Service::FIELD_FOUNDER, |
| 43 | 43 | Wordlift_Schema_Service::FIELD_AUTHOR, |
| 44 | 44 | Wordlift_Schema_Service::FIELD_KNOWS, |
@@ -47,23 +47,23 @@ discard block |
||
| 47 | 47 | Wordlift_Schema_Service::FIELD_PERFORMER, |
| 48 | 48 | Wordlift_Schema_Service::FIELD_OFFERS, |
| 49 | 49 | Wordlift_Schema_Service::FIELD_ITEM_OFFERED, |
| 50 | - ) ); |
|
| 51 | - $property_getter->register( new Wordlift_Location_Property_Service( $entity_service ), array( |
|
| 50 | + )); |
|
| 51 | + $property_getter->register(new Wordlift_Location_Property_Service($entity_service), array( |
|
| 52 | 52 | Wordlift_Schema_Service::FIELD_LOCATION, |
| 53 | - ) ); |
|
| 54 | - $property_getter->register( new Wordlift_Url_Property_Service(), array( Wordlift_Url_Property_Service::META_KEY ) ); |
|
| 55 | - $property_getter->register( new Wordlift_Double_Property_Service(), array( |
|
| 53 | + )); |
|
| 54 | + $property_getter->register(new Wordlift_Url_Property_Service(), array(Wordlift_Url_Property_Service::META_KEY)); |
|
| 55 | + $property_getter->register(new Wordlift_Double_Property_Service(), array( |
|
| 56 | 56 | Wordlift_Schema_Service::FIELD_GEO_LATITUDE, |
| 57 | 57 | Wordlift_Schema_Service::FIELD_GEO_LONGITUDE, |
| 58 | - ) ); |
|
| 58 | + )); |
|
| 59 | 59 | |
| 60 | - $property_getter->register( new Wordlift_Duration_Property_Service(), array( |
|
| 60 | + $property_getter->register(new Wordlift_Duration_Property_Service(), array( |
|
| 61 | 61 | Wordlift_Schema_Service::FIELD_PREP_TIME, |
| 62 | 62 | Wordlift_Schema_Service::FIELD_COOK_TIME, |
| 63 | 63 | Wordlift_Schema_Service::FIELD_TOTAL_TIME, |
| 64 | - ) ); |
|
| 64 | + )); |
|
| 65 | 65 | |
| 66 | - $property_getter->register( new Wordlift_Required_Property_Service( $entity_service ), apply_filters( 'wl_required_property', array() ) ); |
|
| 66 | + $property_getter->register(new Wordlift_Required_Property_Service($entity_service), apply_filters('wl_required_property', array())); |
|
| 67 | 67 | |
| 68 | 68 | return $property_getter; |
| 69 | 69 | } |