It automates and accelerates build and release processes through server pooling and fault tolerance for Agile development and streamlined software delivery.
The views expressed in this commentary are the author's own and do not necessarily reflect those of IBM.
interface + type hinting
= more stable code with less effort
/** Used for object transportation */
interface BuildForge_Services_Serializable {
/** @param array|null $data */
public function fromArray(array $data = null);
/** @return array */
public function toArray();
}
/** Create snapshot metadata */
$snapshot = BuildForge_Services_DBO_Snapshot::createSnapshot(
$services,
"My New Snapshot",
"A Comment about My New Snapshot"
);
/** Get a new snapshot of the $originalOne */
return $originalOne->snapshot(
$snapshot->getUuid(),
new BuildForge_Services_DBO_SnapshotRequest(true),
false
);
interface Iterator extends Traversable {
function rewind();
function current();
function key();
function next();
function valid();
}
class BuildForge_Services_DBO_ProjectIterator
extends BuildForge_Services_Iterator {
public function current() {
$current = parent::current();
if (empty($current)) return $current;
$project = new BuildForge_Services_DBO_Project($this->conn);
$project->fromArray($current);
return $project;
}
}
// Elsewhere in the app...
$projects = BuildForge_Services_DBO_Project::iterateAll($services);
foreach ($projects as $project) {
// Do stuff
}
class Projects {
public function render() {
$projects = BuildForge_Services_DBO_Project
::iterateFiltered(
$this->services,
$filter
);
$this->view->register_object('listing', $projects);
}
}
<tbody id="listing">
<?php try {
foreach ($_['listing'] as $project_instance) {
print '<tr>';
// etc.
print '</tr>';
}
} catch (Exception $e) { /* do something */ } ?>
</tbody>
class BuildForge_ServicesConnection
implements BuildForge_Strings_Localizer {
protected function createResponse() {
$this->mode = BUILDFORGE_SERVICES_MODE_READ;
$response = new BuildForge_Services_JSONResponse($this);
$response->attach($this);
return $response;
}
public function update(SplSubject $subject) {
$this->mode = BUILDFORGE_SERVICES_MODE_IDLE;
}
}
class BuildForge_Services_Response
extends BuildForge_Utilities_Observable {
public function __destruct() {
$this->readRemaining();
$this->notify();
}
}
print $project;
/* prints:
Project[projectId=5bd405d70c3f1000d081238b009625ac, level=6, name=Project One, class=58BB01F0-836A-11DD-A3D4-8B1B7F9F254D, selectorId=5bd403da0c3f100086e8238b0043b5da, tag=BUILD_$B, envId=, active=1, snotify=0, pnotify=0, fnotify=0, maxThread=0, runLimit=0, tagSync=, sticky=, passChainId=, failChainId=, geoId=, isDefaultSnapshot=1, snapshotUuid=!Snapshot, snapshotSetUuid=5bd405d30c3f1000d080238b009625ac, parentUuid=, steps= <Step[stepUuid=5bd405de0c3f1000d082238b009625ac, projectId=5bd405d70c3f1000d081238b009625ac, stepId=1, envId=, filterId=, inlineChainId=, description=Step one, stepType=REGULAR, dir=/, passNotify=0, failNotify=0, onFail=HALT, selectorId=, threaded=NO, absolute=, timeout=300, maxIterations=100, level=0, broadcast=, commandText=echo "hi", elseCommandText=, conditionText=, passChainId=, failChainId=, elseInlineId=, active=1, passWait=, failWait=]>]
*/
$projectTwo = clone $projectOne;
$projectTwo->setName('Look, a new Project!');
$projectTwo->create();
