/**
  * Parses expressions
  *
  * @param DockerTemplate $dockerTemplate
  *
  * @return DockerTemplate|static
  */
 private function parseExpressions(DockerTemplate $dockerTemplate)
 {
     preg_match_all("#\\[\\*((?!if|\\/if)[^\\*]+)\\*\\]#i", $dockerTemplate->content(), $matches);
     for ($i = 0; $i < count($matches[0]); $i++) {
         $evaluatedExpression = $this->evaluate($matches[1][$i]);
         $dockerTemplate = $dockerTemplate->replaceContent($matches[0][$i], $evaluatedExpression);
     }
     return $dockerTemplate;
 }
 /**
  * @inheritDoc
  */
 public function parse(DockerTemplate $dockerTemplate)
 {
     preg_match_all("#{include:(.*)}#", $dockerTemplate->content(), $matches);
     for ($i = 0; $i < count($matches[0]); $i++) {
         $filePath = $this->partialsFolder . DIRECTORY_SEPARATOR . $matches[1][$i];
         $contents = $this->getFileContent($filePath);
         $dockerTemplate = $dockerTemplate->replaceContent($matches[0][$i], $contents);
     }
     return $dockerTemplate;
 }
 /**
  * @inheritDoc
  */
 public function parse(DockerTemplate $dockerTemplate)
 {
     preg_match_all('#{add:([^:\\s]*):([^:\\s]*)}#', $dockerTemplate->content(), $matches);
     for ($i = 0; $i < count($matches[0]); $i++) {
         $fileSource = $this->resourcesFolder . DIRECTORY_SEPARATOR . $matches[1][$i];
         $fileDestination = $this->destinationFolder . DIRECTORY_SEPARATOR . $dockerTemplate->name();
         $this->copyFile($fileSource, $fileDestination);
         $dockerTemplate = $dockerTemplate->replaceContent($matches[0][$i], 'ADD ' . basename($fileSource) . ' ' . $matches[2][$i]);
     }
     return $dockerTemplate;
 }