| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Exceptions\Indexable; |
| 4 |
|
| 5 |
/** |
| 6 |
* For when an author indexable is not being built. |
| 7 |
*/ |
| 8 |
class Author_Not_Built_Exception extends Not_Built_Exception { |
| 9 |
|
| 10 |
/** |
| 11 |
* Named constructor for creating an Author_Not_Built_Exception |
| 12 |
* when author archives are disabled for users without posts. |
| 13 |
* |
| 14 |
* @param string $user_id The user id. |
| 15 |
* |
| 16 |
* @return Author_Not_Built_Exception The exception. |
| 17 |
*/ |
| 18 |
public static function author_archives_are_not_indexed_for_users_without_posts( $user_id ) { |
| 19 |
return new self( |
| 20 |
'Indexable for author with id ' . $user_id . ' is not being built, since author archives are not indexed for users without posts.', |
| 21 |
); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Named constructor for creating an Author_Not_Built_Exception |
| 26 |
* when author archives are disabled. |
| 27 |
* |
| 28 |
* @param string $user_id The user id. |
| 29 |
* |
| 30 |
* @return Author_Not_Built_Exception The exception. |
| 31 |
*/ |
| 32 |
public static function author_archives_are_disabled( $user_id ) { |
| 33 |
return new self( |
| 34 |
'Indexable for author with id ' . $user_id . ' is not being built, since author archives are disabled.', |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Named constructor for creating an Author_Not_Build_Exception |
| 40 |
* when an author is excluded because of the `'wpseo_should_build_and_save_user_indexable'` filter. |
| 41 |
* |
| 42 |
* @param string $user_id The user id. |
| 43 |
* |
| 44 |
* @return Author_Not_Built_Exception The exception. |
| 45 |
*/ |
| 46 |
public static function author_not_built_because_of_filter( $user_id ) { |
| 47 |
return new self( |
| 48 |
'Indexable for author with id ' . $user_id . ' is not being built, since it is excluded because of the \'wpseo_should_build_and_save_user_indexable\' filter.', |
| 49 |
); |
| 50 |
} |
| 51 |
} |
| 52 |
|