Completed
Pull Request — develop (#1576)
by Naveen
01:14
created
src/includes/properties/class-wordlift-location-property-service.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
  */
16 16
 class Wordlift_Location_Property_Service extends Wordlift_Entity_Property_Service {
17 17
 
18
-	/**
19
-	 * {@inheritdoc}
20
-	 */
21
-	public function get( $id, $meta_key, $type ) {
18
+    /**
19
+     * {@inheritdoc}
20
+     */
21
+    public function get( $id, $meta_key, $type ) {
22 22
 
23
-		return array_map(
24
-			function ( $item ) {
23
+        return array_map(
24
+            function ( $item ) {
25 25
 
26
-				// If this is an entity reference, set that this entity is always required in SD output.
27
-				if ( $item instanceof Wordlift_Property_Entity_Reference ) {
28
-					  $item->set_required( true );
26
+                // If this is an entity reference, set that this entity is always required in SD output.
27
+                if ( $item instanceof Wordlift_Property_Entity_Reference ) {
28
+                        $item->set_required( true );
29 29
 
30
-					  return $item;
31
-				}
30
+                        return $item;
31
+                }
32 32
 
33
-				return array(
34
-					'@type' => 'Place',
35
-					'name'  => $item,
36
-				);
37
-			},
38
-			parent::get( $id, $meta_key, $type )
39
-		);
40
-	}
33
+                return array(
34
+                    '@type' => 'Place',
35
+                    'name'  => $item,
36
+                );
37
+            },
38
+            parent::get( $id, $meta_key, $type )
39
+        );
40
+    }
41 41
 
42 42
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 	/**
19 19
 	 * {@inheritdoc}
20 20
 	 */
21
-	public function get( $id, $meta_key, $type ) {
21
+	public function get($id, $meta_key, $type) {
22 22
 
23 23
 		return array_map(
24
-			function ( $item ) {
24
+			function($item) {
25 25
 
26 26
 				// If this is an entity reference, set that this entity is always required in SD output.
27
-				if ( $item instanceof Wordlift_Property_Entity_Reference ) {
28
-					  $item->set_required( true );
27
+				if ($item instanceof Wordlift_Property_Entity_Reference) {
28
+					  $item->set_required(true);
29 29
 
30 30
 					  return $item;
31 31
 				}
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 					'name'  => $item,
36 36
 				);
37 37
 			},
38
-			parent::get( $id, $meta_key, $type )
38
+			parent::get($id, $meta_key, $type)
39 39
 		);
40 40
 	}
41 41
 
Please login to merge, or discard this patch.
src/includes/properties/class-wordlift-entity-property-service.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,39 +12,39 @@
 block discarded – undo
12 12
  */
13 13
 class Wordlift_Entity_Property_Service extends Wordlift_Simple_Property_Service {
14 14
 
15
-	/**
16
-	 * {@inheritdoc}
17
-	 */
18
-	public function get( $id, $meta_key, $type ) {
19
-
20
-		$entity_service = Wordlift_Entity_Service::get_instance();
21
-
22
-		// Map each returned value to a Wordlift_Property_Entity_Reference.
23
-		$result = array_map(
24
-			function ( $item ) use ( $entity_service ) {
25
-
26
-				$regex = '/^(post|term)_(\d+)$/m';
27
-				if ( preg_match( $regex, $item, $matches ) ) {
28
-					$object_type = Object_Type_Enum::from_string( $matches[1] );
29
-					$identifier  = (int) $matches[2];
30
-					if ( Object_Type_Enum::POST === $object_type ) {
31
-						return new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier ), $identifier );
32
-					} elseif ( Object_Type_Enum::TERM === $object_type ) {
33
-						return new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier, Object_Type_Enum::TERM ), $identifier, false, Object_Type_Enum::TERM );
34
-					}
35
-				}
36
-
37
-				// If the $item is a number and it's an existing post, return the
38
-				// URI of the referenced entity. Otherwise return the value.
39
-				return is_numeric( $item ) && null !== get_post( $item )
40
-				? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item )
41
-				: $item;
42
-			},
43
-			parent::get( $id, $meta_key, $type )
44
-		);
45
-
46
-		return $result;
47
-	}
15
+    /**
16
+     * {@inheritdoc}
17
+     */
18
+    public function get( $id, $meta_key, $type ) {
19
+
20
+        $entity_service = Wordlift_Entity_Service::get_instance();
21
+
22
+        // Map each returned value to a Wordlift_Property_Entity_Reference.
23
+        $result = array_map(
24
+            function ( $item ) use ( $entity_service ) {
25
+
26
+                $regex = '/^(post|term)_(\d+)$/m';
27
+                if ( preg_match( $regex, $item, $matches ) ) {
28
+                    $object_type = Object_Type_Enum::from_string( $matches[1] );
29
+                    $identifier  = (int) $matches[2];
30
+                    if ( Object_Type_Enum::POST === $object_type ) {
31
+                        return new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier ), $identifier );
32
+                    } elseif ( Object_Type_Enum::TERM === $object_type ) {
33
+                        return new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier, Object_Type_Enum::TERM ), $identifier, false, Object_Type_Enum::TERM );
34
+                    }
35
+                }
36
+
37
+                // If the $item is a number and it's an existing post, return the
38
+                // URI of the referenced entity. Otherwise return the value.
39
+                return is_numeric( $item ) && null !== get_post( $item )
40
+                ? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item )
41
+                : $item;
42
+            },
43
+            parent::get( $id, $meta_key, $type )
44
+        );
45
+
46
+        return $result;
47
+    }
48 48
 
49 49
 
50 50
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,32 +15,32 @@
 block discarded – undo
15 15
 	/**
16 16
 	 * {@inheritdoc}
17 17
 	 */
18
-	public function get( $id, $meta_key, $type ) {
18
+	public function get($id, $meta_key, $type) {
19 19
 
20 20
 		$entity_service = Wordlift_Entity_Service::get_instance();
21 21
 
22 22
 		// Map each returned value to a Wordlift_Property_Entity_Reference.
23 23
 		$result = array_map(
24
-			function ( $item ) use ( $entity_service ) {
24
+			function($item) use ($entity_service) {
25 25
 
26 26
 				$regex = '/^(post|term)_(\d+)$/m';
27
-				if ( preg_match( $regex, $item, $matches ) ) {
28
-					$object_type = Object_Type_Enum::from_string( $matches[1] );
27
+				if (preg_match($regex, $item, $matches)) {
28
+					$object_type = Object_Type_Enum::from_string($matches[1]);
29 29
 					$identifier  = (int) $matches[2];
30
-					if ( Object_Type_Enum::POST === $object_type ) {
31
-						return new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier ), $identifier );
32
-					} elseif ( Object_Type_Enum::TERM === $object_type ) {
33
-						return new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $identifier, Object_Type_Enum::TERM ), $identifier, false, Object_Type_Enum::TERM );
30
+					if (Object_Type_Enum::POST === $object_type) {
31
+						return new Wordlift_Property_Entity_Reference($entity_service->get_uri($identifier), $identifier);
32
+					} elseif (Object_Type_Enum::TERM === $object_type) {
33
+						return new Wordlift_Property_Entity_Reference($entity_service->get_uri($identifier, Object_Type_Enum::TERM), $identifier, false, Object_Type_Enum::TERM);
34 34
 					}
35 35
 				}
36 36
 
37 37
 				// If the $item is a number and it's an existing post, return the
38 38
 				// URI of the referenced entity. Otherwise return the value.
39
-				return is_numeric( $item ) && null !== get_post( $item )
40
-				? new Wordlift_Property_Entity_Reference( $entity_service->get_uri( $item ), (int) $item )
39
+				return is_numeric($item) && null !== get_post($item)
40
+				? new Wordlift_Property_Entity_Reference($entity_service->get_uri($item), (int) $item)
41 41
 				: $item;
42 42
 			},
43
-			parent::get( $id, $meta_key, $type )
43
+			parent::get($id, $meta_key, $type)
44 44
 		);
45 45
 
46 46
 		return $result;
Please login to merge, or discard this patch.