本文整理汇总了PHP中Reference类的典型用法代码示例。如果您正苦于以下问题:PHP Reference类的具体用法?PHP Reference怎么用?PHP Reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Reference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isSatisfiedBy
public function isSatisfiedBy(Reference $reference)
{
if ($reference->getIsCouple() == true) {
return true;
}
return false;
}
示例2: isSatisfiedBy
public function isSatisfiedBy(Reference $reference)
{
if ($reference->getRentShare() <= 500) {
return true;
}
return false;
}
示例3: setList
private function setList()
{
$name = 'Fortune 1000 (' . $this->year . ')';
$list = Doctrine_Query::create()->from('LsList L')->where('L.name = ?', $name)->fetchOne();
//if thlis year's fortune list doesn't already exist, create it
if (!$list) {
try {
$this->db->beginTransaction();
$list = new LsList();
$list->name = $name;
$list->description = "Fortune Magazine's list of the 1000 US companies with the largest published revenue figures.";
$list->is_ranked = 1;
$list->save();
$this->list = $list;
$ref = new Reference();
$ref->object_model = 'LsList';
$ref->object_id = $list->id;
$ref->fields = 'name, description, is_ranked';
$ref->source = 'http://money.cnn.com/magazines/fortune/fortune500/' . $this->year . '/full_list/';
$ref->name = 'Fortune Magazine Online';
$ref->save();
if (!$this->testMode) {
$this->db->commit();
}
} catch (Exception $e) {
$this->db->rollback();
throw $e;
}
} else {
$this->list = $list;
}
}
示例4: isSatisfiedBy
public function isSatisfiedBy(Reference $reference)
{
if ($reference->getStatus() == 'complete') {
return true;
}
return false;
}
示例5: searchCrossRefDOI
public static function searchCrossRefDOI($doi)
{
$doi = preg_replace('!\\s+!', ' ', $doi);
$url = "http://api.crossref.org/works/" . $doi;
$apiRequest = Yii::app()->curl->run($url);
if ($apiRequest->hasErrors()) {
throw new CHttpException(500, 'Gagal menghubungi server CrossRef');
} else {
$apiResponse = CJSON::decode($apiRequest->getData());
if ($apiResponse === null) {
throw new CHttpException(404, "Tidak ditemukan hasil dari CrossRef");
}
$refType = $apiResponse['message']['type'];
$ref = new Reference();
switch ($refType) {
case 'journal-article':
return $ref->createJournal($apiResponse['message']);
case 'proceedings-article':
return $ref->createProceeding($apiResponse['message']);
case 'book-chapter':
return $ref->createBookChapter($apiResponse['message']);
case 'reference-entry':
return $ref->createBookChapter($apiResponse['message']);
default:
throw new CHttpException(404, "Tidak ditemukan hasil dari CrossRef");
}
}
}
示例6:
/**
* Swap this reference with another
* @param \twhiston\twLib\Reference\Reference $point
* @return mixed|null
*/
public function &swap(Reference &$point)
{
$tmp =& $this->point;
$pr =& $point->getRef();
$this->reset($pr);
$point->reset($tmp);
return $tmp;
}
示例7: 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();
}
示例8: setClasspathRef
/**
* Reference to a classpath to use when loading the files.
*
* @param Reference $r
*
* @throws BuildException
*/
public function setClasspathRef(Reference $r)
{
if ($this->isReference()) {
throw $this->tooManyAttributes();
}
$this->classpathId = $r->getRefId();
$this->createClasspath()->setRefid($r);
}
示例9: testAddDeveloperIdOnFirstWrite
function testAddDeveloperIdOnFirstWrite() {
$reference = new Reference();
$reference->write();
$this->assertEquals(
$reference->DeveloperID,
Member::currentUserID(),
'Developer ID is automatically set on first write'
);
}
示例10: del
function del()
{
$model = new Reference();
$model->del();
if ($_GET['parent'] != 0) {
$this->redirect('/reference/' . $_GET['parent'] . '/');
} else {
$this->redirect('/reference/');
}
}
示例11: testFromTemplate
public function testFromTemplate()
{
$ref = Reference::fromTemplate('fake::mockup/index.html.twig');
$this->assertEquals('fake::mockup/index.html.twig', $ref->getTemplateReference());
$this->assertEquals('index.html', $ref->getShortReference());
$this->assertEquals(0, $ref->getDepthLevel());
}
示例12: 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;
}
示例13: __construct
/**
* @return Reference
*/
public function __construct(Tracker $tracker, $keyword)
{
$base_id = 0;
$visibility = 'P';
$is_used = 1;
parent::__construct($base_id, $keyword, $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key') . ' - ' . $tracker->getName(), TRACKER_BASE_URL . '/?aid=$1&group_id=$group_id', $visibility, trackerPlugin::SERVICE_SHORTNAME, Tracker_Artifact::REFERENCE_NATURE, $is_used, $tracker->getGroupId());
}
示例14: getReference
/**
* @param string $label
*
* @return Reference|null
*/
public function getReference($label)
{
$label = Reference::normalizeReference($label);
if (isset($this->references[$label])) {
return $this->references[$label];
}
}
示例15: get_file
public function get_file($params = [])
{
$link_style = isset($params['link_style']) ? $params['link_style'] : 0;
$reference = Reference::read_file($params['file_name'], $link_style);
SiteStructure::set_page_title($reference['title']);
Render::html($reference['content'], [], 'text/html');
}