Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 399 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 399 Revision 621
Zeile 505... Zeile 505...
505
     */
505
     */
506
    protected function compileStatements($template)
506
    protected function compileStatements($template)
507
    {
507
    {
508
        preg_match_all('/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( [\S\s]*? ) \))?/x', $template, $matches);
508
        preg_match_all('/\B@(@?\w+(?:::\w+)?)([ \t]*)(\( ( [\S\s]*? ) \))?/x', $template, $matches);
Zeile -... Zeile 509...
-
 
509
 
-
 
510
        $offset = 0;
509
 
511
 
510
        for ($i = 0; isset($matches[0][$i]); $i++) {
512
        for ($i = 0; isset($matches[0][$i]); $i++) {
511
            $match = [
513
            $match = [
512
                $matches[0][$i],
514
                $matches[0][$i],
513
                $matches[1][$i],
515
                $matches[1][$i],
Zeile 536... Zeile 538...
536
                $match[0] = $match[0].$rest.')';
538
                $match[0] = $match[0].$rest.')';
537
                $match[3] = $match[3].$rest.')';
539
                $match[3] = $match[3].$rest.')';
538
                $match[4] = $match[4].$rest;
540
                $match[4] = $match[4].$rest;
539
            }
541
            }
Zeile -... Zeile 542...
-
 
542
 
-
 
543
            [$template, $offset] = $this->replaceFirstStatement(
540
 
544
                $match[0],
-
 
545
                $this->compileStatement($match),
-
 
546
                $template,
-
 
547
                $offset
541
            $template = Str::replaceFirst($match[0], $this->compileStatement($match), $template);
548
            );
Zeile 542... Zeile 549...
542
        }
549
        }
543
 
550
 
Zeile 544... Zeile 551...
544
        return $template;
551
        return $template;
-
 
552
    }
-
 
553
 
-
 
554
    /**
-
 
555
     * Replace the first match for a statement compilation operation.
-
 
556
     *
-
 
557
     * @param  string  $search
-
 
558
     * @param  string  $replace
-
 
559
     * @param  string  $subject
-
 
560
     * @param  int  $offset
-
 
561
     * @return array
-
 
562
     */
-
 
563
    protected function replaceFirstStatement($search, $replace, $subject, $offset)
-
 
564
    {
-
 
565
        $search = (string) $search;
-
 
566
 
-
 
567
        if ($search === '') {
-
 
568
            return $subject;
-
 
569
        }
-
 
570
 
-
 
571
        $position = strpos($subject, $search, $offset);
-
 
572
 
-
 
573
        if ($position !== false) {
-
 
574
            return [
-
 
575
                substr_replace($subject, $replace, $position, strlen($search)),
-
 
576
                $position + strlen($replace),
-
 
577
            ];
-
 
578
        }
-
 
579
 
-
 
580
        return [$subject, 0];
545
    }
581
    }
546
 
582
 
547
    /**
583
    /**
548
     * Determine if the given expression has the same number of opening and closing parentheses.
584
     * Determine if the given expression has the same number of opening and closing parentheses.
549
     *
585
     *
Zeile 683... Zeile 719...
683
 
719
 
684
    /**
720
    /**
685
     * Check the result of a condition.
721
     * Check the result of a condition.
686
     *
722
     *
687
     * @param  string  $name
723
     * @param  string  $name
688
     * @param  array  ...$parameters
724
     * @param  mixed  ...$parameters
689
     * @return bool
725
     * @return bool
690
     */
726
     */
691
    public function check($name, ...$parameters)
727
    public function check($name, ...$parameters)
692
    {
728
    {