本文整理汇总了PHP中DataObjectInterface::getLine方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectInterface::getLine方法的具体用法?PHP DataObjectInterface::getLine怎么用?PHP DataObjectInterface::getLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectInterface
的用法示例。
在下文中一共展示了DataObjectInterface::getLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grabReferences
/**
* @param int $lineNumber
*
* @return BlockInterface|mixed|null|string
*/
protected function grabReferences($lineNumber)
{
$content = $this->dataObject->getLine($lineNumber);
// grab urls with title
$content = preg_replace_callback('/\\[(.*)\\]:\\s?(.*)\\s?"(.*)"/U', function ($found) {
$key = trim($found[1]);
$url = trim($found[2]);
$title = trim($found[3]);
$this->dataObject->addReference($key, ['url' => $url, 'title' => $title, 'type' => 'url']);
return '';
}, $content);
// grab urls without title
$content = preg_replace_callback('/\\[(.*)\\]:\\s?(.*)/', function ($found) {
$key = trim($found[1]);
$url = trim($found[2]);
$this->dataObject->addReference($key, ['url' => $url, 'title' => '', 'type' => 'url']);
return '';
}, $content);
return $content;
}
示例2: createSkipLine
/**
* @param DataObjectInterface $dataObject
* @param int $lineNumber
*/
protected function createSkipLine(DataObjectInterface $dataObject, $lineNumber)
{
$lineContent = $dataObject->getLine($lineNumber);
$changedContent = $this->factory->create(BlockTypes::BLOCK_SKIP);
$changedContent->setContent($lineContent->getContent());
$dataObject->updateLine($lineNumber, $changedContent);
}