# opcache-manager/3.3.0/includes/libraries/markdown/inline/CodeTrait.php

OPcache Manager, version 3.3.0. 46 lines.

- Page: https://pluginprobe.com/plugins/opcache-manager/3.3.0/code/includes/libraries/markdown/inline/CodeTrait.php
- Raw: https://pluginprobe.com/plugins/opcache-manager/3.3.0/raw/includes/libraries/markdown/inline/CodeTrait.php
- Modified: 2020-10-19T13:01:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/opcache-manager/3.3.0/code/includes/libraries/markdown/inline/CodeTrait.php#L10-L20`.

```php
<?php
/**
 * @copyright Copyright (c) 2014 Carsten Brandt
 * @license https://github.com/cebe/markdown/blob/master/LICENSE
 * @link https://github.com/cebe/markdown#readme
 */

namespace cebe\markdownparser\inline;

/**
 * Adds inline code elements
 */
trait CodeTrait
{
	/**
	 * Parses an inline code span `` ` ``.
	 * @marker `
	 */
	protected function parseInlineCode($text)
	{
		if (preg_match('/^(``+)\s(.+?)\s\1/s', $text, $matches)) { // code with enclosed backtick
			return [
				[
					'inlineCode',
					$matches[2],
				],
				strlen($matches[0])
			];
		} elseif (preg_match('/^`(.+?)`/s', $text, $matches)) {
			return [
				[
					'inlineCode',
					$matches[1],
				],
				strlen($matches[0])
			];
		}
		return [['text', $text[0]], 1];
	}

	protected function renderInlineCode($block)
	{
		return '<code>' . htmlspecialchars($block[1], ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8') . '</code>';
	}
}

```
