Skip to content

Commit 6140b6d

Browse files
committed
Replace word "container" with "service"
Signed-off-by: Kirtan Gajjar <[email protected]>
1 parent 9963309 commit 6140b6d

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/Service_Command.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
use EE\Utils;
44

55
/**
6-
* Manages global containers of EasyEngine.
6+
* Manages global services of EasyEngine.
77
*
88
* ## EXAMPLES
99
*
10-
* # Restarts global nginx proxy containers
10+
* # Restarts global nginx proxy service
1111
* $ ee service restart nginx-proxy
1212
*
1313
* @package ee-cli
1414
*/
1515
class Service_Command extends EE_Command {
1616

1717
/**
18-
* @var array Array of containers defined in global docker-compose.yml
18+
* @var array Array of services defined in global docker-compose.yml
1919
*/
20-
private $whitelisted_containers = [
20+
private $whitelisted_services = [
2121
'nginx-proxy',
2222
];
2323

@@ -31,85 +31,85 @@ public function __construct() {
3131
}
3232

3333
/**
34-
* Starts global containers.
34+
* Starts global services.
3535
*
3636
* ## OPTIONS
3737
*
3838
* <service-name>
39-
* : Name of container.
39+
* : Name of service.
4040
*/
4141
public function start( $args, $assoc_args ) {
42-
$container = $this->filter_container( $args );
42+
$service = $this->filter_service( $args );
4343

44-
EE::exec( "docker-compose start $container", true, true );
44+
EE::exec( "docker-compose start $service", true, true );
4545
}
4646

4747
/**
48-
* Returns valid container name from arguments.
48+
* Returns valid service name from arguments.
4949
*/
50-
private function filter_container( $args ) {
51-
$containers = array_intersect( $this->whitelisted_containers, $args );
50+
private function filter_service( $args ) {
51+
$services = array_intersect( $this->whitelisted_services, $args );
5252

53-
if ( empty( $containers ) ) {
54-
EE::error( "Unable to find global EasyEngine container $args[0]" );
53+
if ( empty( $services ) ) {
54+
EE::error( "Unable to find global EasyEngine service $args[0]" );
5555
}
5656

57-
return $containers[0];
57+
return $services[0];
5858
}
5959

6060
/**
61-
* Stops global containers.
61+
* Stops global services.
6262
*
6363
* ## OPTIONS
6464
*
6565
* <service-name>
66-
* : Name of container.
66+
* : Name of service.
6767
*/
6868
public function stop( $args, $assoc_args ) {
69-
$container = $this->filter_container( $args );
70-
EE::exec( "docker-compose stop $container", true, true );
69+
$service = $this->filter_service( $args );
70+
EE::exec( "docker-compose stop $service", true, true );
7171
}
7272

7373
/**
74-
* Restarts global containers.
74+
* Restarts global services.
7575
*
7676
* ## OPTIONS
7777
*
7878
* <service-name>
79-
* : Name of container.
79+
* : Name of service.
8080
*/
8181
public function restart( $args, $assoc_args ) {
82-
$container = $this->filter_container( $args );
83-
EE::exec( "docker-compose restart $container", true, true );
82+
$service = $this->filter_service( $args );
83+
EE::exec( "docker-compose restart $service", true, true );
8484
}
8585

8686
/**
87-
* Reloads global service without restarting containers.
87+
* Reloads global service without restarting services.
8888
*
8989
* ## OPTIONS
9090
*
9191
* <service-name>
92-
* : Name of container.
92+
* : Name of service.
9393
*/
9494
public function reload( $args, $assoc_args ) {
95-
$container = $this->filter_container( $args );
96-
$command = $this->container_reload_command( $container );
97-
EE::exec( "docker-compose exec $container $command", true, true );
95+
$service = $this->filter_service( $args );
96+
$command = $this->service_reload_command( $service );
97+
EE::exec( "docker-compose exec $service $command", true, true );
9898
}
9999

100100
/**
101-
* Returns reload command of a container.
101+
* Returns reload command of a service.
102102
* This is necessary since command to reload each service can be different.
103103
*
104-
* @param $container name of conntainer
104+
* @param $service string name of service
105105
*
106106
* @return mixed
107107
*/
108-
private function container_reload_command( string $container ) {
108+
private function service_reload_command( string $service ) {
109109
$command_map = [
110110
'nginx-proxy' => "sh -c 'nginx -t && service nginx reload'",
111111
];
112112

113-
return $command_map[ $container ];
113+
return $command_map[ $service ];
114114
}
115115
}

0 commit comments

Comments
 (0)