当前位置: 首页>>代码示例>>PHP>>正文


PHP Person::setName方法代码示例

本文整理汇总了PHP中Person::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::setName方法的具体用法?PHP Person::setName怎么用?PHP Person::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDelete

 public function testDelete()
 {
     $person = new Person();
     $person->setPersonKindID(1);
     $person->setUsername("timmy");
     $person->setName("Timothy");
     $person->setPhone("000-101-1010");
     $person->save();
     $this->assertTrue(Person::personExists($person->getUsername()) != false);
     $person->delete();
     $this->assertTrue(!Person::personExists($person->getUsername()));
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:12,代码来源:personTest.php

示例2: fromXML

 /**
  * @param SimpleXMLElement $xml
  * @return Person
  * @throws InvalidGPXException
  */
 public static function fromXML(SimpleXMLElement $xml)
 {
     $person = new Person();
     if (!empty($xml->name)) {
         $person->setName((string) $xml->name[0]);
     }
     if (!empty($xml->email)) {
         $person->setEmail(Email::fromXML($xml->email[0]));
     }
     if (!empty($xml->link)) {
         $person->setLink(Link::fromXML($xml->link[0]));
     }
     return $person;
 }
开发者ID:Crayg,项目名称:PHPGPX,代码行数:19,代码来源:Person.php

示例3: SocialSecurity

 function testCreate_OneToOne()
 {
     $this->_createModelAndIncludeThem('social_security', 'SocialSecurity');
     $this->_createModelAndIncludeThem('person', 'Person');
     $ss = new SocialSecurity();
     $ss->setCode($ss_code = 42);
     $ss->save();
     $person = new Person();
     $person->setName($person_name = 'Vasya');
     $person->setSocialSecurity($ss);
     $person->save();
     $loaded_ss = lmbActiveRecord::findById('SocialSecurity', $ss->getId());
     $this->assertEqual($loaded_ss->getCode(), $ss_code);
     $this->assertEqual($loaded_ss->getPerson()->getId(), $person->getId());
     $loaded_person = lmbActiveRecord::findById('Person', $person->getId());
     $this->assertEqual($loaded_person->getSocialSecurity()->getId(), $ss->getId());
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:17,代码来源:lmbModelConstructorTest.class.php

示例4: save_register

 public function save_register()
 {
     $newPerson = new Person();
     $toRepository = new Administration();
     $newPerson->setTitle(Input::get('userTitle'));
     $newPerson->setName(Input::get('txtName'));
     $newPerson->setSurname(Input::get('txtSurName'));
     $newPerson->setPosition_ID(Input::get('userPosition'));
     $newPerson->setBirthday(Input::get('txtBirthday'));
     $newPerson->setNational_ID(Input::get('txtIdent'));
     $newPerson->setType_ID(Input::get('userType'));
     $newPerson->setDepartment_ID(Input::get('userDepart'));
     $newPerson->setDivision_ID(Input::get('userDivision'));
     $newPerson->setEmail(Input::get('txtEmail'));
     $newPerson->setTelphone(Input::get('txtTel'));
     $returnValue = $toRepository->addPerson($newPerson);
     if ($returnValue == 1) {
         return View::make('alert/person/alertRegister');
     } else {
         return View::make('alert/person/alertRegister2');
     }
 }
开发者ID:pmonkeyshoot,项目名称:special-robot,代码行数:22,代码来源:PersonController.php

示例5: testJsonSerialize

 public function testJsonSerialize()
 {
     $commit = new Person();
     $commit->setName('Name');
     $this->assertInternalType('array', $commit->jsonSerialize());
 }
开发者ID:afoozle,项目名称:github-webhook,代码行数:6,代码来源:PersonTest.php

示例6: Person

<?php

// load all classes we need
require 'NameInterface.php';
require 'AbstractAge.php';
require 'Person.php';
require 'Employee.php';
require 'Animal.php';
require 'Application.php';
// thanks to the abstract class, Person has setAge method enforced
$person = new Person();
$person->setAge(10);
$person->setName("Gary Tong");
// thanks to inheritance, Employee has the Person methods available
$employee = new Employee();
$employee->setAge(30);
$employee->setName("Gary Tong");
// thanks to an interface, Animal has the setName method enforced
$animal = new Animal();
$animal->setName("Snofu Tong");
$app = new Application($person);
echo $app::VERSION;
// get the class constant
$app->run();
开发者ID:chrisbautista,项目名称:bcit-applied-development,代码行数:24,代码来源:index.php

示例7: Person

<?php

require_once 'Person.php';
session_start();
$p = new Person();
if ($_POST) {
    $p->setName($_POST['name']);
    $p->setAge($_POST['age']);
    $_SESSION['person'] = $p;
    header('Location:page2.php');
}
//if (isset($_POST['name'])) {
//    $_SESSION['name'] = $_POST['name'];
//    header('Location:page2.php');
//}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<form action="" method="post">
    <label for="name">Name</label>
    <input type="text" name="name" id="name">

    <label for="age">Age</label>
    <input type="text" name="age" id="age">
开发者ID:gpichurov,项目名称:ittalents_season5,代码行数:30,代码来源:page1.php

示例8: addCommit

 public static function addCommit($sCommit, $sAuthor)
 {
     // Get author info seperated first
     // Bradley T. Hughes <bradley.hughes@nokia.com>
     $aAuthorBits = array();
     if (!preg_match("/(.+) \\<(.+)(?:@| at )([^. ]*)[ .]?.*\\>/", $sAuthor, $aAuthorBits)) {
         die("couldn't get author info for author " . $sAuthor . "\n");
     }
     // matches are:
     // string 0
     // real name 1
     // email (from bit) 2
     // email (domain bit, first word only to avoid TLD madness) 3
     //
     // first, try find the Organisation this Person belongs to
     $oOrganisation = self::findOrganisation($aAuthorBits[3]);
     if (!$oOrganisation) {
         // create one
         $oOrganisation = new Organisation();
         $oOrganisation->setName($aAuthorBits[3]);
         // add under both name and email thingy
         self::$aOrganisations[strtolower($aAuthorBits[3])] = $oOrganisation;
     }
     // let's try find a Person
     $oPerson = self::findPerson($aAuthorBits[1]);
     if (!$oPerson) {
         // try again
         $oPerson = self::findPerson($aAuthorBits[2]);
     }
     if (!$oPerson) {
         // Person record doesn't exist, let's create one
         $oPerson = new Person();
         $oPerson->setName($aAuthorBits[1]);
         $oPerson->setEmail($sAuthor);
         // add under both name and email thingy
         self::$aPersons[strtolower($aAuthorBits[1])] = $oPerson;
         self::$aPersons[strtolower($aAuthorBits[2])] = $oPerson;
     }
     // always set their organisation, as people may move from one org to
     // another and keep contributing.
     $oPerson->setOrganisation($oOrganisation);
     // simple bookkeeping first
     $oPerson->setCommitCount($oPerson->commitCount() + 1);
     $oPerson->organisation()->setCommitCount($oPerson->organisation()->commitCount() + 1);
     $oPerson->appendToCommitQueue($sCommit);
 }
开发者ID:rburchell,项目名称:gitstats,代码行数:46,代码来源:gitstats.php

示例9: Course

$s->load(true);
$courses = $s->getCourses();
foreach ($courses as $c) {
    echo $c->getDescription() . "\n";
}
$c = new Course();
$c->setId(1);
$c->load();
echo $c->getDescription() . "\n";
$students = $c->getStudents();
foreach ($students as $s) {
    echo $s->getName() . "\n";
}
//SEARCH
$p = new Person();
$p->setName('Mat');
$search = $p->search();
$search->orderBy('name');
$list = $search->execute();
foreach ($list as $p) {
    echo $p->getName() . "\n";
}
//Recursive Search
$c = new City();
$c->setName('San');
$p = new Person();
$p->setCity($c);
$b = new Book();
$b->setAuthor($p);
$list = $b->search()->execute();
foreach ($list as $b) {
开发者ID:mateusfornari,项目名称:hypersistence-alpha,代码行数:31,代码来源:index.php

示例10: assignPageContent

 public function assignPageContent(\phpQueryObject $_)
 {
     $this->setSynopsis(trim($_['p[itemprop=description]']->text()));
     if ($duration = $_['[itemprop=duration]']->attr('datetime')) {
         $this->setLength(new \DateInterval($duration));
     }
     $this->setRating((double) $_['[itemprop=ratingValue]']->text());
     $this->setTitle(trim($_['h1 [itemprop=name]']->text()));
     $this->setVotes((int) preg_replace('/[^\\d]+/', '', $_['[itemprop=ratingCount]']->text()));
     $this->setPosterUri($_['img[itemprop=image]']->attr('src'));
     $this->setDatePublished(\DateTime::createFromFormat('Y-m-d', $_['.infobar [itemprop="datePublished"]']->attr('content')));
     $g = [];
     foreach ($_['.infobar [itemprop=genre]'] as $genre) {
         $g[] = pq($genre)->text();
     }
     $this->setGenres($g);
     foreach ($_['#title-overview-widget [itemtype="http://schema.org/Person"][itemprop!=actors]'] as $x) {
         $x = pq($x);
         foreach ($x['a[itemprop=url]'] as $p) {
             $p = pq($p);
             $person = new Person();
             $person->setId(preg_replace('@^.*(nm\\d+).*@', '$1', $p->attr('href')));
             $person->setName($p->text());
             if (!isset($this->_people[$x->attr('itemprop')])) {
                 $this->_people[$x->attr('itemprop')] = [];
             }
             $this->_people[$x->attr('itemprop')][$person->getId()] = $person;
         }
     }
     // Casting
     if (!isset($this->_people['actors'])) {
         $this->_people['actors'] = [];
     }
     foreach ($_['table.cast_list tr:has([itemprop=name])'] as $p) {
         $p = pq($p);
         $actor = new Actor();
         $actor->setId(preg_replace('@^.*(nm\\d+).*@', '$1', $p['[itemprop=url]']->attr('href')));
         $actor->setName($p['[itemprop=name]']->text());
         $actor->setCharacter($p['a[href^=/character]']->text());
         $this->_people['actors'][$actor->getId()] = $actor;
     }
 }
开发者ID:arsonik,项目名称:imdb-client,代码行数:42,代码来源:Title.php

示例11: Person

 echo "## Loading\n";
 $p = new Person();
 $p->setId($id);
 $db->load($p);
 $p->prettyPrint();
 echo "## Updating\n";
 $p->setColor('red');
 $db->update($p);
 $p->prettyPrint();
 echo "## Loading Multiple\n";
 $p2 = new Person();
 $p2->setName('Bob');
 $p2->setColor('red');
 $db->insert($p2);
 $p3 = new Person();
 $p3->setName('John');
 $p3->setColor('purple');
 $db->insert($p3);
 $people = $db->loadMulti(new Person(), " color='red' ");
 foreach ($people as $person) {
     $person->prettyPrint();
 }
 echo "## Updating Multiple\n";
 $p = new Person();
 $p->setColor('blue');
 $db->updateMulti($p, " color='red' ");
 $people = $db->loadMulti(new Person());
 foreach ($people as $person) {
     $person->prettyPrint();
 }
 echo "### Deleting purple\n";
开发者ID:etenil,项目名称:objectomatic,代码行数:31,代码来源:test.php

示例12: setUpPerson

 private function setUpPerson()
 {
     $person = new Person();
     $person->setPersonKindID(getPersonKindID($this->request['personKind']));
     $person->setUsername($this->request['username']);
     $person->setName($this->request['name']);
     $person->setPhone($this->request['phone']);
     $person->save();
     return $person->getID();
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:10,代码来源:class.NiceCatchAPI.php

示例13: getName

<?php

include __DIR__ . '/../autoload.php';
class Person
{
    protected $name;
    public function getName()
    {
        return $this->name;
    }
    public function setName($name)
    {
        $this->name = $name;
    }
}
$person = new Person();
$person->setName('Jack');
$form = new Gregwar\Formidable\Form('<form method="post">
    <input type="text" name="name" mapping="name" />
    </form>');
$form->setData($person);
echo $form;
/*
Will output something like:

<form method="post">
    <input required="required" type="text" name="name" value="Jack" />
    <input type="hidden" name="csrf_token" value="aa27f437cc6127c244db14361fd614af51c79aac" />
</form>
*/
开发者ID:rgv151,项目名称:Formidable,代码行数:30,代码来源:mapping.php

示例14: loadPeopleFromDb

/**
 * Loads the people that are currently in the people table in our database.
 *
 * @return {HashMap.<String, Person>} The hash table with the people, where
 *     the key is the name of each person (lower case, no diacritics, all
 *     names sorted alphabetically).
 */
function loadPeopleFromDb()
{
    $results = array();
    $s = mysql_query("SELECT * FROM people");
    while ($r = mysql_fetch_array($s)) {
        $person = new Person();
        $person->setName($r['name']);
        $person->setDisplayName($r['display_name']);
        $person->setId($r['id']);
        $results[$person->name] = $person;
    }
    return $results;
}
开发者ID:rochris,项目名称:hartapoliticii,代码行数:20,代码来源:people_lib.php

示例15: addRoleToShow

 /**
  * Utility function for adding a person to this show. A new person
  * record is created if they don't already exist.
  *
  * @param Show $show This show.
  * @param string $role_type The type of role ('cast', 'band', 'prod')
  * @param string $role_name Director, Producer, Macbeth..
  * @param string $person_name The person's name
  */
 private function addRoleToShow(Show $show, $role_type, $role_name, $person_name)
 {
     $role = new Role();
     $role->setType($role_type);
     $role->setRole($role_name);
     $em = $this->getDoctrine()->getManager();
     $person_repo = $em->getRepository('ActsCamdramBundle:Person');
     /* Try and find the person. Add a new person if they don't exist. */
     $person = $person_repo->findCanonicalPerson($person_name);
     if ($person == null) {
         $person = new Person();
         $person->setName($person_name);
         $slug = Sluggable\Urlizer::urlize($person_name, '-');
         $person->setSlug($slug);
         $em->persist($person);
     }
     $role->setPerson($person);
     /* Append this role to the list of roles of this type. */
     $order = $this->getDoctrine()->getRepository('ActsCamdramBundle:Role')->getMaxOrderByShowType($show, $role->getType());
     $role->setOrder(++$order);
     $role->setShow($show);
     $em->persist($role);
     $person->addRole($role);
     $show->addRole($role);
     $em->flush();
 }
开发者ID:dstansby,项目名称:camdram,代码行数:35,代码来源:ShowController.php


注:本文中的Person::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。