Skip to content

Instantly share code, notes, and snippets.

@nfabre
Created December 15, 2010 16:29
Show Gist options
  • Save nfabre/742199 to your computer and use it in GitHub Desktop.
Save nfabre/742199 to your computer and use it in GitHub Desktop.
Connexion.php
<?php
require_once "phing/types/DataType.php";
/**
* This Type represents a Connection.
*/
class Connexion extends DataType {
private $username;
private $password;
/**
* @return the $username
*/
public function getUsername(Project $p) {
if ($this->isReference()) {
return $this->getRef($p)->getUsername($p);
}
return $this->username;
}
/**
* @return the $password
*/
public function getPassword(Project $p) {
if ($this->isReference()) {
return $this->getRef($p)->getPassword($p);
}
return $this->password;
}
/**
* @param field_type $username
*/
public function setUsername($username) {
$this->username = $username;
}
/**
* @param field_type $password
*/
public function setPassword($password) {
$this->password = $password;
}
/**
* Your datatype must implement this function, which ensures that there
* are no circular references and that the reference is of the correct
* type.
*
* @return Connexion
*/
public function getRef(Project $p) {
if ( !$this->checked ) {
$stk = array();
array_push($stk, $this);
$this->dieOnCircularReference($stk, $p);
}
$o = $this->ref->getReferencedObject($p);
if ( !($o instanceof Connexion) ) {
throw new BuildException($this->ref->getRefId()." doesn't denote a Connexion");
} else {
return $o;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment