コード例 #1
0
 /**
  * Compare two stack template models.
  *
  * @param Template $templateA First template model to compare.
  * @param Template $templateB Second template model to compare.
  * @return string Rendered unified diff of the changes between the first
  *     and second template models.
  */
 public function compareTemplate(Template $templateA, Template $templateB)
 {
     // The difference engine expects an array of strings, so get the
     // template bodies as JSON and explode in to separate lines.
     $diff = new Diff(explode("\n", $templateA->getBodyJSON()), explode("\n", $templateB->getBodyJSON()), []);
     return $diff->render(new Diff_Renderer_Text_Unified());
 }
コード例 #2
0
 public function testIsNotIdenticalBody()
 {
     $name = 'foo';
     $bodyA = new stdClass();
     $bodyA->foo = 'bar';
     $bodyB = new stdClass();
     $bodyB->baz = 'qux';
     $templateA = new Template($name, $bodyA);
     $templateB = new Template($name, $bodyB);
     $this->assertFalse($templateA->isIdentical($templateB));
 }
コード例 #3
0
 /**
  * Upload the template to S3 (squashing any sub-stack templates) and return
  * the URL.
  *
  * @param Template $template Template to squash and upload.
  * @return string URL of uploaded template.
  */
 public function getSquashedTemplateURL(Template $template)
 {
     $body = clone $template->getBody();
     $this->squashTemplate($body);
     return $this->uploadTemplate($body);
 }
コード例 #4
0
 public function isIdentical(self $template)
 {
     return $this->getName() === $template->getName() && $this->getBodyJSON() === $template->getBodyJSON();
 }