translation/laravel

View on GitHub
src/POExtractor.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Tio\Laravel;

use Gettext\Translations;

class POExtractor
{
    public function call($string)
    {
        $translations = Translations::fromPoString($string);

        $return = [];

        foreach ($translations as $translation) {
            $return[$translation->getContext()] = $translation->getTranslation();
        }

        return $return;
    }
}