| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 4 |
namespace Yoast\WP\SEO\Bulk_Editor\Application\Posts; |
| 5 |
|
| 6 |
use Yoast\WP\SEO\Bulk_Editor\Domain\Posts\Posts_Page; |
| 7 |
use Yoast\WP\SEO\Bulk_Editor\Domain\Posts\Posts_Query; |
| 8 |
|
| 9 |
/** |
| 10 |
* Describes a collector that gathers a page of posts for the bulk editor. |
| 11 |
*/ |
| 12 |
interface Posts_Collector_Interface { |
| 13 |
|
| 14 |
/** |
| 15 |
* The post statuses shown in the bulk editor. |
| 16 |
* |
| 17 |
* @var array<string> |
| 18 |
*/ |
| 19 |
public const STATUSES = [ 'publish', 'draft', 'pending', 'future' ]; |
| 20 |
|
| 21 |
/** |
| 22 |
* The fields the "needs improvement" filter can target, as sent by the client. |
| 23 |
* |
| 24 |
* @var array<string> |
| 25 |
*/ |
| 26 |
public const NEEDS_IMPROVEMENT_FIELDS = [ 'seo_title', 'meta_description', 'social_title', 'social_description' ]; |
| 27 |
|
| 28 |
/** |
| 29 |
* The inclusive lower bound of the per-field score range that counts as "needs improvement". |
| 30 |
* |
| 31 |
* The bad + ok score groups are 1-70; 0 (and a missing/NULL value) means "never scored" and is deliberately |
| 32 |
* outside the range, so unscored posts only match through the empty check. |
| 33 |
* |
| 34 |
* @var int |
| 35 |
*/ |
| 36 |
public const NEEDS_IMPROVEMENT_MIN_SCORE = 1; |
| 37 |
|
| 38 |
/** |
| 39 |
* The inclusive upper bound of the per-field score range that counts as "needs improvement". |
| 40 |
* |
| 41 |
* @var int |
| 42 |
*/ |
| 43 |
public const NEEDS_IMPROVEMENT_MAX_SCORE = 70; |
| 44 |
|
| 45 |
/** |
| 46 |
* Collects a page of posts for the given query. |
| 47 |
* |
| 48 |
* @param Posts_Query $query The query describing the page to collect. |
| 49 |
* |
| 50 |
* @return Posts_Page The collected posts together with the totals for pagination. |
| 51 |
*/ |
| 52 |
public function get_posts( Posts_Query $query ): Posts_Page; |
| 53 |
} |
| 54 |
|