@@ -35,6 +35,7 @@ abstract class BaseService
35
35
protected $ shell ;
36
36
protected $ environment ;
37
37
protected $ docker ;
38
+ protected $ dockerTags ;
38
39
39
40
public function __construct (Shell $ shell , Environment $ environment , Docker $ docker , DockerTags $ dockerTags )
40
41
{
@@ -56,7 +57,7 @@ public function __construct(Shell $shell, Environment $environment, Docker $dock
56
57
];
57
58
}
58
59
59
- public function install ()
60
+ public function install (): void
60
61
{
61
62
$ this ->prompts ();
62
63
$ this ->ensureImageIsDownloaded ();
@@ -71,7 +72,7 @@ public function install()
71
72
72
73
$ this ->info ("\nInstallation complete! " );
73
74
} catch (Throwable $ e ) {
74
- return $ this ->error ("\nInstallation failed! " );
75
+ $ this ->error ("\nInstallation failed! " );
75
76
}
76
77
}
77
78
@@ -90,7 +91,12 @@ public function shortName(): string
90
91
return strtolower (class_basename (static ::class));
91
92
}
92
93
93
- protected function ensureImageIsDownloaded ()
94
+ public function defaultPort (): int
95
+ {
96
+ return $ this ->defaultPort ;
97
+ }
98
+
99
+ protected function ensureImageIsDownloaded (): void
94
100
{
95
101
if ($ this ->docker ->imageIsDownloaded ($ this ->organization , $ this ->imageName , $ this ->tag )) {
96
102
return ;
@@ -100,7 +106,7 @@ protected function ensureImageIsDownloaded()
100
106
$ this ->docker ->downloadImage ($ this ->organization , $ this ->imageName , $ this ->tag );
101
107
}
102
108
103
- protected function prompts ()
109
+ protected function prompts (): void
104
110
{
105
111
foreach ($ this ->defaultPrompts as $ prompt ) {
106
112
$ this ->askQuestion ($ prompt );
@@ -118,7 +124,7 @@ protected function prompts()
118
124
$ this ->tag = $ this ->resolveTag ($ this ->promptResponses ['tag ' ]);
119
125
}
120
126
121
- protected function askQuestion ($ prompt ): void
127
+ protected function askQuestion (array $ prompt ): void
122
128
{
123
129
$ this ->promptResponses [$ prompt ['shortname ' ]] = app ('console ' )->ask ($ prompt ['prompt ' ], $ prompt ['default ' ] ?? null );
124
130
}
@@ -132,11 +138,12 @@ protected function resolveTag($responseTag)
132
138
return $ responseTag ;
133
139
}
134
140
135
- protected function buildParameters ()
141
+ protected function buildParameters (): array
136
142
{
137
143
$ parameters = $ this ->promptResponses ;
138
144
$ parameters ['container_name ' ] = $ this ->containerName ();
139
145
$ parameters ['tag ' ] = $ this ->tag ; // Overwrite "latest" with actual latest tag
146
+
140
147
return $ parameters ;
141
148
}
142
149
0 commit comments