public array Result::getCategory( string $categoryId )
Retrieve a Category array from a result object
Returns an array representation of an eContext API Category object
Echo the category name for a single keyword, "breaking bad"
$classify = new eContext\Classify\Keywords($client, ["breaking bad"]);
$results = $classify->classify();
foreach($results->yieldResults as $keywordResult) {
$categoryId = $keywordResult['category_id'];
$category = $results->getCategory($categoryId);
echo "Retrieved category " . $category['name'] . PHP_EOL;
}
The above code should output:
Retrieved category Breaking Bad