src/API/Implementation/SpellCheck/Yandex/YandexSpellCheckApi.php
protected function prepareCheckTextsResponse(ResponseContextAbstract $context): SpellCheckResponse
    {
        $response = new SpellCheckResponse();

        $corrections = [];

        foreach ($context->getArray() as $wordCorrections) {
            $corrected = [];

            foreach ($wordCorrections as $wordCorrection) {
                if (!empty($wordCorrection['s']) && !empty($wordCorrection['word'])) {
                    $corrected[$wordCorrection['word']] = (array)$wordCorrection['s'];
                }
            }

            $corrections[] = $corrected;
        }

        $response->setCorrections($corrections);

        return $response;
    }
protected function prepareCheckTextsResponse(ResponseContextAbstract $context): SpellCheckResponse
    {
        $response = new SpellCheckResponse();

        $corrections = [];

        foreach ($context->getArray() as $wordCorrections) {
            $corrected = [];

            foreach ($wordCorrections as $wordCorrection) {
                if (!empty($wordCorrection['s']) && !empty($wordCorrection['word'])) {
                    $corrected[$wordCorrection['word']] = (array)$wordCorrection['s'];
                }
            }

            $corrections[] = $corrected;
        }

        $response->setCorrections($corrections);

        return $response;
    }
protected function prepareCheckTextsResponse ( ResponseContextAbstract $ context ) : SpellCheckResponse { $ response = new SpellCheckResponse ( ) ; $ corrections = [ ] ; foreach ( $ context -> getArray ( ) as $ wordCorrections ) { $ corrected = [ ] ; foreach ( $ wordCorrections as $ wordCorrection ) { if ( ! empty ( $ wordCorrection [ 's' ] ) && ! empty ( $ wordCorrection [ 'word' ] ) ) { $ corrected [ $ wordCorrection [ 'word' ] ] = ( array ) $ wordCorrection [ 's' ] ; } } $ corrections [ ] = $ corrected ; } $ response -> setCorrections ( $ corrections ) ; return $ response ; }
Process response of spell-check request and prepare valid response

@param ResponseContextAbstract $context

@return SpellCheckResponse
Process response of spell - check request and prepare valid response