Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luisgros-fixeads committed Dec 4, 2016
1 parent 5cd5ebd commit dfce609
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"fabpot/goutte": "^3.2",
"guzzlehttp/guzzle": "~6.0",
"yadakhov/insert-on-duplicate-key": "^0.0.9",
"docker-php/docker-php": "^1.24"
"docker-php/docker-php": "^1.24",
"symfony/process": "^3.2.*"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 8 additions & 5 deletions src/Docker.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class Docker
public function __construct(\Docker\Docker $docker)
{
$client = new DockerClient([
'remote_socket' => getenv('DOCKER_SOCKET') ? : 'unix:///var/run/docker.sock',
'remote_socket' => getenv('DOCKER_SOCKET') ?: 'unix:///var/run/docker.sock',
]);

$this->client= new $docker($client);
$this->client = new $docker($client);
}

/**
Expand Down Expand Up @@ -73,6 +73,7 @@ public function isNamedContainerRunning($name)
return true;
}
}

return false;
}

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

$ports = [];

foreach ($containers as $container) {
if ($container->getNames()[0] == "/".$name) {
$containerPorts = $container->getPorts();
foreach ($containerPorts as $port) {
$ports[] = $port->getPrivatePort();
}

return $ports;
}
}
return $ports;

return [];
}

/**
Expand Down Expand Up @@ -153,6 +155,7 @@ public function imageExists($tag)
return true;
}
}

return false;
}

Expand Down
12 changes: 6 additions & 6 deletions src/DockerServicesCommand.php → src/DockerServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Exception;

/**
* Class DockerServicesCommand
* Class DockerServices
*
* @package luisgros
*/
class DockerServicesCommand extends Command
class DockerServices extends Command
{
/**
* The name and signature of the console command.
Expand All @@ -25,7 +25,7 @@ class DockerServicesCommand extends Command
*/
protected $description = 'Setup docker environment';
/**
* The console command description.
* The services
*
* @var string
*/
Expand Down Expand Up @@ -60,14 +60,14 @@ class DockerServicesCommand extends Command
],
];
/**
* @var \App\Console\Commands\Docker
* @var Docker
*/
protected $docker;

/**
* Create a new command instance.
*
* @param \luisgros\Docker $docker
* @param Docker $docker
*/
public function __construct(Docker $docker)
{
Expand All @@ -77,7 +77,7 @@ public function __construct(Docker $docker)
}

/**
* @throws \Exception
* @throws Exception
*/
public function handle()
{
Expand Down

0 comments on commit dfce609

Please sign in to comment.