本文整理汇总了PHP中Person::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::getName方法的具体用法?PHP Person::getName怎么用?PHP Person::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postSendEmail
public function postSendEmail($p, $z)
{
$person = new Person($p[1]);
$token = $person->generateToken('resetPassword');
$message = new GuiMessage();
$message->setFrom('thesystem@rickgigger.com', 'The System');
$message->addTo($person->getEmail(), $person->getName());
$message->setSubject('password reset');
$message->assign('token', $token);
$message->send('messages/setPassword.tpl');
die;
}
示例2: getOwnerName
function getOwnerName($ownerType, $id)
{
$ownerName = "";
switch ($ownerType) {
case "Person":
$person = new Person();
$person->selectRecord($id);
$ownerName = $person->getName();
$this->tpl->set_var("openWin", "PersonDetails.php" . $this->sess->url("") . "&personID=" . $id . "&formAction=viewOnly");
break;
case "Company":
$company = new Company();
$company->selectRecord($id);
$ownerName = $company->getCompanyName();
$this->tpl->set_var("openWin", "CompanyDetails.php" . $this->sess->url("") . "&companyID=" . $id . "&formAction=viewOnly");
break;
}
return $ownerName;
}
示例3: testSave
public function testSave()
{
$person = new Person();
$person->setPersonKindID(1);
$person->setUsername("timmy");
$person->setName("Timothy");
$person->setPhone("000-101-1010");
$person->save();
$this->assertTrue($person->getID() != NULL);
$fetched = new Person();
$fetched->fetch($person->getID());
$this->assertEquals($person->getID(), $fetched->getID());
$this->assertEquals($person->getPersonKindID(), $fetched->getPersonKindID());
$this->assertEquals($person->getUsername(), $fetched->getUsername());
$this->assertEquals($person->getName(), $fetched->getName());
$this->assertEquals($person->getPhone(), $fetched->getPhone());
//delete from DB for cleanup
//TODO -- replace with proper delete method
$sql = "DELETE FROM `people` WHERE id=?";
$sql = $this->db->prepareQuery($sql, $person->getID());
$this->db->query($sql);
}
示例4: printAllEmployees
<body>
<?php
function printAllEmployees($employees)
{
foreach ($employees as $employee) {
echo "Id : " . $employee->id . "\n" . "Name : " . $employee->name . "\n";
}
}
include_once "Entities\\Person.php";
include_once "Entities\\Employee.php";
include_once "Entities\\Manager.php";
include_once "Entities\\Department.php";
$ivan = new Person("vano", 111);
// $ivan -> id = 111123;
// $ivan -> name = "vano";
echo $ivan->getName() . "\n";
echo $ivan->getId() . "\n";
echo $ivan->__get("name") . "\n";
echo $ivan->__get("id") . "\n";
$ivanSalary = $ivan->__get("salary") . "\n";
$ivanAge = $ivan->age . "\n";
// неявно вызывает функцию __get
echo "ivan has salary :" . $ivanSalary;
echo "ivan has age :" . $ivanAge;
$he = new Employee();
$hisResult = $he->work(true);
echo "Он работал весь день и результат: " . $hisResult . "\n";
$she = new Manager(10000000);
$herSalary = $she->salary;
echo "Она не работала весь день и ее зарплата: " . $herSalary . "\n";
$employees = array();
示例5: writeName
function writeName(Person $p)
{
print $p->getName() . "\n";
}
示例6: testsperengine
//.........这里部分代码省略.........
if (count($ids) != 0) {
SmartTest::failedTest();
}
SmartTest::instance()->progress();
$ids = RedBean_OODB::getBySQL("`gender`={gender} AND `color`={clr} ", array("gender" => "m", "clr" => "red"), "person");
if (count($ids) != 0) {
SmartTest::failedTest();
}
SmartTest::instance()->progress();
R::gen("Person");
$dummy = new Person();
$dummy->age = 40;
SmartTest::instance()->test(count(Person::find($dummy, array("age" => ">"))), 1);
$dummy->age = 20;
SmartTest::instance()->test(count(Person::find($dummy, array("age" => ">"))), 2);
$dummy->age = 100;
SmartTest::instance()->test(count(Person::find($dummy, array("age" => ">"))), 0);
$dummy->age = 100;
SmartTest::instance()->test(count(Person::find($dummy, array("age" => "<="))), 2);
$dummy->name = "ob";
SmartTest::instance()->test(count(Person::find($dummy, array("name" => "LIKE"))), 1);
$dummy->name = "o";
SmartTest::instance()->test(count(Person::find($dummy, array("name" => "LIKE"))), 2);
$dummy->gender = "m";
SmartTest::instance()->test(count(Person::find($dummy, array("gender" => "="))), 2);
$dummy->gender = "f";
SmartTest::instance()->test(count(Person::find($dummy, array("gender" => "="))), 0);
SmartTest::instance()->test(count(Person::listAll()), 2);
SmartTest::instance()->test(count(Person::listAll(0, 1)), 1);
SmartTest::instance()->test(count(Person::listAll(1)), 1);
$can = Person::where("`gender`={gender} order by `name` asc", array("gender" => "m"), "person");
//test array access
foreach ($can as $item) {
if ($item->getName() == "Bob" || $item->getName() == "John") {
SmartTest::instance()->progress();
} else {
SmartTest::failedTest();
}
}
//test array access
$bean = $can[0];
if ($bean->name == "Bob") {
SmartTest::instance()->progress();
} else {
SmartTest::failedTest();
}
if ($can->count() != 2) {
SmartTest::failedTest();
}
SmartTest::instance()->progress();
$can->rewind();
SmartTest::instance()->test($can->key(), 0);
SmartTest::instance()->test($can->valid(), true);
SmartTest::instance()->test($can->current()->getName(), "Bob");
$can->next();
SmartTest::instance()->test($can->key(), 1);
SmartTest::instance()->test($can->valid(), false);
SmartTest::instance()->test($can->current()->getName(), "John");
$can->seek(0);
SmartTest::instance()->test($can->key(), 0);
$beans = $can->getBeans();
if (count($beans) != 2) {
SmartTest::failedTest();
}
SmartTest::instance()->progress();
//test slicing
示例7: die
if ($kwak->hasSibling($kwak) != false) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
} else {
SmartTest::instance()->progress();
}
if ($kwak->hasSibling($donald) != false) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
} else {
SmartTest::instance()->progress();
}
//copy
SmartTest::instance()->canwe = "copy functions";
$kwak2 = $kwak->copy();
$id = $kwak2->save();
$kwak2 = new Person($id);
if ($kwak->getName() != $kwak2->getName()) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
} else {
SmartTest::instance()->progress();
}
SmartTest::instance()->canwe = "countRelated";
R::gen("Blog,Comment");
$blog = new Blog();
$blog2 = new Blog();
$blog->setTitle("blog1");
$blog2->setTitle("blog2");
for ($i = 0; $i < 5; $i++) {
$comment = new Comment();
$comment->setText("comment no. {$i} ");
$blog->add($comment);
}
示例8: Name
<?php
class Name
{
function Name($_name)
{
$this->name = $_name;
}
function display()
{
echo $this->name . "\n";
}
}
class Person
{
private $name;
function person($_name, $_address)
{
$this->name = new Name($_name);
}
function getName()
{
return $this->name;
}
}
$person = new Person("John", "New York");
$person->getName()->display();
示例9: Person
<?php
require_once 'autoload.php';
$person = new Person('Nikol', 121213048, false, 500000);
$person2 = new Person('Ivan', 12123048, true, 200000);
$car = new Car('Honda Accord', 36000, true, 'white', 260);
$car2 = new Car('Nissan GTR', 150000, true, 'black', 320);
$carShop = new CarShop();
$carShop->addCar($car);
$carShop->addCar($car2);
echo ' The price of the ' . $car->getModel() . ' for scrap is ' . $car->calculatePriceForScrap(10000) . '.', PHP_EOL;
echo $person->buyCar($car2), PHP_EOL;
echo 'After buying a new ' . $person->getCar()->getModel() . ', ' . $person->getName() . ' has ' . $person->getMoney() . ' money left.', PHP_EOL;
echo 'After selling the car for scrap, ' . $person->getName() . ' has ' . $person->sellCarForScrap(15000) . ' money left.', PHP_EOL;
$car2->changeOwner($person2);
echo 'The new owner of the ' . $car2->getModel() . ' is: ' . $car2->getOwner()->getInfo();
示例10: array
<?php
/* @var $this PersonController */
/* @var $model Person */
$this->breadcrumbs = array('Сотрудники' => array('index'), $model->id);
$this->menu = array(array('label' => 'Список сотрудников', 'url' => array('index')), array('label' => 'Создать', 'url' => array('create')), array('label' => 'Изменить', 'url' => array('update', 'id' => $model->id)), array('label' => 'Управление', 'url' => array('admin')));
?>
<h1><?php
echo Person::getName($model->id);
?>
</h1>
<?php
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', 'first_name', 'middle_name', 'last_name', array('label' => 'Подразделение', 'type' => 'raw', 'value' => !empty($model->department_id) ? CHtml::encode($model->department->name) : 'Not Set'), array('label' => 'Организация', 'value' => CHtml::encode($model->company->name)), array('label' => 'Пользователь', 'value' => !empty($model->user->username) ? CHtml::encode($model->user->username) : 'Not Set'), 'status', 'position')));
示例11: isEqualTo
public function isEqualTo(Person $person)
{
return $this->getName() == $person->getName();
}
示例12: equals
/**
* @param Person $person
*
* @return bool
*/
public function equals(Person $person)
{
return $person->getName() === $this->name && $person->getEmail() === $this->email;
}
示例13: testGetName
/**
* Tests Person->getName()
*/
public function testGetName()
{
$this->assertEquals('NAME', $this->Person->getName());
}
示例14: testName
/**
* @dataProvider getNames
* @param string $in
* @param string $out
*/
public function testName($in, $out)
{
$this->contact->expects($this->once())->method('getName')->will($this->returnValue($in));
$this->assertSame($out, $this->entity->getName());
}
示例15: dirname
<?php
require_once dirname(dirname(__FILE__)) . '/models/config.php';
$reports = json_decode(CallAPI("GET", "https://people.cs.clemson.edu/~jacksod/api/v1/reports?filter=new"), true)['data'];
//expand report location and person to show details, not just ID
if (is_array($reports)) {
for ($i = 0; $i < count($reports); $i++) {
$person = new Person();
$person->fetch($reports[$i]['personID']);
$reports[$i]['personKind'] = $person->getPersonKindName();
$reports[$i]['personName'] = $person->getName();
$reports[$i]['personUsername'] = $person->getUsername();
$reports[$i]['personPhone'] = $person->getPhone();
$location = new Location();
$location->fetch($reports[$i]['locationID']);
$reports[$i]['locationBuilding'] = $location->getBuildingName();
$reports[$i]['locationRoom'] = $location->getRoom();
}
}
//var_dump($reports);
?>
<?php
include 'header.php';
?>
<!-- in .container div -->
<div class='row'>
<div class='col-sm-12'>
<div class="page-header">