Created
December 15, 2010 16:29
-
-
Save nfabre/742199 to your computer and use it in GitHub Desktop.
Connexion.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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