private function targetToData(InstallTarget $target) { $data = new stdClass(); $data->installer = $target->getInstallerName(); $data->location = $target->getLocation(); if (InstallTarget::DEFAULT_URL_FORMAT !== ($urlFormat = $target->getUrlFormat())) { $data->{'url-format'} = $urlFormat; } if ($parameters = $target->getParameterValues()) { $data->parameters = (object) $parameters; } return $data; }
public function testCreateWithDefaultUrlFormat() { $target = new InstallTarget('local', 'symlink', 'web/assets'); $this->assertSame('/%s', $target->getUrlFormat()); $this->assertSame(array(), $target->getParameterValues()); }
private function targetsEqual(InstallTarget $target1, InstallTarget $target2) { if ($target1->getName() !== $target2->getName()) { return false; } if ($target1->getInstallerName() !== $target2->getInstallerName()) { return false; } if ($target1->getLocation() !== $target2->getLocation()) { return false; } if ($target1->getUrlFormat() !== $target2->getUrlFormat()) { return false; } $parameters1 = $target1->getParameterValues(); $parameters2 = $target2->getParameterValues(); ksort($parameters1); ksort($parameters2); if ($parameters1 !== $parameters2) { return false; } return true; }