@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function boot() |
| 15 | 15 | { |
| 16 | 16 | $this->publishes([ |
| 17 | - __DIR__.'/../config/sparkify.php' => config_path('sparkify.php'), |
|
| 17 | + __DIR__ . '/../config/sparkify.php' => config_path('sparkify.php'), |
|
| 18 | 18 | ]); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -3,29 +3,29 @@ |
||
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * Generate a new Api Key within your SparkPost Dashboard |
|
| 7 | - * |
|
| 8 | - * The only permission that should be selected is: Transmissions: Read-only |
|
| 9 | - */ |
|
| 6 | + * Generate a new Api Key within your SparkPost Dashboard |
|
| 7 | + * |
|
| 8 | + * The only permission that should be selected is: Transmissions: Read-only |
|
| 9 | + */ |
|
| 10 | 10 | 'sparkpost_api_key' => env('SPARKPOST_API_KEY'), |
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * The columns in your database that correspond to the user's |
|
| 15 | - * first and last name. If you use one column to store the user's |
|
| 16 | - * full name. Put that as the first name and leave the last |
|
| 17 | - * name blank |
|
| 18 | - * |
|
| 19 | - * Example: I store the user's full name in a column called username |
|
| 20 | - * 'first_name_column' => 'username' |
|
| 21 | - * 'last_name_column' => '' |
|
| 22 | - * |
|
| 23 | - */ |
|
| 14 | + * The columns in your database that correspond to the user's |
|
| 15 | + * first and last name. If you use one column to store the user's |
|
| 16 | + * full name. Put that as the first name and leave the last |
|
| 17 | + * name blank |
|
| 18 | + * |
|
| 19 | + * Example: I store the user's full name in a column called username |
|
| 20 | + * 'first_name_column' => 'username' |
|
| 21 | + * 'last_name_column' => '' |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | 24 | 'first_name_column' => 'first_name', |
| 25 | 25 | 'last_name_column' => 'last_name', |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * The user's email column in the database |
|
| 29 | - */ |
|
| 28 | + * The user's email column in the database |
|
| 29 | + */ |
|
| 30 | 30 | 'email_column' => 'email' |
| 31 | 31 | ]; |
@@ -4,35 +4,35 @@ discard block |
||
| 4 | 4 | define('COL_DEFAULT', 2); |
| 5 | 5 | |
| 6 | 6 | $fields = [ |
| 7 | - 'author_name' => ['Your name', '', ''], |
|
| 8 | - 'author_github_username' => ['Your Github username', '<username> in https://github.com/username', ''], |
|
| 9 | - 'author_email' => ['Your email address', '', ''], |
|
| 10 | - 'author_twitter' => ['Your twitter username', '', '@{author_github_username}'], |
|
| 11 | - 'author_website' => ['Your website', '', 'https://github.com/{author_github_username}'], |
|
| 7 | + 'author_name' => ['Your name', '', ''], |
|
| 8 | + 'author_github_username' => ['Your Github username', '<username> in https://github.com/username', ''], |
|
| 9 | + 'author_email' => ['Your email address', '', ''], |
|
| 10 | + 'author_twitter' => ['Your twitter username', '', '@{author_github_username}'], |
|
| 11 | + 'author_website' => ['Your website', '', 'https://github.com/{author_github_username}'], |
|
| 12 | 12 | |
| 13 | - 'package_vendor' => ['Package vendor', '<vendor> in https://github.com/vendor/package', '{author_github_username}'], |
|
| 14 | - 'package_name' => ['Package name', '<package> in https://github.com/vendor/package', ''], |
|
| 15 | - 'package_description' => ['Package very short description', '', ''], |
|
| 13 | + 'package_vendor' => ['Package vendor', '<vendor> in https://github.com/vendor/package', '{author_github_username}'], |
|
| 14 | + 'package_name' => ['Package name', '<package> in https://github.com/vendor/package', ''], |
|
| 15 | + 'package_description' => ['Package very short description', '', ''], |
|
| 16 | 16 | |
| 17 | - 'psr4_namespace' => ['PSR-4 namespace', 'usually, Vendor\\Package', '{package_vendor}\\{package_name}'], |
|
| 17 | + 'psr4_namespace' => ['PSR-4 namespace', 'usually, Vendor\\Package', '{package_vendor}\\{package_name}'], |
|
| 18 | 18 | ]; |
| 19 | 19 | |
| 20 | 20 | $values = []; |
| 21 | 21 | |
| 22 | 22 | $replacements = [ |
| 23 | - 'BrantWladichuk\\\\Sparkify\\\\' => function () use(&$values) { return str_replace('\\', '\\\\', $values['psr4_namespace']) . '\\\\'; }, |
|
| 24 | - ':author_name' => function () use(&$values) { return $values['author_name']; }, |
|
| 25 | - ':author_username' => function () use(&$values) { return $values['author_github_username']; }, |
|
| 26 | - ':author_website' => function () use(&$values) { return $values['author_website'] ?: ('https://github.com/' . $values['author_github_username']); }, |
|
| 27 | - ':author_email' => function () use(&$values) { return $values['author_email'] ?: ($values['author_github_username'] . '@example.com'); }, |
|
| 28 | - 'BrantWladichuk' => function () use(&$values) { return $values['package_vendor']; }, |
|
| 29 | - 'Sparkify' => function () use(&$values) { return $values['package_name']; }, |
|
| 30 | - ':package_description' => function () use(&$values) { return $values['package_description']; }, |
|
| 31 | - 'League\\Skeleton' => function () use(&$values) { return $values['psr4_namespace']; }, |
|
| 23 | + 'BrantWladichuk\\\\Sparkify\\\\' => function() use(&$values) { return str_replace('\\', '\\\\', $values['psr4_namespace']) . '\\\\'; }, |
|
| 24 | + ':author_name' => function() use(&$values) { return $values['author_name']; }, |
|
| 25 | + ':author_username' => function() use(&$values) { return $values['author_github_username']; }, |
|
| 26 | + ':author_website' => function() use(&$values) { return $values['author_website'] ?: ('https://github.com/' . $values['author_github_username']); }, |
|
| 27 | + ':author_email' => function() use(&$values) { return $values['author_email'] ?: ($values['author_github_username'] . '@example.com'); }, |
|
| 28 | + 'BrantWladichuk' => function() use(&$values) { return $values['package_vendor']; }, |
|
| 29 | + 'Sparkify' => function() use(&$values) { return $values['package_name']; }, |
|
| 30 | + ':package_description' => function() use(&$values) { return $values['package_description']; }, |
|
| 31 | + 'League\\Skeleton' => function() use(&$values) { return $values['psr4_namespace']; }, |
|
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | -function read_from_console ($prompt) { |
|
| 35 | - if ( function_exists('readline') ) { |
|
| 34 | +function read_from_console($prompt) { |
|
| 35 | + if (function_exists('readline')) { |
|
| 36 | 36 | $line = trim(readline($prompt)); |
| 37 | 37 | if (!empty($line)) { |
| 38 | 38 | readline_add_history($line); |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | echo "Please, provide the following information:\n"; |
| 69 | 69 | echo "----------------------------------------------------------------------\n"; |
| 70 | 70 | foreach ($fields as $f => $field) { |
| 71 | - $default = isset($field[COL_DEFAULT]) ? interpolate($field[COL_DEFAULT], $values): ''; |
|
| 71 | + $default = isset($field[COL_DEFAULT]) ? interpolate($field[COL_DEFAULT], $values) : ''; |
|
| 72 | 72 | $prompt = sprintf( |
| 73 | 73 | '%s%s%s: ', |
| 74 | 74 | $field[COL_DESCRIPTION], |
| 75 | - $field[COL_HELP] ? ' (' . $field[COL_HELP] . ')': '', |
|
| 76 | - $field[COL_DEFAULT] !== '' ? ' [' . $default . ']': '' |
|
| 75 | + $field[COL_HELP] ? ' (' . $field[COL_HELP] . ')' : '', |
|
| 76 | + $field[COL_DEFAULT] !== '' ? ' [' . $default . ']' : '' |
|
| 77 | 77 | ); |
| 78 | 78 | $values[$f] = read_from_console($prompt); |
| 79 | 79 | if (empty($values[$f])) { |