本文整理汇总了PHP中Reference::getReferencedObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Reference::getReferencedObject方法的具体用法?PHP Reference::getReferencedObject怎么用?PHP Reference::getReferencedObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::getReferencedObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* @throws BuildException
*/
public function main()
{
$reffed = $this->reference !== null ? $this->reference->getReferencedObject($this->getProject()) : null;
if ($reffed !== null && $reffed instanceof BuildException) {
throw $reffed;
}
parent::main();
}
示例2: dieOnCircularReference
/**
* Check to see whether any DataType we hold references to is
* included in the Stack (which holds all DataType instances that
* directly or indirectly reference this instance, including this
* instance itself).
*
* If one is included, throw a BuildException created by circularReference
*
* This implementation is appropriate only for a DataType that
* cannot hold other DataTypes as children.
*
* The general contract of this method is that it shouldn't do
* anything if checked is true and set it to true on exit.
*
* @param $stk
* @param Project $p
*
* @return void
*
* @throws BuildException
*/
public function dieOnCircularReference(&$stk, Project $p)
{
if ($this->checked || !$this->isReference()) {
return;
}
$o = $this->ref->getReferencedObject($p);
if ($o instanceof DataType) {
// TESTME - make sure that in_array() works just as well here
//
// check if reference is in stack
//$contains = false;
//for ($i=0, $size=count($stk); $i < $size; $i++) {
// if ($stk[$i] === $o) {
// $contains = true;
// break;
// }
//}
if (in_array($o, $stk, true)) {
// throw build exception
throw $this->circularReference();
} else {
array_push($stk, $o);
$o->dieOnCircularReference($stk, $p);
array_pop($stk);
}
}
$this->checked = true;
}
示例3: getCheckedRef
/**
* Performs the check for circular references and returns the referenced object.
*
* @param $requiredClass
* @param $dataTypeName
*
* @throws BuildException
*
* @return mixed
*/
public function getCheckedRef($requiredClass, $dataTypeName)
{
if (!$this->checked) {
// should be in stack
$stk = array();
$stk[] = $this;
$this->dieOnCircularReference($stk, $this->getProject());
}
$o = $this->ref->getReferencedObject($this->getProject());
if (!$o instanceof $requiredClass) {
throw new BuildException($this->ref->getRefId() . " doesn't denote a " . $dataTypeName);
} else {
return $o;
}
}
示例4: setRefid
/**
* @param Reference $r
*
* @throws BuildException
*/
public function setRefid(Reference $r)
{
if (count($this->parameters) !== 0 || $this->className !== null) {
throw $this->tooManyAttributes();
}
$o = $r->getReferencedObject($this->getProject());
if ($o instanceof PhingFilterReader) {
$this->setClassName($o->getClassName());
$this->setClasspath($o->getClassPath());
foreach ($o->getParams() as $p) {
$this->addParam($p);
}
} else {
$msg = $r->getRefId() . " doesn\\'t refer to a PhingFilterReader";
throw new BuildException($msg);
}
parent::setRefid($r);
}
示例5: setRefid
function setRefid(Reference $r)
{
if (count($this->filterReaders) !== 0) {
throw $this->tooManyAttributes();
}
// change this to get the objects from the other reference
$o = $r->getReferencedObject($this->getProject());
if ($o instanceof FilterChain) {
$this->filterReaders = $o->getFilterReaders();
} else {
throw new BuildException($r->getRefId() . " doesn't refer to a FilterChain");
}
parent::setRefid($r);
}
示例6: main
/** Do the execution.
* @throws BuildException if something is invalid
*/
public function main()
{
$savedPath = $this->path;
$savedPathSep = $this->pathSep;
// may be altered in validateSetup
$savedDirSep = $this->dirSep;
// may be altered in validateSetup
// If we are a reference, create a Path from the reference
if ($this->isReference()) {
$this->path = new Path($this->getProject());
$this->path = $this->path->createPath();
$obj = $this->refid->getReferencedObject($this->getProject());
if ($obj instanceof Path) {
$this->path->setRefid($this->refid);
} elseif ($obj instanceof FileSet) {
$fs = $obj;
$this->path->addFileset($fs);
} elseif ($obj instanceof DirSet) {
$ds = $obj;
$this->path->addDirset($ds);
} else {
throw new BuildException("'refid' does not refer to a " . "path, fileset, dirset, or " . "filelist.");
}
}
$this->validateSetup();
// validate our setup
// Currently, we deal with only two path formats: Unix and Windows
// And Unix is everything that is not Windows
// (with the exception for NetWare and OS/2 below)
// for NetWare and OS/2, piggy-back on Windows, since here and
// in the apply code, the same assumptions can be made as with
// windows - that \\ is an OK separator, and do comparisons
// case-insensitive.
$fromDirSep = $this->onWindows ? "\\" : "/";
$rslt = '';
// Get the list of path components in canonical form
$elems = $this->path->listPaths();
foreach ($elems as $key => $elem) {
if (is_string($elem)) {
$elem = new Path($this->project, $elem);
}
$elem = $this->mapElement($elem);
// Apply the path prefix map
// Now convert the path and file separator characters from the
// current os to the target os.
if ($key !== 0) {
$rslt .= $this->pathSep;
}
$rslt .= str_replace($fromDirSep, $this->dirSep, $elem);
}
// Place the result into the specified property,
// unless setonempty == false
$value = $rslt;
if ($this->setonempty) {
$this->log("Set property " . $this->property . " = " . $value, Project::MSG_VERBOSE);
$this->getProject()->setNewProperty($this->property, $value);
} else {
if ($rslt !== '') {
$this->log("Set property " . $this->property . " = " . $value, Project::MSG_VERBOSE);
$this->getProject()->setNewProperty($this->property, $value);
}
}
$this->path = $savedPath;
$this->dirSep = $savedDirSep;
$this->pathSep = $savedPathSep;
}
示例7: getManifest
public function getManifest()
{
return $this->ref->getReferencedObject($this->getProject());
}