src/Translate.php
public function addSubresource($subresource, string $locale): void
    {
        if ($subresource instanceof Resource) {
            $resource = $subresource;
        } elseif (is_string($subresource)) {
            $resource = ResourceBuilder::fromFile($subresource, $locale);
        } elseif (is_array($subresource)) {
            $resource = ResourceBuilder::fromArray($subresource, $locale);
        } else {
            throw new \InvalidArgumentException('Invalid subresource');
        }

        if (isset($this->data[$locale])) {
            $this->data[$locale]->merge($resource);
        } else {
            $this->data[$locale] = $resource;
        }
    }
public function addSubresource($subresource, string $locale): void
    {
        if ($subresource instanceof Resource) {
            $resource = $subresource;
        } elseif (is_string($subresource)) {
            $resource = ResourceBuilder::fromFile($subresource, $locale);
        } elseif (is_array($subresource)) {
            $resource = ResourceBuilder::fromArray($subresource, $locale);
        } else {
            throw new \InvalidArgumentException('Invalid subresource');
        }

        if (isset($this->data[$locale])) {
            $this->data[$locale]->merge($resource);
        } else {
            $this->data[$locale] = $resource;
        }
    }
public function addSubresource ( $ subresource , string $ locale ) : void { if ( $ subresource instanceof Resource ) { $ resource = $ subresource ; } elseif ( is_string ( $ subresource ) ) { $ resource = ResourceBuilder :: fromFile ( $ subresource , $ locale ) ; } elseif ( is_array ( $ subresource ) ) { $ resource = ResourceBuilder :: fromArray ( $ subresource , $ locale ) ; } else { throw new \ InvalidArgumentException ( 'Invalid subresource' ) ; } if ( isset ( $ this -> data [ $ locale ] ) ) { $ this -> data [ $ locale ] -> merge ( $ resource ) ; } else { $ this -> data [ $ locale ] = $ resource ; } }
Adds a sub-resource
@param mixed $subresource The sub-resource value
@param string $locale
Adds a sub - resource