<?php

class Category {
	public function getCategories($type){
		$array = [
			'xxx' => 'foo',
			'yyy' => 'bar'
		];
		
		return ($array[$type] ?? 'fooBar');
	}
}

echo (new class() extends Category {})->getCategories('xxx') . PHP_EOL;
echo (new class() extends Category {})->getCategories('yyy') . PHP_EOL;
echo (new class() extends Category {})->getCategories('zzz') . PHP_EOL;