Completed
Push — master ( b6474c...b86442 )
by David
01:27
created
src/wordlift/content/wordpress/class-wordpress-content.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -10,77 +10,77 @@
 block discarded – undo
10 10
 
11 11
 class Wordpress_Content implements Content {
12 12
 
13
-	/**
14
-	 * The actual content.
15
-	 *
16
-	 * @var WP_Post|WP_Term|WP_User $bag
17
-	 */
18
-	private $bag;
13
+    /**
14
+     * The actual content.
15
+     *
16
+     * @var WP_Post|WP_Term|WP_User $bag
17
+     */
18
+    private $bag;
19 19
 
20
-	/**
21
-	 * Creates a WordPress content instance.
22
-	 *
23
-	 * @param WP_Post|WP_Term|WP_User $bag
24
-	 */
25
-	public function __construct( $bag ) {
26
-		$this->bag = $bag;
27
-	}
20
+    /**
21
+     * Creates a WordPress content instance.
22
+     *
23
+     * @param WP_Post|WP_Term|WP_User $bag
24
+     */
25
+    public function __construct( $bag ) {
26
+        $this->bag = $bag;
27
+    }
28 28
 
29
-	/**
30
-	 * The actual content.
31
-	 *
32
-	 * @return WP_Post|WP_Term|WP_User
33
-	 */
34
-	function get_bag() {
35
-		return $this->bag;
36
-	}
29
+    /**
30
+     * The actual content.
31
+     *
32
+     * @return WP_Post|WP_Term|WP_User
33
+     */
34
+    function get_bag() {
35
+        return $this->bag;
36
+    }
37 37
 
38
-	function get_id() {
39
-		if ( ! is_object( $this->bag ) ) {
40
-			return null;
41
-		}
38
+    function get_id() {
39
+        if ( ! is_object( $this->bag ) ) {
40
+            return null;
41
+        }
42 42
 
43
-		switch ( get_class( $this->bag ) ) {
44
-			case 'WP_Post':
45
-			case 'WP_User':
46
-				return $this->bag->ID;
47
-			case 'WP_Term':
48
-				return $this->bag->term_id;
49
-		}
43
+        switch ( get_class( $this->bag ) ) {
44
+            case 'WP_Post':
45
+            case 'WP_User':
46
+                return $this->bag->ID;
47
+            case 'WP_Term':
48
+                return $this->bag->term_id;
49
+        }
50 50
 
51
-		return null;
52
-	}
51
+        return null;
52
+    }
53 53
 
54
-	function get_object_type_enum() {
55
-		return Object_Type_Enum::from_wordpress_instance( $this->bag );
56
-	}
54
+    function get_object_type_enum() {
55
+        return Object_Type_Enum::from_wordpress_instance( $this->bag );
56
+    }
57 57
 
58
-	function get_permalink() {
59
-		switch ( get_class( $this->bag ) ) {
60
-			case 'WP_Post':
61
-				return get_permalink( $this->get_bag()->ID );
62
-			case 'WP_User':
63
-				return get_author_posts_url( $this->get_bag()->ID );
64
-			case 'WP_Term':
65
-				return get_term_link( $this->bag->term_id );
66
-		}
58
+    function get_permalink() {
59
+        switch ( get_class( $this->bag ) ) {
60
+            case 'WP_Post':
61
+                return get_permalink( $this->get_bag()->ID );
62
+            case 'WP_User':
63
+                return get_author_posts_url( $this->get_bag()->ID );
64
+            case 'WP_Term':
65
+                return get_term_link( $this->bag->term_id );
66
+        }
67 67
 
68
-		return null;
69
-	}
68
+        return null;
69
+    }
70 70
 
71
-	function get_edit_link() {
72
-		switch ( get_class( $this->bag ) ) {
73
-			case 'WP_Post':
74
-				// We need to return & character as &, by default context is set to display.
75
-				// so &  will be returned as & breaking header location redirects.
76
-				// By setting context to none we prevent this issue.
77
-				return get_edit_post_link( $this->get_bag()->ID, 'none' );
78
-			case 'WP_User':
79
-				return get_edit_user_link( $this->get_bag()->ID );
80
-			case 'WP_Term':
81
-				return get_edit_term_link( $this->bag->term_id );
82
-		}
71
+    function get_edit_link() {
72
+        switch ( get_class( $this->bag ) ) {
73
+            case 'WP_Post':
74
+                // We need to return & character as &, by default context is set to display.
75
+                // so &  will be returned as & breaking header location redirects.
76
+                // By setting context to none we prevent this issue.
77
+                return get_edit_post_link( $this->get_bag()->ID, 'none' );
78
+            case 'WP_User':
79
+                return get_edit_user_link( $this->get_bag()->ID );
80
+            case 'WP_Term':
81
+                return get_edit_term_link( $this->bag->term_id );
82
+        }
83 83
 
84
-		return null;
85
-	}
84
+        return null;
85
+    }
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param WP_Post|WP_Term|WP_User $bag
24 24
 	 */
25
-	public function __construct( $bag ) {
25
+	public function __construct($bag) {
26 26
 		$this->bag = $bag;
27 27
 	}
28 28
 
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	function get_id() {
39
-		if ( ! is_object( $this->bag ) ) {
39
+		if ( ! is_object($this->bag)) {
40 40
 			return null;
41 41
 		}
42 42
 
43
-		switch ( get_class( $this->bag ) ) {
43
+		switch (get_class($this->bag)) {
44 44
 			case 'WP_Post':
45 45
 			case 'WP_User':
46 46
 				return $this->bag->ID;
@@ -52,33 +52,33 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	function get_object_type_enum() {
55
-		return Object_Type_Enum::from_wordpress_instance( $this->bag );
55
+		return Object_Type_Enum::from_wordpress_instance($this->bag);
56 56
 	}
57 57
 
58 58
 	function get_permalink() {
59
-		switch ( get_class( $this->bag ) ) {
59
+		switch (get_class($this->bag)) {
60 60
 			case 'WP_Post':
61
-				return get_permalink( $this->get_bag()->ID );
61
+				return get_permalink($this->get_bag()->ID);
62 62
 			case 'WP_User':
63
-				return get_author_posts_url( $this->get_bag()->ID );
63
+				return get_author_posts_url($this->get_bag()->ID);
64 64
 			case 'WP_Term':
65
-				return get_term_link( $this->bag->term_id );
65
+				return get_term_link($this->bag->term_id);
66 66
 		}
67 67
 
68 68
 		return null;
69 69
 	}
70 70
 
71 71
 	function get_edit_link() {
72
-		switch ( get_class( $this->bag ) ) {
72
+		switch (get_class($this->bag)) {
73 73
 			case 'WP_Post':
74 74
 				// We need to return & character as &, by default context is set to display.
75 75
 				// so &  will be returned as & breaking header location redirects.
76 76
 				// By setting context to none we prevent this issue.
77
-				return get_edit_post_link( $this->get_bag()->ID, 'none' );
77
+				return get_edit_post_link($this->get_bag()->ID, 'none');
78 78
 			case 'WP_User':
79
-				return get_edit_user_link( $this->get_bag()->ID );
79
+				return get_edit_user_link($this->get_bag()->ID);
80 80
 			case 'WP_Term':
81
-				return get_edit_term_link( $this->bag->term_id );
81
+				return get_edit_term_link($this->bag->term_id);
82 82
 		}
83 83
 
84 84
 		return null;
Please login to merge, or discard this patch.