private static function _readFile($locale, $path, $attribute, $value, $temp)
    {
        // without attribute - read all values
        // with attribute    - read only this value
        if (!empty(self::$_ldml[(string) $locale])) {

            $result = self::$_ldml[(string) $locale]->xpath($path);
            if (!empty($result)) {
                foreach ($result as &$found) {

                    if (empty($value)) {

                        if (empty($attribute)) {
                            // Case 1
                            $temp[] = (string) $found;
                        } else if (empty($temp[(string) $found[$attribute]])){
                            // Case 2
                            $temp[(string) $found[$attribute]] = (string) $found;
                        }

                    } else if (empty ($temp[$value])) {

                        if (empty($attribute)) {
                            // Case 3
                            $temp[$value] = (string) $found;
                        } else {
                            // Case 4
                            $temp[$value] = (string) $found[$attribute];
                        }

                    }
                }
            }
        }
        return $temp;
    }
private static function _readFile($locale, $path, $attribute, $value, $temp)
    {
        // without attribute - read all values
        // with attribute    - read only this value
        if (!empty(self::$_ldml[(string) $locale])) {

            $result = self::$_ldml[(string) $locale]->xpath($path);
            if (!empty($result)) {
                foreach ($result as &$found) {

                    if (empty($value)) {

                        if (empty($attribute)) {
                            // Case 1
                            $temp[] = (string) $found;
                        } else if (empty($temp[(string) $found[$attribute]])){
                            // Case 2
                            $temp[(string) $found[$attribute]] = (string) $found;
                        }

                    } else if (empty ($temp[$value])) {

                        if (empty($attribute)) {
                            // Case 3
                            $temp[$value] = (string) $found;
                        } else {
                            // Case 4
                            $temp[$value] = (string) $found[$attribute];
                        }

                    }
                }
            }
        }
        return $temp;
    }
private static function _readFile ( $ locale , $ path , $ attribute , $ value , $ temp ) { // without attribute - read all values // with attribute    - read only this value if ( ! empty ( self :: $ _ldml [ ( string ) $ locale ] ) ) { $ result = self :: $ _ldml [ ( string ) $ locale ] -> xpath ( $ path ) ; if ( ! empty ( $ result ) ) { foreach ( $ result as & $ found ) { if ( empty ( $ value ) ) { if ( empty ( $ attribute ) ) { // Case 1 $ temp [ ] = ( string ) $ found ; } else if ( empty ( $ temp [ ( string ) $ found [ $ attribute ] ] ) ) { // Case 2 $ temp [ ( string ) $ found [ $ attribute ] ] = ( string ) $ found ; } } else if ( empty ( $ temp [ $ value ] ) ) { if ( empty ( $ attribute ) ) { // Case 3 $ temp [ $ value ] = ( string ) $ found ; } else { // Case 4 $ temp [ $ value ] = ( string ) $ found [ $ attribute ] ; } } } } } return $ temp ; }
Read the content from locale

Can be called like:
<ldml>
<delimiter>test</delimiter>
<second type='myone'>content</second>
<second type='mysecond'>content2</second>
<third type='mythird' />
</ldml>

Case 1: _readFile('ar','/ldml/delimiter')             -> returns [] = test
Case 1: _readFile('ar','/ldml/second[@type=myone]')   -> returns [] = content
Case 2: _readFile('ar','/ldml/second','type')         -> returns [myone] = content; [mysecond] = content2
Case 3: _readFile('ar','/ldml/delimiter',,'right')    -> returns [right] = test
Case 4: _readFile('ar','/ldml/third','type','myone')  -> returns [myone] = mythird

@param  string $locale
@param  string $path
@param  string $attribute
@param  string $value
@access private
@return array
Read the content from locale