Skip to content

Commit dfce609

Browse files
small fixes
1 parent 5cd5ebd commit dfce609

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"fabpot/goutte": "^3.2",
1515
"guzzlehttp/guzzle": "~6.0",
1616
"yadakhov/insert-on-duplicate-key": "^0.0.9",
17-
"docker-php/docker-php": "^1.24"
17+
"docker-php/docker-php": "^1.24",
18+
"symfony/process": "^3.2.*"
1819
},
1920
"autoload": {
2021
"psr-4": {

src/Docker.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class Docker
3030
public function __construct(\Docker\Docker $docker)
3131
{
3232
$client = new DockerClient([
33-
'remote_socket' => getenv('DOCKER_SOCKET') ? : 'unix:///var/run/docker.sock',
33+
'remote_socket' => getenv('DOCKER_SOCKET') ?: 'unix:///var/run/docker.sock',
3434
]);
3535

36-
$this->client= new $docker($client);
36+
$this->client = new $docker($client);
3737
}
3838

3939
/**
@@ -73,6 +73,7 @@ public function isNamedContainerRunning($name)
7373
return true;
7474
}
7575
}
76+
7677
return false;
7778
}
7879

@@ -105,17 +106,18 @@ public function getNamedContainerPorts($name)
105106
$containerManager = $this->client->getContainerManager();
106107
$containers = $containerManager->findAll();
107108

108-
$ports = [];
109-
110109
foreach ($containers as $container) {
111110
if ($container->getNames()[0] == "/".$name) {
112111
$containerPorts = $container->getPorts();
113112
foreach ($containerPorts as $port) {
114113
$ports[] = $port->getPrivatePort();
115114
}
115+
116+
return $ports;
116117
}
117118
}
118-
return $ports;
119+
120+
return [];
119121
}
120122

121123
/**
@@ -153,6 +155,7 @@ public function imageExists($tag)
153155
return true;
154156
}
155157
}
158+
156159
return false;
157160
}
158161

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
use Exception;
77

88
/**
9-
* Class DockerServicesCommand
9+
* Class DockerServices
1010
*
1111
* @package luisgros
1212
*/
13-
class DockerServicesCommand extends Command
13+
class DockerServices extends Command
1414
{
1515
/**
1616
* The name and signature of the console command.
@@ -25,7 +25,7 @@ class DockerServicesCommand extends Command
2525
*/
2626
protected $description = 'Setup docker environment';
2727
/**
28-
* The console command description.
28+
* The services
2929
*
3030
* @var string
3131
*/
@@ -60,14 +60,14 @@ class DockerServicesCommand extends Command
6060
],
6161
];
6262
/**
63-
* @var \App\Console\Commands\Docker
63+
* @var Docker
6464
*/
6565
protected $docker;
6666

6767
/**
6868
* Create a new command instance.
6969
*
70-
* @param \luisgros\Docker $docker
70+
* @param Docker $docker
7171
*/
7272
public function __construct(Docker $docker)
7373
{
@@ -77,7 +77,7 @@ public function __construct(Docker $docker)
7777
}
7878

7979
/**
80-
* @throws \Exception
80+
* @throws Exception
8181
*/
8282
public function handle()
8383
{

0 commit comments

Comments
 (0)