public function fire() { list($path, $contents) = $this->getKeyFile(); $key = Tiny::generate_set(); $contents = str_replace($this->laravel['config']['zackkitzmiller/tiny::key'], $key, $contents); $this->files->put($path, $contents); $this->laravel['config']['zackkitzmiller/tiny::key'] = $key; $this->info("Tiny key [{$key}] has been set."); }
public function testGenerateSetUnique() { $set = Tiny::generate_set(); $set_parts = str_split($set); $used = array(); foreach ($set_parts as $char) { $this->assertArrayNotHasKey($char, $used); $used[$char] = $char; } }
public function fire() { $key = Tiny::generate_set(); $path = base_path('.env'); if (file_exists($path) and getenv('LEAGUE_TINY_KEY') !== false) { $originalContent = file_get_contents($path); $content = str_replace('LEAGUE_TINY_KEY=' . getenv('LEAGUE_TINY_KEY'), 'LEAGUE_TINY_KEY=' . $key, $originalContent); file_put_contents($path, $content); } else { $fp = fopen($path, 'a'); fwrite($fp, "\nLEAGUE_TINY_KEY={$key}\n"); fclose($fp); } $this->info("Tiny key [{$key}] has been set."); }
/** * Do the tiny conversion. * @param string $text */ public function tiny($id) { return $this->tiny->to($id); }
/** * {@inheritdoc} * * @param string $str String to elucidate. * @return string */ public function elucidate($str) { return $this->_tiny->from($str); }