當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dog類代碼示例

本文整理匯總了PHP中Dog的典型用法代碼示例。如果您正苦於以下問題:PHP Dog類的具體用法?PHP Dog怎麽用?PHP Dog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Dog類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 public static function start()
 {
     $target = isset($_GET['target']) ? $_GET['target'] : 'showForm';
     switch ($target) {
         case 'register':
             require_once dirname(__FILE__) . '/ParticipationView.php';
             if (isset($_GET['idExhibition']) && $_GET['idExhibition'] > 0) {
                 require_once dirname(__FILE__) . '/Dog.php';
                 $dog = new Dog();
                 $dog->setBreed('retriiver')->setGender('m')->setBirthDate('2000-12-21');
                 require_once dirname(__FILE__) . '/Exhibition.php';
                 $exhibition = new Exhibition();
                 $exhibition->setId($_GET['idExhibition']);
                 $exhibition->setCompleteExhibition();
                 $exhibition->insertDog($dog);
                 echo ParticipationView::buildMessage(array('dog' => $dog, 'exhibition' => $exhibition));
             } else {
                 echo ParticipationView::buildErrorMessage();
             }
             break;
         case 'showForm':
         default:
             require_once dirname(__FILE__) . '/Exhibition.php';
             $exhibitions = Exhibition::getListOfTypeExhibitions();
             require_once dirname(__FILE__) . '/ParticipationView.php';
             echo ParticipationView::buildRegistrationForm(array('exhibitions' => $exhibitions));
             break;
     }
 }
開發者ID:piiskop,項目名稱:pstk,代碼行數:29,代碼來源:index.php

示例2: testCallback_ManyConditions_CalledBack

 /**
  * @throws \ValidationException
  * @throws null
  */
 public function testCallback_ManyConditions_CalledBack()
 {
     $dog = new Dog();
     $dog->Name = 'Johnny';
     $owner1 = new Human();
     $owner1->Name = 'Bob';
     $owner2 = new Human();
     $owner2->Name = 'Wot';
     $cat = new Cat();
     $cat->Name = 'Agnis';
     $afterExists = new \OnAfterExists(function () use($dog) {
         $dog->write();
     });
     $afterExists->addCondition($owner1, function ($owner) use($dog) {
         $dog->Name .= ' ' . $owner->Name;
         $dog->OwnerID = $owner->ID;
     });
     $afterExists->addCondition($owner2, function ($owner) use($dog) {
         $dog->Name .= ' ' . $owner->Name;
         $dog->OwnerID = $owner->ID;
     });
     $afterExists->addCondition($cat, function ($cat) use($dog) {
         $dog->Name .= ' ' . $cat->Name;
     });
     $owner1->write();
     $this->assertFalse($dog->exists());
     $owner2->write();
     $this->assertFalse($dog->exists());
     $cat->write();
     $this->assertTrue($dog->exists());
     $this->assertEquals($owner2->ID, $dog->OwnerID);
     $this->assertEquals('Johnny Bob Wot Agnis', $dog->Name);
 }
開發者ID:helpfulrobot,項目名稱:littlegiant-silverstripe-batchwrite,代碼行數:37,代碼來源:OnAfterExistsTest.php

示例3: testShouldChooseOnlyTheFavorite

 public function testShouldChooseOnlyTheFavorite()
 {
     $priority = array('Balsamao', 'Fernando', 'Evaldo', 'Tagliati');
     $dog = new Dog($priority);
     $availablePeople = array('Fernando', 'Balsamao');
     $result = $dog->chooseFavoritePerson($availablePeople);
     $expect = "Not Found";
     $this->assertEquals($expect, $result);
 }
開發者ID:amaivsimau,項目名稱:dojos,代碼行數:9,代碼來源:DogTest.php

示例4: testDog

 public function testDog()
 {
     $dog = new Dog("Benji");
     $this->assertEquals("Benji", $dog->getName());
     $this->assertEquals("Benji the Dog", (string) $dog);
     $dog->setName("Rover");
     $this->assertEquals("Rover", $dog->getName());
     $this->assertEquals("Rover the Dog", (string) $dog);
 }
開發者ID:SamyGhannad,項目名稱:CtCI-6th-Edition,代碼行數:9,代碼來源:AnimalTest.php

示例5: addNewPhotos

 public function addNewPhotos(Dog $dog)
 {
     $dogID = $dog->getID();
     $stmt = $this->db->prepare("select " . self::$headShot . ",\n                                           " . self::$standLeft . ",\n                                           " . self::$standRight . ",\n                                           " . self::$eventPlace . ",\n                                           " . self::$eventDate . ",\n                                           " . self::$eventDescr . ",\n                                           " . self::$photographer . ",\n                                           " . self::$isPuppy . "\n                                                            from dog\n                                                            INNER JOIN images ON dog.dogID = images.dogID\n                                                            INNER JOIN event ON images.eventID = event.eventID\n                                                            INNER JOIN photographer ON images.photographerID = photographer.photographerID\n                                                            where dog.dogID ='{$dogID}'");
     if ($stmt === FALSE) {
         throw new \Exception($this->db->error);
     }
     $stmt->execute();
     $stmt->bind_result($headshot, $standLeft, $standRight, $eventPlace, $eventDate, $eventDescr, $photographer, $isPuppy);
     while ($stmt->fetch()) {
         $photo = new Photo($headshot, $standLeft, $standRight, $eventDate, $this->encodeToIso($eventPlace), $this->encodeToIso($eventDescr), $this->encodeToIso($photographer), $isPuppy);
         $dog->addPhoto($photo);
     }
 }
開發者ID:mingman,項目名稱:aussiegallery,代碼行數:14,代碼來源:DogDAL.php

示例6: reply

 public function reply($message)
 {
     Dog::reply($message);
     return true;
     // 		if (true === $this->player->isOptionEnabled(SR_Player::WWW_OUT))
     // 		{
     // 			$this->player->message($message);
     // 		}
     // 		else
     // 		{
     // 			Dog::reply($message);
     // 			if (NULL === ($user = $this->player->getUser()))
     // 			{
     // 				echo "PLAYER HAS NO USER IN SHADOWRAP.\n";
     // 			}
     // 			elseif (false === ($server = $user->getServer()))
     // 			{
     // 				echo "USER HAS NO SERVER IN SHADOWRAP.\n";
     // 			}
     // 			else
     // 			{
     // 				# BAH
     // 			}
     // 		}
     // 		return true;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:26,代碼來源:Shadowrap.php

示例7: providerRequestPing

 public function providerRequestPing()
 {
     $walker_id = Session::get('walker_id');
     $time = date("Y-m-d H:i:s");
     $query = "SELECT id,owner_id,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where is_cancelled = 0 and status = 0 and current_walker={$walker_id} and TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') <= 600 limit 1";
     $requests = DB::select(DB::raw($query));
     $request_data = array();
     foreach ($requests as $request) {
         $request_data['success'] = "true";
         $request_data['request_id'] = $request->id;
         $request_data['time_left_to_respond'] = 600 - $request->diff;
         $owner = Owner::find($request->owner_id);
         $request_data['owner'] = array();
         $request_data['owner']['name'] = $owner->first_name . " " . $owner->last_name;
         $request_data['owner']['picture'] = $owner->picture;
         $request_data['owner']['phone'] = $owner->phone;
         $request_data['owner']['address'] = $owner->address;
         $request_data['owner']['latitude'] = $owner->latitude;
         $request_data['owner']['longitude'] = $owner->longitude;
         $request_data['owner']['rating'] = DB::table('review_dog')->where('owner_id', '=', $owner->id)->avg('rating') ?: 0;
         $request_data['owner']['num_rating'] = DB::table('review_dog')->where('owner_id', '=', $owner->id)->count();
         $request_data['dog'] = array();
         if ($dog = Dog::find($owner->dog_id)) {
             $request_data['dog']['name'] = $dog->name;
             $request_data['dog']['age'] = $dog->age;
             $request_data['dog']['breed'] = $dog->breed;
             $request_data['dog']['likes'] = $dog->likes;
             $request_data['dog']['picture'] = $dog->image_url;
         }
     }
     $response_code = 200;
     $response = Response::json($request_data, $response_code);
     return $response;
 }
開發者ID:netGALAXYStudios,項目名稱:ourmovingapp,代碼行數:34,代碼來源:WebProviderController.php

示例8: testBranchDeleteIDs_DeleteManyIDs_ObjectsDeleted

 /**
  * @throws \ValidationException
  * @throws null
  */
 public function testBranchDeleteIDs_DeleteManyIDs_ObjectsDeleted()
 {
     $className = '';
     $ids = array();
     for ($i = 0; $i < 100; $i++) {
         $dog = new Dog();
         $dog->Name = 'Pup ' . $i;
         $dog->Color = 'Fifty Shade No. ' . $i;
         $dog->write();
         $className = $dog->ClassName;
         $ids[] = $dog->ID;
     }
     $batch = new \Batch();
     $batch->deleteIDs($className, $ids);
     $this->assertEquals(0, Dog::get()->Count());
 }
開發者ID:helpfulrobot,項目名稱:littlegiant-silverstripe-batchwrite,代碼行數:20,代碼來源:BatchDeleteTest.php

示例9: testCallback_SetOnAfterExistsCallback_CallbackCalled

 /**
  * @throws \ValidationException
  * @throws null
  */
 public function testCallback_SetOnAfterExistsCallback_CallbackCalled()
 {
     $dog1 = new Dog();
     $dog1->Name = 'Jim bob';
     $dog2 = new Dog();
     $dog2->Name = 'Super Dog';
     $owner = new Human();
     $owner->Name = 'Hilly Stewart';
     $owner->write();
     $owner->onAfterExistsCallback(function ($owner) use($dog1) {
         $dog1->OwnerID = $owner->ID;
         $dog1->write();
     });
     $owner->write();
     $owner->onAfterExistsCallback(function ($owner) use($dog2) {
         $dog2->OwnerID = $owner->ID;
         $dog2->write();
     });
     $this->assertTrue($owner->exists());
     $this->assertTrue($dog1->exists());
     $this->assertTrue($dog2->exists());
     $this->assertEquals(1, Human::get()->Count());
     $this->assertEquals(2, Dog::get()->Count());
     $this->assertEquals($owner->ID, $dog1->OwnerID);
     $this->assertEquals($owner->ID, $dog2->OwnerID);
 }
開發者ID:helpfulrobot,項目名稱:littlegiant-silverstripe-batchwrite,代碼行數:30,代碼來源:WriteCallbackTest.php

示例10: getAutoTargetISO

 private static function getAutoTargetISO()
 {
     if (false !== ($channel = Dog::getChannel())) {
         return $channel->getLangISO();
     } else {
         return Dog::getUser()->getLangISO();
     }
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:8,代碼來源:DOGMOD_Translate.php

示例11: connect

 public static function connect(Dog_Server $server)
 {
     if (false === ($nick = self::getNickData($server))) {
         return Dog_Log::warn(sprintf('No nicks for %s.', $server->displayName()));
     }
     $server->addUser(Dog::getOrCreateUserByName($nick->getName()));
     $conn = $server->getConnection();
     return self::sendUser($conn, $server, $nick) && self::sendNick($conn, $server, $nick);
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:9,代碼來源:Dog_Auth.php

示例12: claim

 public function claim()
 {
     foreach (Dog::getServers() as $server) {
         $server instanceof Dog_Server;
         if ($this->isEnabled($server, false) && $server->isConnected()) {
             $this->claimServer($server);
         }
     }
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:9,代碼來源:DOGMOD_ClaimNick.php

示例13: dog_plugin_alert_func4

 function dog_plugin_alert_func4(array $args)
 {
     global $DOG_PLUG_ALERT_TIMERS;
     $scope = $args[0];
     $scope instanceof Dog_Scope;
     Dog::setScope($scope);
     Dog::reply($args[1]);
     $DOG_PLUG_ALERT_TIMERS[$scope->getUser()->getID()]--;
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:9,代碼來源:alert_Pb.php

示例14: announceVideo

 private function announceVideo(array $data)
 {
     // Pick ISO for channel?
     if (false !== ($chan = Dog::getChannel())) {
         $iso = $chan->getLangISO();
     } else {
         $iso = Dog::getUser()->getLangISO();
     }
     $vars = array($data['title'], GWF_TimeConvert::humanDurationISO($iso, $data['duration']), sprintf('%.02f', $data['rating']), number_format($data['views']), number_format($data['num_raters']));
     Dog::reply($this->langISO($iso, 'video', $vars));
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:11,代碼來源:DOGMOD_YouTube.php

示例15: testWrite_WriteObjects_ObjectsWritten

 /**
  *
  */
 public function testWrite_WriteObjects_ObjectsWritten()
 {
     $batchSizes = array(10, 30, 100, 300);
     foreach ($batchSizes as $size) {
         $owners = array();
         $dogs = array();
         $cats = array();
         $writer = new \BatchedWriter($size);
         for ($i = 0; $i < 100; $i++) {
             $owner = new Human();
             $owner->Name = 'Human ' . $i;
             $dog = new Dog();
             $dog->Name = 'Dog ' . $i;
             $cat = new Cat();
             $cat->Name = 'Cat ' . $i;
             $owner->onAfterExistsCallback(function ($owner) use($dog, $writer) {
                 $dog->OwnerID = $owner->ID;
                 $writer->write($dog);
             });
             $dog->onAfterExistsCallback(function ($dog) use($cat, $writer) {
                 $cat->EnemyID = $dog->ID;
                 $writer->write($cat);
             });
             $owners[] = $owner;
             $dogs[] = $dog;
             $cats[] = $cat;
         }
         // writes dogs first time
         $writer->write($dogs);
         // dogs written again from owner callback
         $writer->write($owners);
         $writer->finish();
         $owners = Human::get();
         $dogs = Dog::get();
         $cats = Cat::get();
         $this->assertEquals(100, $owners->Count());
         $this->assertEquals(100, $dogs->Count());
         $this->assertEquals(100, $cats->Count());
         for ($i = 0; $i < 100; $i++) {
             $owner = $owners[$i];
             $dog = $dogs[$i];
             $cat = $cats[$i];
             $this->assertEquals($owner->ID, $dog->OwnerID);
             $this->assertEquals($dog->ID, $cat->EnemyID);
         }
         $writer->delete($owners);
         $writer->delete($dogs);
         $writer->delete($cats);
         $writer->finish();
         $this->assertEquals(0, Human::get()->Count());
         $this->assertEquals(0, Dog::get()->Count());
         $this->assertEquals(0, Cat::get()->Count());
     }
 }
開發者ID:helpfulrobot,項目名稱:littlegiant-silverstripe-batchwrite,代碼行數:57,代碼來源:BatchedWriterTest.php


注:本文中的Dog類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。