Inflection.php
private function _sklon($nPad, $vzndx, $txt, $zivotne = false)
    {

        if ($vzndx < 0 || $vzndx >= \count($this->vzor)) {
            return '???';
        }

        $txt3 = $this->_xEdeten($txt);
        $kndx = $this->_isShoda($this->vzor[$vzndx][1], $txt3);
        if ($kndx < 0 || $nPad < 1 || $nPad > 14) {
            //8-14 je pro plural
            return '???';
        }
        if ($this->vzor[$vzndx][$nPad] === '?') {
            return '?';
        }

        if (!$this->isDbgMode & $nPad === 1) {
            // 1. pad nemenime
            $rv = $this->_xDetene($txt3);
        } else {
            $rv = $this->_leftStr($kndx, $txt3) . '-' . $this->_cmpFrm($this->vzor[$vzndx][$nPad]);
        }

        if ($this->isDbgMode) {
            //preskoceni filtrovani
            return $rv;
        }
        // Formatovani zivotneho sklonovani
        // - nalezeni pomlcky
        $length = mb_strlen($rv, 'UTF-8');
        for ($nnn = 0; $nnn < $length; $nnn++) {
            if (mb_substr($rv, $nnn, 1, 'UTF-8') === '-') {
                break;
            }
        }
        $ndx1 = $nnn;

        // - nalezeni lomitka
        for ($nnn = 0; $nnn < $length; $nnn++) {
            if (mb_substr($rv, $nnn, 1, 'UTF-8') === '/') {
                break;
            }
        }
        $ndx2 = $nnn;

        if ($ndx1 !== $length && $ndx2 !== $length) {
            if ($zivotne) {
                // 'text-xxx/yyy' -> 'textyyy'
                $rv = $this->_leftStr($ndx1, $rv) . $this->_rightStr($ndx2 + 1, $rv);
            } else {
                // 'text-xxx/yyy' -> 'text-xxx'
                $rv = $this->_leftStr($ndx2, $rv);
            }
            $length = mb_strlen($rv, 'UTF-8');
        }

        // vypusteni pomocnych znaku
        $txt3 = '';
        for ($nnn = 0; $nnn < $length; $nnn++) {
            $subStr = mb_substr($rv, $nnn, 1, 'UTF-8');
            if (!($subStr === '-' || $subStr === '/')) {
                $txt3 .= mb_substr($rv, $nnn, 1, 'UTF-8');
            }
        }
        $rv = $this->_xDetene($txt3);

        return $rv;
        //  return $this->LeftStr( $kndx, $txt ) + $this->vzor[$vzndx][$nPad];
    }
private function _sklon($nPad, $vzndx, $txt, $zivotne = false)
    {

        if ($vzndx < 0 || $vzndx >= \count($this->vzor)) {
            return '???';
        }

        $txt3 = $this->_xEdeten($txt);
        $kndx = $this->_isShoda($this->vzor[$vzndx][1], $txt3);
        if ($kndx < 0 || $nPad < 1 || $nPad > 14) {
            //8-14 je pro plural
            return '???';
        }
        if ($this->vzor[$vzndx][$nPad] === '?') {
            return '?';
        }

        if (!$this->isDbgMode & $nPad === 1) {
            // 1. pad nemenime
            $rv = $this->_xDetene($txt3);
        } else {
            $rv = $this->_leftStr($kndx, $txt3) . '-' . $this->_cmpFrm($this->vzor[$vzndx][$nPad]);
        }

        if ($this->isDbgMode) {
            //preskoceni filtrovani
            return $rv;
        }
        // Formatovani zivotneho sklonovani
        // - nalezeni pomlcky
        $length = mb_strlen($rv, 'UTF-8');
        for ($nnn = 0; $nnn < $length; $nnn++) {
            if (mb_substr($rv, $nnn, 1, 'UTF-8') === '-') {
                break;
            }
        }
        $ndx1 = $nnn;

        // - nalezeni lomitka
        for ($nnn = 0; $nnn < $length; $nnn++) {
            if (mb_substr($rv, $nnn, 1, 'UTF-8') === '/') {
                break;
            }
        }
        $ndx2 = $nnn;

        if ($ndx1 !== $length && $ndx2 !== $length) {
            if ($zivotne) {
                // 'text-xxx/yyy' -> 'textyyy'
                $rv = $this->_leftStr($ndx1, $rv) . $this->_rightStr($ndx2 + 1, $rv);
            } else {
                // 'text-xxx/yyy' -> 'text-xxx'
                $rv = $this->_leftStr($ndx2, $rv);
            }
            $length = mb_strlen($rv, 'UTF-8');
        }

        // vypusteni pomocnych znaku
        $txt3 = '';
        for ($nnn = 0; $nnn < $length; $nnn++) {
            $subStr = mb_substr($rv, $nnn, 1, 'UTF-8');
            if (!($subStr === '-' || $subStr === '/')) {
                $txt3 .= mb_substr($rv, $nnn, 1, 'UTF-8');
            }
        }
        $rv = $this->_xDetene($txt3);

        return $rv;
        //  return $this->LeftStr( $kndx, $txt ) + $this->vzor[$vzndx][$nPad];
    }
private function _sklon ( $ nPad , $ vzndx , $ txt , $ zivotne = false ) { if ( $ vzndx < 0 || $ vzndx >= \ count ( $ this -> vzor ) ) { return '???' ; } $ txt3 = $ this -> _xEdeten ( $ txt ) ; $ kndx = $ this -> _isShoda ( $ this -> vzor [ $ vzndx ] [ 1 ] , $ txt3 ) ; if ( $ kndx < 0 || $ nPad < 1 || $ nPad > 14 ) { //8-14 je pro plural return '???' ; } if ( $ this -> vzor [ $ vzndx ] [ $ nPad ] === '?' ) { return '?' ; } if ( ! $ this -> isDbgMode & $ nPad === 1 ) { // 1. pad nemenime $ rv = $ this -> _xDetene ( $ txt3 ) ; } else { $ rv = $ this -> _leftStr ( $ kndx , $ txt3 ) . '-' . $ this -> _cmpFrm ( $ this -> vzor [ $ vzndx ] [ $ nPad ] ) ; } if ( $ this -> isDbgMode ) { //preskoceni filtrovani return $ rv ; } // Formatovani zivotneho sklonovani // - nalezeni pomlcky $ length = mb_strlen ( $ rv , 'UTF-8' ) ; for ( $ nnn = 0 ; $ nnn < $ length ; $ nnn ++ ) { if ( mb_substr ( $ rv , $ nnn , 1 , 'UTF-8' ) === '-' ) { break ; } } $ ndx1 = $ nnn ; // - nalezeni lomitka for ( $ nnn = 0 ; $ nnn < $ length ; $ nnn ++ ) { if ( mb_substr ( $ rv , $ nnn , 1 , 'UTF-8' ) === '/' ) { break ; } } $ ndx2 = $ nnn ; if ( $ ndx1 !== $ length && $ ndx2 !== $ length ) { if ( $ zivotne ) { // 'text-xxx/yyy' -> 'textyyy' $ rv = $ this -> _leftStr ( $ ndx1 , $ rv ) . $ this -> _rightStr ( $ ndx2 + 1 , $ rv ) ; } else { // 'text-xxx/yyy' -> 'text-xxx' $ rv = $ this -> _leftStr ( $ ndx2 , $ rv ) ; } $ length = mb_strlen ( $ rv , 'UTF-8' ) ; } // vypusteni pomocnych znaku $ txt3 = '' ; for ( $ nnn = 0 ; $ nnn < $ length ; $ nnn ++ ) { $ subStr = mb_substr ( $ rv , $ nnn , 1 , 'UTF-8' ) ; if ( ! ( $ subStr === '-' || $ subStr === '/' ) ) { $ txt3 .= mb_substr ( $ rv , $ nnn , 1 , 'UTF-8' ) ; } } $ rv = $ this -> _xDetene ( $ txt3 ) ; return $ rv ; //  return $this->LeftStr( $kndx, $txt ) + $this->vzor[$vzndx][$nPad]; }
Funkce pro sklonovani slova do daneho podle daneho vzoru

@param int $nPad Cislo padu
@param int $vzndx ??
@param string $txt Vstupni text
@param bool $zivotne Zda je slovo zivotne

@return string
Funkce pro sklonovani slova do daneho podle daneho vzoru