| 1 | <?php |
||
| 10 | class ProjectShouldBeInHomeDirectory implements ProjectManager |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var ProjectManager |
||
| 14 | */ |
||
| 15 | private $projectManager; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var UserInteraction |
||
| 19 | */ |
||
| 20 | private $userInteraction; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param ProjectManager $projectManager |
||
| 24 | * @param UserInteraction $userInteraction |
||
| 25 | */ |
||
| 26 | public function __construct(ProjectManager $projectManager, UserInteraction $userInteraction) |
||
| 27 | { |
||
| 28 | $this->projectManager = $projectManager; |
||
| 29 | $this->userInteraction = $userInteraction; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | public function start(Project $project) |
||
| 36 | { |
||
| 37 | if (!$this->inHomeDirectory()) { |
||
| 38 | throw new ProjectException('The project have to be in your home directly to be able to share it with the Docker VM'); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $this->projectManager->start($project); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | public function stop(Project $project) |
||
| 51 | |||
| 52 | /** |
||
| 53 | * {@inheritdoc} |
||
| 54 | */ |
||
| 55 | public function reset(Project $project, array $containers = []) |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | private function inHomeDirectory() |
||
| 70 | } |
||
| 71 |