We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/context-hub/generator'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
CodeBlock.php•1.03 KiB
<?php
declare(strict_types=1);
namespace Butschster\ContextGenerator\Lib\Content\Block;
use Butschster\ContextGenerator\Lib\Content\Renderer\RendererInterface;
/**
* Block for code snippets with optional syntax highlighting
*/
final readonly class CodeBlock extends AbstractBlock
{
/**
* @param string $content The code content
* @param string|null $language The language for syntax highlighting (optional)
*/
public function __construct(
string $content,
private ?string $language = null,
private ?string $filepath = null,
) {
parent::__construct($content);
}
/**
* Get the language for syntax highlighting
*/
public function getLanguage(): ?string
{
return $this->language;
}
/**
* Get the file path for the code block
*/
public function getFilePath(): ?string
{
return $this->filepath;
}
public function render(RendererInterface $renderer): string
{
return $renderer->renderCodeBlock($this);
}
}