PHP Класс Bolt\Helpers\Excerpt

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$body Bolt\Legacy\Content | array | string
$title string

Открытые методы

Метод Описание
__construct ( Content | array | string $body, string | null $title = null ) Constructor.
getExcerpt ( integer $length = 200, boolean $includeTitle = false, array | string | null $focus = null ) : string | null Get the excerpt of a given piece of text.

Приватные методы

Метод Описание
determineSnipLocation ( array $locations, integer $prevCount ) : integer Work out which is the most relevant portion to display This is done by looping over each match and finding the smallest distance between two found strings. The idea being that the closer the terms are the better match the snippet would be.
extractLocations ( array $words, string $fulltext ) : array Find the locations of each of the words.
extractRelevant ( string | array $words, string $fulltext, integer $relLength = 300 ) : mixed | string Center on, and highlight search terms in excerpts.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( Content | array | string $body, string | null $title = null )
$body Bolt\Legacy\Content | array | string
$title string | null

getExcerpt() публичный Метод

Get the excerpt of a given piece of text.
public getExcerpt ( integer $length = 200, boolean $includeTitle = false, array | string | null $focus = null ) : string | null
$length integer
$includeTitle boolean
$focus array | string | null
Результат string | null

Описание свойств

$body защищенное свойство

protected Content,Bolt\Legacy|array|string $body
Результат Bolt\Legacy\Content | array | string

$title защищенное свойство

protected string $title
Результат string