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


PHP ArrayIterator::offsetSet方法代码示例

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


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

示例1: ProcceedToPayment

 public function ProcceedToPayment()
 {
     include_once "models/FlightModel.php";
     $flightId = Request::RequestParams("flightid");
     $category = Request::RequestParams("ticketcategory");
     $children = Request::RequestParams("children");
     $adults = Request::RequestParams("adults");
     $typeticket = Request::RequestParams("typeticket");
     //set the booking details
     $booking = new BookInfo();
     $booking->adult_no = isset($adults) ? $adults : 0;
     $booking->children_no = isset($children) ? $children : 0;
     $booking->flight_id = $flightId;
     $booking->ticket_cat = $category;
     $booking->ticket_type = $typeticket;
     $flightModel = new FlightModel();
     $this->viewModel->flightDbModel = $flightModel;
     $this->viewModel->flight = $flightModel->GetFlightById($flightId);
     if ($booking->validated()) {
         if ($this->viewModel->flight != NULL) {
             $booking->ticket_adult_price = $this->viewModel->flight->ticketPrice;
         }
     } else {
         //else still required more informations
         $attr = new ArrayIterator();
         $attr->offsetSet("class", "warning");
         $attr->offsetSet("style", "border:1px solid #000;");
         ContextManager::ValidationFor("warning", $booking->getError());
     }
     $this->ViewBag("Title", "Booking");
     $this->ViewBag("Controller", "Booking");
     $this->ViewBag("Page", "Flight");
     Session::set("BOOKINFO", $booking);
     return $this->View($this->viewModel, "Home", "Index");
 }
开发者ID:jimobama,项目名称:app,代码行数:35,代码来源:BookingController.php

示例2: hydrateResource

 public function hydrateResource()
 {
     $role = $this->role;
     $resources = $role->getResources();
     foreach ($resources as $value) {
         $this->resources->offsetSet($value, $value);
     }
     return $this;
 }
开发者ID:brenodouglas,项目名称:mvc,代码行数:9,代码来源:Role.php

示例3: offsetSet

 public function offsetSet($key, $value)
 {
     if ((int) $value % 3 === 0 or (int) $value % 5 === 0) {
         parent::offsetSet($key, $value);
     }
     return;
 }
开发者ID:Stunt,项目名称:iterators,代码行数:7,代码来源:FizzBuzzFilter.php

示例4: offsetSet

 /**
  * Sets a collection entry
  *
  * @param string $index
  * @param string $content
  *
  * @throws \MarkdownExtended\Exception\UnexpectedValueException it the argument does not implement `\MarkdownExtended\API\ContentInterface`
  */
 public function offsetSet($index, $content)
 {
     if (!is_object($content) || !Kernel::valid($content, Kernel::TYPE_CONTENT)) {
         throw new UnexpectedValueException(sprintf('Method "%s" expects the second parameter to implement "%s", got "%s"', __METHOD__, Kernel::CONTENT_INTERFACE, is_object($content) ? get_class($content) : gettype($content)));
     }
     parent::offsetSet($index, $content);
 }
开发者ID:atelierspierrot,项目名称:markdown-extended,代码行数:15,代码来源:ContentCollection.php

示例5: offsetSet

 /**
  * Set object
  *
  * @param mixed $index
  * @param Currency $newval
  */
 public function offsetSet($index, $newval)
 {
     if (!$newval instanceof $this->currencyClass) {
         throw new \InvalidArgumentException(sprintf('$newval must be an instance of Currency, instance of "%s" given', get_class($newval)));
     }
     parent::offsetSet($index, $newval);
 }
开发者ID:dji-m,项目名称:LexikCurrencyBundle,代码行数:13,代码来源:AbstractCurrencyAdapter.php

示例6: offsetSet

 /**
  */
 public function offsetSet($offset, $value)
 {
     if (is_null($roffset = $this->_getRealOffset($offset))) {
         parent::offsetSet($offset, $value);
     } else {
         parent::offsetSet($roffset, $value);
     }
 }
开发者ID:x59,项目名称:horde-support,代码行数:10,代码来源:CaseInsensitiveArray.php

示例7: collect

 public function collect(\Iterator $iterator) : \Traversable
 {
     $collection = new \ArrayIterator();
     foreach ($iterator as $key => $value) {
         $collection->offsetSet($key, $value);
     }
     return $collection;
 }
开发者ID:intrawarez,项目名称:sabertooth,代码行数:8,代码来源:ArrayIteratorCollector.php

示例8: offsetSet

 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Set value for an offset
  *
  * @link http://php.net/manual/en/arrayiterator.offsetset.php
  *
  * @param string $index  <p>
  *                       The index to set for.
  *                       </p>
  * @param string $newval <p>
  *                       The new value to store at the index.
  *                       </p>
  *
  * @throws Exception\Collection When the collection has been marked as read-only
  * @throws Exception\Collection When the given type is not correct
  */
 public function offsetSet($index, $newval)
 {
     if ($this->isReadOnly() === true) {
         throw Exception\Collection::readOnly(get_class($this));
     }
     if ($this->isValidValue($newval) === false) {
         throw Exception\Collection::invalidType($newval, get_class($this));
     }
     parent::offsetSet($index, $newval);
 }
开发者ID:aviogram,项目名称:common,代码行数:26,代码来源:AbstractCollection.php

示例9: reflect

 /**
  * Reflect the handle class
  *
  * @param string $class
  * @return Collection\Method
  * @throws Exception\InvalidArgument
  */
 public function reflect($class)
 {
     if (class_exists($class) === false) {
         throw new Exception\InvalidArgument(sprintf($this->exceptions[1], $class), 1);
     }
     // Check if we've already reflected this class
     if (static::$reflections->offsetExists($class)) {
         return static::$reflections->offsetGet($class);
     }
     // Create reflection
     $reflectionClass = new \ReflectionClass($class);
     $reflectionMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC);
     // Method container
     $methods = new Collection\Method();
     // Loop through the class methods (Only public);
     foreach ($reflectionMethods as $reflectionMethod) {
         // Create method information entity
         $method = new Entity\Method();
         $method->setName($reflectionMethod->getName());
         // Get method parameters
         $reflectionParams = $reflectionMethod->getParameters();
         // Evaluate the method params
         foreach ($reflectionParams as $reflectionParam) {
             // Create parameter information entity
             $parameter = new Entity\Parameter();
             $parameter->setIndex($reflectionParam->getPosition());
             $parameter->setName($reflectionParam->getName());
             $parameter->setRequired($reflectionParam->isDefaultValueAvailable() === false);
             // Only set default value when param is optional
             if ($parameter->getRequired() === false) {
                 $parameter->setDefault($reflectionParam->getDefaultValue());
             }
             // Add the parameter to the container
             $method->addParameter($parameter);
         }
         // Add the method to the method container
         $methods->offsetSet(strtolower($method->getName()), $method);
     }
     // Cache reflection in the runtime
     self::$reflections->offsetSet($class, $methods);
     // Return the methods
     return $methods;
 }
开发者ID:jdolieslager,项目名称:jsonrpc,代码行数:50,代码来源:HandlerReflectionMaker.php

示例10: extractArray

 /**
  * Extract array of var in object
  * @param   Object $object
  * @returns array Array extracted of the object
  */
 public function extractArray($object, $isRecursive = false)
 {
     if (method_exists($object, "toArray")) {
         return $object->toArray();
     }
     $arrayCollection = new \ArrayIterator();
     $reflection = new \ReflectionClass($object);
     $vars = array_keys($reflection->getdefaultProperties());
     foreach ($vars as $key) {
         $value = $this->resolveGetNameMethod($key, $object);
         if ($value !== null) {
             if (is_object($value) && !$isRecursive) {
                 $arrayCollection->offsetSet($key, $this->extractArray($value, true));
             } else {
                 $arrayCollection->offsetSet($key, $value);
             }
         }
     }
     return $arrayCollection->getArrayCopy();
 }
开发者ID:brenodouglas,项目名称:doctrineconfig,代码行数:25,代码来源:SimpleHydrator.php

示例11: getAnnotations

 /**
  * Get Annotations Found
  *
  * @return array
  *   Found Annotations
  */
 public function getAnnotations()
 {
     $data = new \ArrayIterator();
     $domains = $this->matchDomainAnnotations($this->application);
     if (count($domains) > 0) {
         $data->offsetSet('Domains', $domains);
     }
     $data->offsetSet('Path', $this->matchPathAnnotation($this->application));
     // Listing Controllers Methods and reducing (or amplifying) the list to its Action Methods
     $actions = $this->application->getControllers()->getIterator();
     iterator_apply($actions, function (\Iterator $iterator) {
         $action = new Actions(new \ArrayIterator($iterator->current()->getClass()->getMethods()));
         $iterator->offsetSet($iterator->key(), $action->getAnnotations());
         return TRUE;
     }, array($actions));
     if ($actions->count() > 0) {
         $data->offsetSet('Routes', $actions->getArrayCopy());
     }
     return $data;
 }
开发者ID:nextframework,项目名称:next,代码行数:26,代码来源:Applications.php

示例12: getHandler

 /**
  * Get the handler based on the namespace
  *
  * @param string $namespace
  * @return object
  * @throws Exception\ArgumentException
  */
 protected function getHandler($namespace)
 {
     // Chack if namespace has been registered
     if ($this->handlers->offsetExists($namespace) === false) {
         throw new Exception\InvalidArgument(sprintf($this->exceptions[1], $namespace), 1);
     }
     // Create instance when needed
     if ($this->handlerInstances->offsetExists($namespace) === false) {
         $handler = $this->handlers->offsetGet($namespace);
         $this->handlerInstances->offsetSet($namespace, new $handler());
     }
     // Return instance
     return $this->handlerInstances->offsetGet($namespace);
 }
开发者ID:jdolieslager,项目名称:jsonrpc,代码行数:21,代码来源:Server.php

示例13: addRequest

 public function addRequest(EntityRequest $request, $callable = null)
 {
     $id = $request->getId();
     if ($id === null && $callable !== null) {
         throw new Exception\InvalidArgument('Request ID is NULL. This means no response for server. Cannot ' . 'attach callable to this request.', 1);
     }
     if ($id !== null && array_key_exists($id, $this->ids)) {
         throw new Exception\RuntimeException('Cannot add same id `' . $id . '` twice to the stack!');
     }
     // Add the callable to the stack
     if ($id !== null) {
         $this->ids[$id] = $callable;
     }
     return parent::offsetSet(null, $request);
 }
开发者ID:jdolieslager,项目名称:jsonrpc,代码行数:15,代码来源:Request.php

示例14: Search

 function Search()
 {
     $arry = new ArrayIterator();
     $chkOptionType = Request::RequestParams("rbticketType");
     $txtForm = Request::RequestParams("txtForm");
     $txtTo = Request::RequestParams("txtTo");
     $txtDepatureDate = Request::RequestParams("txtDepatureDate");
     $txtreturndate = Request::RequestParams("txtreturndate");
     $sltflight = Request::RequestParams("sltflight");
     $sltTicketType = Request::RequestParams("sltTicketType");
     $txtadults = Request::RequestParams("txtadults");
     $txtchildren = Request::RequestParams("txtchildren");
     Session::set("children", $txtchildren);
     Session::set("adults", $txtadults);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         //search on flights base on the given informations
         $this->db = new Database();
         $statement = "select *from tbl_flight where to_where =:to_where or from_where=:from_where or " . " landingDate =:landingDate or BoardDate =:BoardDate or BoardingTime =:BoardingTime or " . " price =:price ";
         $smt = $this->db->prepare($statement);
         $smt->bindValue(":to_where", $txtTo);
         $smt->bindValue(":from_where", $txtForm);
         $smt->bindValue(":landingDate", $statement);
         $smt->bindValue(":BoardDate", $txtDepatureDate);
         $smt->bindValue(":BoardingTime", $txtreturndate);
         $smt->bindValue(":price", $statement);
         $status = $smt->execute();
         if (!$status) {
             print_r($smt->errorInfo());
         }
         //get all the results
         //  $flight= new Flight();
         Session::set("Searching", "1");
         $counter = 0;
         while ($row = $smt->fetch(PDO::FETCH_ASSOC)) {
             $flight = new Flight();
             $flight->Id = $row["id"];
             $flight->Landingtime = $row["LandingTime"];
             $flight->boardingTime = $row["BoardingTime"];
             $flight->deptureDate = $row["BoardDate"];
             $flight->from = $row["from_where"];
             $flight->landindDate = $row["landingDate"];
             $flight->stops = $row["noofstop"];
             $flight->ticketPrice = $row["price"];
             $flight->to = $row["to_where"];
             $flight->seats = $row["seats"];
             $flight->status = $row["status"];
             $flight->planeID = $row["planeID"];
             $arry->offsetSet($counter, $flight);
             $counter++;
         }
     }
     $this->ViewBag("Title", "Search flight");
     $this->ViewBag("Controller", "Flight");
     $this->ViewBag("Page", "SearchFlights");
     $this->flightModelView->flightList = $arry;
     $controller = "Home";
     $action = "Index";
     ContextManager::PartialView("SearchFlights", "Flight");
     Session::set("SubView", "SearchFlights");
     return $this->View($this->flightModelView, $controller, $action);
 }
开发者ID:jimobama,项目名称:app,代码行数:61,代码来源:FlightController.php

示例15: addLocHelper

 /**
  * @param LocationHelper $locHelper
  * @return $this
  */
 public function addLocHelper(LocationHelper $locHelper)
 {
     $this->locations->offsetSet($locHelper->getLoc()["lid"], $locHelper);
     return $this;
 }
开发者ID:mbabenko21,项目名称:likedimion-game,代码行数:9,代码来源:Supervision.php


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