public static function json_template($objectattributes) { $instance = new self(); $valid_api_template = $instance->json_api_call($objectattributes); if ($valid_api_template == false) { $template = array($instance->buildkeyval($objectattributes)); //assume attributes passed is to build a new template return json_encode($template); } else { $template = $valid_api_template; return $template; } }