Pickle\Engine\HHVM\Ini::setupPickleSectionPositions PHP Метод

setupPickleSectionPositions() защищенный Метод

    protected function setupPickleSectionPositions()
    {
        $posHeader = strpos($this->raw, self::PICKLE_HEADER);
        if (false === $posHeader) {
            /* no pickle section here yet */
            $this->pickleHeaderStartPos = strlen($this->raw);
            return;
        }
        $this->pickleHeaderStartPos = $posHeader;
        $this->pickleHeaderEndPos = $this->pickleHeaderStartPos + strlen(self::PICKLE_HEADER);
        $posFooter = strpos($this->raw, self::PICKLE_FOOTER);
        if (false === $posFooter) {
            /* This is bad, no end of section marker, will have to lookup. The strategy is
                   - look for the last extension directve after the header
                   - extension directives are expected to come one after another one per line
                   - comments are not expected inbetveen
                   - mark the next pos after the last extension directive as the footer pos
               */
            $pos = $this->pickleHeaderEndPos;
            do {
                $pos = strpos($this->raw, 'hhvm.dynamic_extensions[', $pos);
                if (false !== $pos) {
                    $this->pickleFooterStartPos = $pos;
                    $pos++;
                }
            } while (false !== $pos);
            $this->pickleFooterStartPos = strpos($this->raw, "\n", $this->pickleFooterStartPos);
        } else {
            $this->pickleFooterStartPos = $posFooter;
            $this->pickleFooterEndPos = $this->pickleFooterStartPos + strlen(self::PICKLE_FOOTER);
        }
    }