src/Peach/DT/SimpleFormat.php
private function createContext($format)
    {
        $patternList = $this->patternList;
        $result      = array();
        $current     = "";
        $escaped     = false;
        for ($i = 0, $length = strlen($format); $i < $length; $i ++) {
            $chr = substr($format, $i, 1);
            if ($escaped) {
                $current .= $chr;
                $escaped = false;
            } else if ($chr === "\\") {
                $current .= $chr;
                $escaped = true;
            } else if (array_key_exists($chr, $patternList)) {
                if (strlen($current)) {
                    $result[] = $current;
                    $current = "";
                }
                $result[] = $chr;
            } else {
                $current .= $chr;
            }
        }
        if (strlen($current)) {
            $result[] = $current;
        }
        return $result;
    }
private function createContext($format)
    {
        $patternList = $this->patternList;
        $result      = array();
        $current     = "";
        $escaped     = false;
        for ($i = 0, $length = strlen($format); $i < $length; $i ++) {
            $chr = substr($format, $i, 1);
            if ($escaped) {
                $current .= $chr;
                $escaped = false;
            } else if ($chr === "\\") {
                $current .= $chr;
                $escaped = true;
            } else if (array_key_exists($chr, $patternList)) {
                if (strlen($current)) {
                    $result[] = $current;
                    $current = "";
                }
                $result[] = $chr;
            } else {
                $current .= $chr;
            }
        }
        if (strlen($current)) {
            $result[] = $current;
        }
        return $result;
    }
private function createContext ( $ format ) { $ patternList = $ this -> patternList ; $ result = array ( ) ; $ current = "" ; $ escaped = false ; for ( $ i = 0 , $ length = strlen ( $ format ) ; $ i < $ length ; $ i ++ ) { $ chr = substr ( $ format , $ i , 1 ) ; if ( $ escaped ) { $ current .= $ chr ; $ escaped = false ; } else if ( $ chr === "\\" ) { $ current .= $ chr ; $ escaped = true ; } else if ( array_key_exists ( $ chr , $ patternList ) ) { if ( strlen ( $ current ) ) { $ result [ ] = $ current ; $ current = "" ; } $ result [ ] = $ chr ; } else { $ current .= $ chr ; } } if ( strlen ( $ current ) ) { $ result [ ] = $ current ; } return $ result ; }
指定されたパターン文字列 (例えば "Y/m/d" など) を構文解析します.

@param  string $format パターン文字列
@return array          解析結果
指定されたパターン文字列 ( 例えば Y / m / d など ) を構文解析します .