6
6
* Link type: Image and text
7
7
*
8
8
* @package Msls
9
- * @property string $txt
10
- * @property string $src
11
- * @property string $alt
12
- * @property string $url
13
9
*/
14
- class MslsLink extends MslsGetSet {
10
+ class MslsLink extends MslsGetSet implements LinkInterface {
15
11
16
12
/**
17
13
* Output format
@@ -63,9 +59,9 @@ public static function get_types_description(): array {
63
59
*
64
60
* @param ?int $display
65
61
*
66
- * @return MslsLink
62
+ * @return LinkInterface
67
63
*/
68
- public static function create ( ?int $ display ): MslsLink {
64
+ public static function create ( ?int $ display ): LinkInterface {
69
65
$ types = self ::get_types ();
70
66
if ( ! in_array ( $ display , array_keys ( $ types ), true ) ) {
71
67
$ display = 0 ;
@@ -75,13 +71,13 @@ public static function create( ?int $display ): MslsLink {
75
71
76
72
if ( has_filter ( 'msls_link_create ' ) ) {
77
73
/**
78
- * @param MslsLink $obj
74
+ * @param LinkInterface $obj
79
75
* @param int $display
80
76
*
81
- * @return MslsLink
77
+ * @return LinkInterface
82
78
*/
83
79
$ obj = apply_filters ( 'msls_link_create ' , $ obj , $ display );
84
- if ( in_array ( __CLASS__ , $ types ) || is_subclass_of ( $ obj, __CLASS__ ) ) {
80
+ if ( $ obj instanceof LinkInterface ) {
85
81
return $ obj ;
86
82
}
87
83
}
@@ -102,10 +98,8 @@ public static function callback( $x ) {
102
98
103
99
/**
104
100
* Handles the request to print the object
105
- *
106
- * @return string
107
101
*/
108
- public function __toString () {
102
+ public function __toString (): string {
109
103
$ temp = $ this ->get_arr ();
110
104
111
105
return str_replace (
0 commit comments