/** * Normalize the streams input. * * @param Migration $migration */ public function normalize(Migration $migration) { $stream = $migration->getStream(); if (is_string($stream)) { $stream = ['slug' => $stream]; } $stream['slug'] = array_get($stream, 'slug', $migration->contextualNamespace()); $stream['namespace'] = array_get($stream, 'namespace', $migration->contextualNamespace()); $migration->setStream($stream); }
/** * Guess the stream names. * * @param Migration $migration */ public function guess(Migration $migration) { /** * If we don't have any addon then * we can't automate anything. * * @var Addon $addon */ if (!($addon = $migration->getAddon())) { return; } $locale = $this->config->get('app.fallback_locale'); $stream = $migration->getStream(); foreach (['name', 'description'] as $key) { if (is_null(array_get($stream, $locale . '.' . $key))) { $stream = array_add($stream, $locale . '.' . $key, $addon->getNamespace('stream.' . array_get($stream, 'slug') . '.' . $key)); } } $migration->setStream($stream); }