Site icon Hip-Hop Website Design and Development

PHP calling operate inside a category

I am writing my very own php class and I’ve a number of capabilities throughout the class. One thing like this:

class JSON_API_Hello_Controller {

    public operate test_cat(){
        world $json_api;

        $posts = $json_api->introspector->get_posts(array( 'cat' => 3));
        return $this->posts_object_result_bycat($posts);
    }

    public operate test_cat1() {
        world $json_api;

        $posts = $json_api->introspector->get_posts(array( 'cat' => 2));
        return $this->posts_object_result_bycat($posts);
    }

    protected operate posts_object_result_bycat($posts) {
        world $wp_query;

        return array(
            'depend' => depend($posts),
            'pages' => (int) $wp_query->max_num_pages,
            'posts' => $posts
        );
    }

    public operate mix_cat(){

        $first_cat = $this->test_cat();
        $second_cat = $this->test_cat1();
        $json1 = json_decode($first_cat , true);
        $json2 = json_decode($second_cat, true);
        $final_array = array_merge($json1, $json2);
        // Lastly encode the consequence again to JSON.
        $final_json = json_encode($final_array);
    }

} 

I attempted one thing like this. I need to name the test_cat() and test_cat1() operate in different operate like mix_cat() inside the identical class. Each operate (test_cat() & test_cat1()) return the json object. Each return json object will likely be take part mix_cat() operate. Please recommend me How can I name the testcat() & test_cat1() operate in mix_cat() and be part of the results of each operate in mix_cat() operate.