/var/www/hkosl.com/aga/wp-content/plugins/wordpress-seo/src/exceptions/no-indexable-found.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/**
 * Exception to use when an indexable is not found.
 *
 * @package Yoast\YoastSEO\Exceptions
 */

namespace Yoast\WP\Free\Exceptions;

use 
Yoast\WP\Free\Loggers\Logger;
use 
OutOfRangeException;

/**
 * The exception when no indexable could be found.
 */
class No_Indexable_Found extends OutOfRangeException {

    
/**
     * Returns an exception when an indexable for a post is not found.
     *
     * @param integer $post_id Post ID for the non existing indexable.
     *
     * @return \Yoast\WP\Free\Exceptions\No_Indexable_Found The exception.
     */
    
public static function from_post_id$post_id ) {
        
$message = \sprintf(
            
/* translators: %1$s expands to the post id */
            
\__'There is no indexable found for post id %1$s.''wordpress-seo' ),
            
$post_id
        
);

        return 
self::create_and_log_exception$message );
    }

    
/**
     * Returns an exception when an indexable for a taxonomy is not found.
     *
     * @param int    $term_id  The term the indexable is based upon.
     * @param string $taxonomy The taxonomy the indexable belongs to.
     *
     * @return \Yoast\WP\Free\Exceptions\No_Indexable_Found The exception.
     */
    
public static function from_term_id$term_id$taxonomy ) {
        
$message = \sprintf(
            
/* translators: 1: expands to the term id. 2: expand to the taxonomy  */
            
\__'There is no indexable found for term id %1$s and taxonomy %2$s.''wordpress-seo' ),
            
$term_id,
            
$taxonomy
        
);

        return 
self::create_and_log_exception$message );
    }

    
/**
     * Returns an exception when the primary key for an post-taxonomy combination is not found.
     *
     * @param integer $post_id  The post ID.
     * @param string  $taxonomy The taxonomy for the given Post ID.
     *
     * @return \Yoast\WP\Free\Exceptions\No_Indexable_Found The exception.
     */
    
public static function from_primary_term$post_id$taxonomy ) {
        
$message = \sprintf(
            
/* translators: 1: expands to the term id. 2: expand to the taxonomy  */
            
\__'There is no primary term found for post id %1$s and taxonomy %2$s.''wordpress-seo' ),
            
$post_id,
            
$taxonomy
        
);

        return 
self::create_and_log_exception$message );
    }

    
/**
     * Returns an exception when an indexable for an author is not found.
     *
     * @param int $user_id The user to retrieve the indexable for.
     *
     * @return \Yoast\WP\Free\Exceptions\No_Indexable_Found The exception.
     */
    
public static function from_author_id$user_id ) {
        
$message = \sprintf(
            
/* translators: 1: expands to the author id */
            
\__'There is no indexable found for author id %1$s.''wordpress-seo' ),
            
$user_id
        
);

        return 
self::create_and_log_exception$message );
    }

    
/**
     * Returns an exception when an indexable meta for an indexable is not found.
     *
     * @param string $meta_key     The meta key.
     * @param int    $indexable_id The ID of the indexable.
     *
     * @return \Yoast\WP\Free\Exceptions\No_Indexable_Found The exception.
     */
    
public static function from_meta_key$meta_key$indexable_id ) {
        
$message = \sprintf(
            
/* translators: 1: expands to the indexable id. 2: expand to the meta key */
            
\__'There is no meta found for indexable id %1$s and meta key %2$s.''wordpress-seo' ),
            
$indexable_id,
            
$meta_key
        
);

        return 
self::create_and_log_exception$message );
    }

    
/**
     * Creates an exception and logs the error message.
     *
     * @param string $message The error message.
     *
     * @return \Yoast\WP\Free\Exceptions\No_Indexable_Found Instance of the exception.
     */
    
protected static function create_and_log_exception$message ) {
        
Logger::get_logger()->notice$message );

        return new 
self$message );
    }
}