/** * @param DirectoriesInterface $directories * @param FilesInterface $files * @param EncrypterConfig $config */ public function perform(DirectoriesInterface $directories, FilesInterface $files, EncrypterConfig $config) { $envFilename = $directories->directory('root') . '.env'; if (!$files->exists($envFilename)) { $this->writeln("<fg=red>'env.' file does not exists, unable to sek encryption key.</fg=red>"); } $files->write($envFilename, str_replace($config->getKey(), Strings::random(32), $files->read($envFilename))); $this->writeln("<info>Encryption key has been successfully updated.</info>"); }
/** * {@inheritdoc} */ public function createInjection(\ReflectionClass $class, $context = null) { return $class->newInstance($this->config->getKey(), $this->config->getCipher()); }
/** * {@inheritdoc} */ public function createInjection(\ReflectionClass $class, $context = null) { return $class->newInstance(base64_decode($this->config->getKey())); }