1 | <?php |
||
15 | class Term extends Abs\Type{ |
||
16 | |||
17 | /** |
||
18 | * type |
||
19 | * Defines type slug for use elsewhere in the plugin |
||
20 | * |
||
21 | * @var string |
||
22 | * @access protected |
||
23 | */ |
||
24 | protected $type = 'term'; |
||
25 | |||
26 | /** |
||
27 | * Create test data posts. |
||
28 | * |
||
29 | * This is where the magic begins. We accept a cpt id (slug) and potntially |
||
30 | * a number of posts to create. We then fetch the supports & metaboxes |
||
31 | * for that cpt and feed them into a function to create each post individually. |
||
32 | * |
||
33 | * @access private |
||
34 | * |
||
35 | * @see $this->get_cpt_supports, $this->get_metaboxes, $this->create_test_object |
||
36 | * |
||
37 | * @param string $slug a custom post type ID. |
||
38 | * @param int $num Optional. Number of posts to create. |
||
39 | */ |
||
40 | public function create_objects( $slug, $connection, $num = '' ){ |
||
65 | |||
66 | |||
67 | /** |
||
68 | * Creates the individual test data object. |
||
69 | * |
||
70 | * Create individual posts for testing with. Gathers basic information such |
||
71 | * as title, content, thumbnail, etc. and inserts them with the post. Also |
||
72 | * adds metaboxes if applicable . |
||
73 | * |
||
74 | * @access private |
||
75 | * |
||
76 | * @see TestContent, wp_insert_post, add_post_meta, update_post_meta, $this->random_metabox_content |
||
77 | * |
||
78 | * @param string $slug a custom post type ID. |
||
79 | */ |
||
80 | private function create_test_object( $slug ){ |
||
114 | |||
115 | |||
116 | |||
117 | /** |
||
118 | * Delete all test data, regardless of type, within terms. |
||
119 | * |
||
120 | * @see Delete |
||
121 | */ |
||
122 | public function delete_all(){ |
||
140 | |||
141 | |||
142 | /** |
||
143 | * Delete test data terms. |
||
144 | * |
||
145 | * This function will search for all terms of a particular taxonomy ($slug) |
||
146 | * and delete them all using a particular term_meta flag that we set when creating |
||
147 | * the posts. Validates the user first. |
||
148 | * |
||
149 | * @see WP_Query, wp_delete_post |
||
150 | * |
||
151 | * @param string $slug a custom post type ID. |
||
152 | */ |
||
153 | public function delete( $slug ){ |
||
211 | |||
212 | } |
||
213 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.