partClass = PPDPart_Hash::class; parent::__construct( $data ); } /** * Get the accumulator that would result if the close is not found. * * @param int|bool $openingCount * @return array */ public function breakSyntax( $openingCount = false ) { if ( $this->open == "\n" ) { $accum = array_merge( [ $this->savedPrefix ], $this->parts[0]->out ); } else { if ( $openingCount === false ) { $openingCount = $this->count; } $s = substr( $this->open, 0, -1 ); $s .= str_repeat( substr( $this->open, -1 ), $openingCount - strlen( $s ) ); $accum = [ $this->savedPrefix . $s ]; $lastIndex = 0; $first = true; foreach ( $this->parts as $part ) { if ( $first ) { $first = false; } elseif ( is_string( $accum[$lastIndex] ) ) { $accum[$lastIndex] .= '|'; } else { $accum[++$lastIndex] = '|'; } foreach ( $part->out as $node ) { if ( is_string( $node ) && is_string( $accum[$lastIndex] ) ) { $accum[$lastIndex] .= $node; } else { $accum[++$lastIndex] = $node; } } } } return $accum; } }