| Conditions | 7 |
| Paths | 13 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function check_base( $url, $options ) { |
||
| 42 | if ( ! is_string( $url ) || empty( $url ) ) { |
||
| 43 | return $url; |
||
| 44 | } |
||
| 45 | |||
| 46 | global $wp_rewrite; |
||
| 47 | |||
| 48 | $base_defined = $options->base_defined; |
||
|
|
|||
| 49 | |||
| 50 | $permastruct = $wp_rewrite->get_extra_permastruct( $options->get_tax_query() ); |
||
| 51 | if ( $permastruct ) { |
||
| 52 | $permastruct = explode( '/', $permastruct ); |
||
| 53 | end( $permastruct ); |
||
| 54 | $permastruct = prev( $permastruct ); |
||
| 55 | if ( false !== $permastruct ) { |
||
| 56 | $base_defined = $permastruct; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | $base_option = get_option( $options->base_option ); |
||
| 61 | if ( empty( $base_option ) ) { |
||
| 62 | $base_option = $options->base_defined; |
||
| 63 | } |
||
| 64 | |||
| 65 | if ( $base_defined != $base_option ) { |
||
| 66 | $search = '/' . $base_defined . '/'; |
||
| 67 | $replace = '/' . $base_option . '/'; |
||
| 68 | $count = 1; |
||
| 69 | $url = str_replace( $search, $replace, $url, $count ); |
||
| 70 | } |
||
| 71 | |||
| 72 | return $url; |
||
| 73 | } |
||
| 74 | |||
| 76 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.