/** * 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()); }
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)); }
/** * 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); }
public function isIdentical(self $template) { return $this->getName() === $template->getName() && $this->getBodyJSON() === $template->getBodyJSON(); }