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


PHP static::add方法代碼示例

本文整理匯總了PHP中static::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP static::add方法的具體用法?PHP static::add怎麽用?PHP static::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在static的用法示例。


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

示例1: fromString

 /**
  * Parse a query string into a Query object
  *
  * @param string $query Query string to parse
  *
  * @return self
  */
 public static function fromString($query)
 {
     $q = new static();
     if ($query === '') {
         return $q;
     }
     $foundDuplicates = $foundPhpStyle = false;
     foreach (explode('&', $query) as $kvp) {
         $parts = explode('=', $kvp, 2);
         $key = rawurldecode($parts[0]);
         if ($paramIsPhpStyleArray = substr($key, -2) == '[]') {
             $foundPhpStyle = true;
             $key = substr($key, 0, -2);
         }
         if (isset($parts[1])) {
             $value = rawurldecode(str_replace('+', '%20', $parts[1]));
             if (isset($q[$key])) {
                 $q->add($key, $value);
                 $foundDuplicates = true;
             } elseif ($paramIsPhpStyleArray) {
                 $q[$key] = array($value);
             } else {
                 $q[$key] = $value;
             }
         } else {
             $q->add($key, null);
         }
     }
     // Use the duplicate aggregator if duplicates were found and not using
     // PHP style arrays.
     if ($foundDuplicates && !$foundPhpStyle) {
         $q->setAggregator(self::duplicateAggregator());
     }
     return $q;
 }
開發者ID:helsaba,項目名稱:rainloop-webmail,代碼行數:42,代碼來源:Query.php

示例2: fromString

 /**
  * Parse a query string into a QueryString object
  *
  * @param string $query Query string to parse
  *
  * @return self
  */
 public static function fromString($query)
 {
     $q = new static();
     if (0 !== strlen($query)) {
         if ($query[0] == '?') {
             $query = substr($query, 1);
         }
         foreach (explode('&', $query) as $kvp) {
             $parts = explode('=', $kvp, 2);
             $key = rawurldecode($parts[0]);
             $paramIsPhpStyleArray = substr($key, -2) == '[]';
             if ($paramIsPhpStyleArray) {
                 $key = substr($key, 0, -2);
             }
             if (array_key_exists(1, $parts)) {
                 $value = rawurldecode(str_replace('+', '%20', $parts[1]));
                 if ($paramIsPhpStyleArray && !$q->hasKey($key)) {
                     $value = array($value);
                 }
                 $q->add($key, $value);
             } else {
                 $q->add($key, '');
             }
         }
     }
     return $q;
 }
開發者ID:creazy412,項目名稱:vmware-win10-c65-drupal7,代碼行數:34,代碼來源:QueryString.php

示例3: request

 public static function request()
 {
     $class = new static();
     !Input::has('deleteShippingMethod') ?: $class->delete(Input::get('deleteShippingMethod'));
     !Input::has('updateShippingMethod') ?: $class->update(Input::get('updateShippingMethod'))->with(Input::get('shipping.fill'));
     !Input::has('addShippingMethod') ?: $class->add()->with(Input::get('shipping.fill'));
 }
開發者ID:artemsk,項目名稱:veer-core,代碼行數:7,代碼來源:Shipping.php

示例4: nextWorkingDay

 private function nextWorkingDay($current)
 {
     if ($current->format('H') < 19 && !$this->isSunday($current) && !$this->isWeekend($current) && !$this->isHoliday($current)) {
         $next = new static($current->format('Y-m-d ' . static::DEFAULT_OFFICE_CLOSE_TIME), $this->timezone);
     } else {
         $next = new static($current->format('Y-m-d ' . static::DEFAULT_OFFICE_CALL_TIME), $this->timezone);
         $i = 0;
         // We have 0 future dates to start with
         while ($i < 1) {
             $next->add(new DateInterval('P1D'));
             // Add 1 day
             if ($this->isHoliday($next)) {
                 continue;
             }
             // Don't include year to ensure the check is year independent
             // Note that you may need to do more complicated things for special holidays that don't use specific dates like "the last Friday of this month"
             if ($this->isWeekend($next)) {
                 continue;
             }
             // These next lines will only execute if continue isn't called for this iteration
             $i++;
         }
     }
     return $next;
 }
開發者ID:ravikumar8,項目名稱:response,代碼行數:25,代碼來源:Response.php

示例5: request

 public static function request()
 {
     $class = new static();
     $class->acton = Input::get('action');
     !Input::has('deleteSearch') ?: $class->delete(Input::get('deleteSearch'));
     $class->action != 'addSearch' ?: $class->add(Input::get('search'), Input::get('users'));
 }
開發者ID:artemsk,項目名稱:veer-core,代碼行數:7,代碼來源:Search.php

示例6: fromFileScan

 /**
  * @ignore
  */
 public static function fromFileScan($uPattern)
 {
     $tSep = quotemeta(DIRECTORY_SEPARATOR);
     $tPos = strrpos($uPattern, $tSep);
     if ($tSep !== '/' && $tPos === false) {
         $tSep = '/';
         $tPos = strrpos($uPattern, $tSep);
     }
     if ($tPos !== false) {
         $tPattern = substr($uPattern, $tPos + strlen($tSep));
         $tPath = substr($uPattern, 0, $tPos + strlen($tSep));
     } else {
         $tPath = $uPattern;
         $tPattern = "";
     }
     $tTemp = new static();
     $tHandle = new \DirectoryIterator($tPath);
     $tPatExists = strlen($uPattern) > 0;
     for (; $tHandle->valid(); $tHandle->next()) {
         if (!$tHandle->isFile()) {
             continue;
         }
         $tFile = $tHandle->current();
         if ($tPatExists && !fnmatch($tPattern, $tFile)) {
             continue;
         }
         $tTemp->add($tPath . $tFile);
     }
     return $tTemp;
 }
開發者ID:eserozvataf,項目名稱:scabbia1,代碼行數:33,代碼來源:FileCollection.php

示例7: request

 public static function request()
 {
     $class = new static();
     Input::get('action') != 'addComment' ?: $class->add(Input::all());
     !Input::has('hideComment') ?: $class->hide(head(Input::get('hideComment', [])));
     !Input::has('unhideComment') ?: $class->unhide(head(Input::get('unhideComment', [])));
     !Input::has('deleteComment') ?: $class->delete(head(Input::get('deleteComment', [])));
 }
開發者ID:artemsk,項目名稱:veer-core,代碼行數:8,代碼來源:Comment.php

示例8: forType

 /**
  * @param string $type_
  *
  * @return \Components\Object_Properties
  */
 public static function forType($type_)
 {
     $instance = new static($type_);
     foreach (self::arrayForType($type_) as $property) {
         $instance->add($property['name'], $property['type'], $property['nameMapped'], $property['typeMapped']);
     }
     return $instance;
 }
開發者ID:evalcodenet,項目名稱:net.evalcode.components.object,代碼行數:13,代碼來源:properties.php

示例9: fromArray

 /**
  * @param array $strings
  *
  * @return static
  */
 public static function fromArray(array $strings)
 {
     $list = new static();
     foreach ($strings as $oneString) {
         $list->add($oneString);
     }
     return $list;
 }
開發者ID:hansel23,項目名稱:strongly-typed,代碼行數:13,代碼來源:StringList.php

示例10: createFailure

 /**
  * convenience method to create a simple failure report
  * 
  * @param string $message
  * @param mixed $errors
  * @return common_report_Report
  */
 public static function createFailure($message, $errors = array())
 {
     $report = new static(self::TYPE_ERROR, $message);
     foreach ($errors as $error) {
         $report->add($error);
     }
     return $report;
 }
開發者ID:nagyist,項目名稱:generis,代碼行數:15,代碼來源:class.Report.php

示例11: fromConfig

 public static function fromConfig($config)
 {
     $collection = new static();
     foreach ($config as $key => $config) {
         $collection->add($key, $config);
     }
     return $collection;
 }
開發者ID:vespakoen,項目名稱:bolt-core,代碼行數:8,代碼來源:ExtensionCollection.php

示例12: build

 /**
  * A handy starter for creating a button group with buttons.
  * @param array $buttons
  * @return ButtonGroup
  */
 public static function build(array $buttons = [])
 {
     $group = new static();
     foreach ($buttons as $button) {
         $group->add($button);
     }
     return $group;
 }
開發者ID:breachofmind,項目名稱:birdmin,代碼行數:13,代碼來源:ButtonGroup.php

示例13: getCommandResult

 /**
  * @param  CommandInterface $cmd
  * @return ResponseCollection
  */
 public function getCommandResult(CommandInterface $cmd)
 {
     $collection = new static();
     foreach (new ResponseFilterIterator($this, $cmd) as $response) {
         $collection->add($response);
     }
     return $collection;
 }
開發者ID:mahadazad,項目名稱:event-manager,代碼行數:12,代碼來源:ResponseCollection.php

示例14: fromXml

 /**
  * Construct the result based on the given xml.
  * @param SimpleXMLElement $xmlElement
  * @return \CultuurNet\Search\SuggestionsResult
  */
 public static function fromXml(SimpleXMLElement $xmlElement)
 {
     $result = new static();
     foreach ($xmlElement->xpath('//suggestion') as $xmlSuggestion) {
         $result->add(SuggestionsItem::fromXml($xmlSuggestion));
     }
     return $result;
 }
開發者ID:cultuurnet,項目名稱:search,代碼行數:13,代碼來源:SuggestionsResult.php

示例15: createRandomProducts

 public static function createRandomProducts($numberOfProducts = 1)
 {
     $collection = new static();
     for ($i = $numberOfProducts; $i > 0; $i--) {
         $collection->add(new Product());
     }
     return $collection;
 }
開發者ID:jayveloper,項目名稱:fcontrol,代碼行數:8,代碼來源:ProductCollection.php


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