State = $State; } /** * @param Context $Context * @param Block|null $Block * @param State|null $State * @return static|null */ public static function build( Context $Context, Block $Block = null, State $State = null ) { $State = $State ?: new State; if (\preg_match( '/^\[(.+?)\]:[ ]*+?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/', $Context->line()->text(), $matches )) { $id = \strtolower($matches[1]); $Data = [ 'url' => $matches[2], 'title' => isset($matches[3]) ? $matches[3] : null, ]; $State = $State->setting( $State->get(DefinitionBook::class)->setting($id, $Data) ); return new self($State); } return null; } /** @return State */ public function latestState() { return $this->State; } /** * @return Invisible */ public function stateRenderable() { return new Invisible; } }