for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the "andrey-helldar/laravel-lang-publisher" project.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @author Andrey Helldar <[email protected]>
* @copyright 2021 Andrey Helldar
* @license MIT
* @see https://github.com/andrey-helldar/laravel-lang-publisher
*/
declare(strict_types=1);
namespace Helldar\LaravelLangPublisher\Resources;
use Helldar\Contracts\LangPublisher\Translation as Resource;
use Helldar\LaravelLangPublisher\Concerns\Arrayable;
use Helldar\Support\Concerns\Makeable;
class Translation implements Resource
{
use Arrayable;
use Makeable;
protected $keys = [];
protected $translations = [];
public function getKeys(): array
return $this->keys;
}
public function keys(string $target, array $keys): Resource
$values = $this->keys[$target] ?? [];
$this->keys[$target] = $this->combine($values, $keys);
return $this;
public function translation(string $locale, string $target, array $translations): Resource
$values = $this->translations[$target][$locale] ?? [];
$this->translations[$target][$locale] = $this->mergeArray($values, $translations);
public function getTranslations(): array
return $this->translations;